← Back to subsystem
LocalSubSystemBasis¶
Source: Distributed_Design_Optimizer/subsystem/LocalSubSystemBasis.py
Local subsystem basis module.
This module provides the abstract base class for local subsystems in distributed optimization.
Classes¶
LocalSubSystemBasis¶
Inherits from: SubSystemBasis
A LocalSubSystemBasis object contains all necessary data for an individual subsystem.
This includes methods to analyse its responses, to optimize the subsystem and to couple it to neighboring subsystems.
Methods¶
init(self, id: str, level: int, neighborid: List[str], analysis: AnalysisInterface, localobjective: LocalObjectiveInterface, localconstraints: LocalConstraintsInterface, optimization: OptimizationInterface) → None
Create a new instance of LocalSubSystemBasis with neighbors.
Args:
id: Identifier for the subsystem.
level: Level identifier for the subsystem.
neighborid: Identifiers for the neighbors.
analysis: Type of analysis class.
localobjective: Type of local objective function class.
localconstraints: Type of local constraint functions class.
optimization: Type of optimization class.
initialize_Initial_Optimdata_at_Beginning(self) → LocalSubSystemOptimData
Return a LocalSubSystemOptimData object based on the subsystem's current state.
Returns:
A LocalSubSystemOptimData with all fields set to None.
initialize_Optimdata(self) → LocalSubSystemOptimData
Return a LocalSubSystemOptimData object based on the subsystem's current state.
Returns:
A LocalSubSystemOptimData initialized from the current subsystem state.
get_Finite_Differences_Jacobian(self) → FiniteDifferencesJacobian
Get the finite differences Jacobian approximation object.
Returns:
The finite differences Jacobian approximation object.
set_Scalers(self, scalers: List[ScalerBasis]) → None
Set the size of scaling for the design variables.
Args:
scalers: List of scalers for the design variables.
get_Scalers(self) → List[ScalerBasis]
📐 Pseudocode: Retrieve design variable bounds and scaling (Line 3) → SubSystemBasis.run_IterativeOptimization
Get the scalers for design variables and constraints.
Returns:
List of scalers for variables and constraints.
get_Inconsistencies(self) → List[InConsistencySizeInterface]
Get the inconsistencies.
Returns:
List of inconsistency objects for all neighbors.
evaluate_MaxInconsistency(self) → None
Evaluate the maximum inconsistency across the subsystems and the ID of it.
get_maxInconsistencyValue(self) → float | None
Get the maximum inconsistency value across the subsystems.
Returns:
The maximum inconsistency value across all neighbors, or None if not yet computed.
get_MaxInconsistencyCoupledSubsystemID(self) → str | None
Get the coupled subsystem ID with the maximum inconsistency value.
Returns:
The neighbor subsystem ID with the largest inconsistency, or None if not yet computed.
return_initialized_Inconsistencies(self) → List[InConsistencySizeInterface]
Return initialized inconsistencies.
Returns:
List of initialized InConsistencySizeInterface objects.
get_SubsystemLevel(self) → int
Get the level of the subsystem.
Returns:
The level of the subsystem.
append_Controller(self) → None
Update local subsystems by appending controller.
updateSubsystemfromOptimdata(self, optimdata: OptimDataBasis) → None
📐 Pseudocode: Post-process the optimization (subsystem) (Line 12) → Unified Algorithmic Structure; Update subsystem from optimization results (Line 24) → SubSystemBasis.run_IterativeOptimization
Update subsystem state from optimization data.
Updates design variables, objective values, constraint values, and runs analysis based on the provided optimization data.
Args:
optimdata: Optimization data containing updated values.
updateOptimdatafromSubsystem(self) → None
Update the optimdata object with the information from the state of the subsystem.
This should only be called if an optimdata object was created and should be modified afterwards (e.g. in initialization, where the optimdata object has None fields).
copy_LocalObjectiveUnscaled_Past_outerloop_itr(self, outerloop_itr_before: int) → float | None
Copy unscaled local objective from past outer loop iteration.
Args:
outerloop_itr_before: The number of outer loop iterations to go back by.
Returns:
The unscaled local objective value from the past iteration, or None if not found.
copy_LocalObjectiveUnscaled_Previous_outerloop_itr(self) → float | None
Copy the unscaled local objective from the previous outer loop iteration.
Returns:
The unscaled local objective value from the previous iteration, or None if not found.
copy_LocalObjective_Past_outerloop_itr(self, outerloop_itr_before: int) → float | None
Copy local objective from past outer loop iteration.
Args:
outerloop_itr_before: The number of outer loop iterations to go back by.
Returns:
The scaled local objective value from the past iteration, or None if not found.
copy_LocalObjective_Previous_outerloop_itr(self) → float | None
Copy the scaled local objective from the previous outer loop iteration.
Returns:
The scaled local objective value from the previous iteration, or None if not found.
copy_LocalObjective_Previous_innerloop_itr(self) → float | None
Copy the scaled local objective from the previous inner loop iteration.
Returns:
The scaled local objective value from the previous inner iteration, or None if not found.
copy_LocalObjectiveUnscaled_Previous_innerloop_itr(self) → float | None
Copy the unscaled local objective from the previous inner loop iteration.
Returns:
The unscaled local objective value from the previous inner iteration, or None if not found.
set_DesignVariables(self, designvariables: List[float]) → None
📐 Pseudocode: Set current design variables from solver (Line 5), Set optimal design variables, objectives, constraints (Line 25) → SubSystemBasis.run_IterativeOptimization
Set the scaled design variables.
Args:
designvariables: Scaled design variable values in [0, 1].
runAnalysis(self) → None
📐 Pseudocode: Solve subsystem optimization (argmin) (Line 11) → Unified Algorithmic Structure; Run analysis model (Line 7), Re-run analysis at optimum (Line 27) → SubSystemBasis.run_IterativeOptimization
Execute the analysis code associated with this subsystem.
set_Responses_Unscaled(self, Responsesin: List[float]) → None
Store the physical responses (unscaled values).
Args:
Responsesin: Physical response values (unscaled).
get_Responses_Unscaled(self) → List[float]
Return the physical responses of a subsystem (unscaled values).
Returns:
Physical response values (unscaled).
mapToCouplingParameters(self) → None
📐 Pseudocode: Map responses to coupling parameters (Line 9), Final coupling parameter update (Line 26) → SubSystemBasis.run_IterativeOptimization
Map the physical responses onto the neighboring domains.
evaluateTotalObjective(self) → None
📐 Pseudocode: Solve subsystem optimization (argmin) (Line 11) → Unified Algorithmic Structure; Solve ALC augmented Lagrangian optimization (Line 10) → Augmented Lagrangian Coordination; Innerloop decentralized Primal Update optimization (Lines 7, 8) → Consensus Augmented Lagrangian Coordination; Local subsystem NLP optimization (Line 12) → Augmented Lagrangian Alternating Direction Inexact Newton; Solve the local NLP with the linear sensitivity term (Line 8) → Sensitivity Based Distributed Programming; Evaluate total objective function (Line 6), Combine local and coordination objectives (Line 14) → SubSystemBasis.run_IterativeOptimization
Evaluate the total objective function (local + coordination).
evaluateLocalObjective(self) → None
📐 Pseudocode: Evaluate local objective (Line 11) → SubSystemBasis.run_IterativeOptimization
Evaluate the local objective function.
evaluate_Responses_and_LocalObjective(self) → None
Run the analysis, update the coupling parameters, and compute the local objective.
set_LocalObjectiveValue(self, localobjectivevaluein: float | None) → None
Set the scaled local objective value.
Args:
localobjectivevaluein: The scaled local objective value (in range [0.0, 1.0]).
get_LocalObjectiveValue(self) → float | None
Get the scaled local objective value.
Returns:
The scaled local objective value.
get_LocalObjectiveValue_Unscaled(self) → float | None
Get the unscaled local objective value.
Returns:
The unscaled local objective value.
evaluateTotalConstraint(self) → None
📐 Pseudocode: Solve subsystem optimization (argmin) (Line 11) → Unified Algorithmic Structure; Solve ALC augmented Lagrangian optimization (Line 10) → Augmented Lagrangian Coordination; Innerloop decentralized Primal Update optimization (Lines 7, 8) → Consensus Augmented Lagrangian Coordination; Local subsystem NLP optimization (Line 12) → Augmented Lagrangian Alternating Direction Inexact Newton; Solve the local NLP with the linear sensitivity term (Line 8) → Sensitivity Based Distributed Programming; Evaluate total constraints (Line 15), Combine local and coordination constraints (Line 22) → SubSystemBasis.run_IterativeOptimization
Evaluate the total constraints (local + coordination).
evaluateTotalObjectiveAndTotalConstraint(self) → None
Evaluate both total objective and total constraint in a single call.
This method combines evaluateTotalObjective() and evaluateTotalConstraint() to avoid redundant analysis and mapping operations when both values are needed (e.g., during optimization blackbox evaluations).
evaluateLocalConstraints(self) → None
📐 Pseudocode: Evaluate local constraints (Line 18) → SubSystemBasis.run_IterativeOptimization
Evaluate the local equality and inequality constraints.
set_EqualityLocalConstraintsValue(self, equalitylocalconstraintsin: List[float] | None) → None
Set the equality local constraints value (scaled01 value).
Args:
equalitylocalconstraintsin: Equality constraint values (scaled to [-0.5, 0.5]).
get_EqualityLocalConstraintsValue(self) → List[float] | None
Get the equality local constraints value (scaled01 value).
Returns:
Equality constraint values (scaled to [-0.5, 0.5]).
get_EqualityLocalConstraintsValue_Unscaled(self) → List[float] | None
Get the equality local constraints value (unscaled value).
Returns:
Equality constraint values (unscaled).
set_InequalityLocalConstraintsValue(self, inequalitylocalconstraintsvaluein: List[float] | None) → None
Set the inequality local constraints value (scaled01 value).
Args:
inequalitylocalconstraintsvaluein: Inequality constraint values (scaled to [-0.5, 0.5]).
get_InequalityLocalConstraintsValue(self) → List[float] | None
Get the inequality local constraints value (scaled01 value).
Returns:
Inequality constraint values (scaled to [-0.5, 0.5]).
get_InequalityLocalConstraintsValue_Unscaled(self) → List[float] | None
Get the inequality local constraints value (unscaled value).
Returns:
Inequality constraint values (unscaled).
evaluate_PerturbationDirectionsIndices_LocalObjectiveGradient(self, gradient_localobjective: List[float | None] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the local objective gradient.
Args:
gradient_localobjective: The local objective gradient with None entries
where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation
directions.
Returns:
List of indices where gradient approximation is needed.
evaluate_PerturbationDirectionsIndices_CoordinationObjectiveGradient(self, gradient_coordinationobjective: List[float | None] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the coordination objective gradient.
Args:
gradient_coordinationobjective: The coordination objective gradient with None entries
where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation
directions.
Returns:
List of indices where gradient approximation is needed.
evaluate_PerturbationDirectionsIndices_LocalEqualityConstraintsJacobian(self, jacobian_localequalityconstraints: List[List[float | None]] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the local equality constraints Jacobian.
Args:
jacobian_localequalityconstraints: The local equality constraints Jacobian
with None entries where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation directions.
Returns:
List of indices where Jacobian approximation is needed.
evaluate_PerturbationDirectionsIndices_CoordinationEqualityConstraintsJacobian(self, jacobian_coordinationequalityconstraints: List[List[float | None]] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the coordination equality constraints Jacobian.
Args:
jacobian_coordinationequalityconstraints: The coordination equality constraints
Jacobian with None entries where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation directions.
Returns:
List of indices where Jacobian approximation is needed.
evaluate_PerturbationDirectionsIndices_LocalInequalityConstraintsJacobian(self, jacobian_localinequalityconstraints: List[List[float | None]] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the active local inequality constraints Jacobian.
Args:
jacobian_localinequalityconstraints: The local inequality constraints
Jacobian with None entries where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation
directions.
Returns:
List of indices where Jacobian approximation is needed.
evaluate_PerturbationDirectionsIndices_CoordinationInequalityConstraintsJacobian(self, jacobian_coordinationinequalityconstraints: List[List[float | None]] | None, totalnumber_perturbationdirections: int) → List[int]
Return the perturbation direction indices for the coordination inequality constraints Jacobian.
Args:
jacobian_coordinationinequalityconstraints: The coordination inequality
constraints Jacobian with None entries where approximation is needed.
totalnumber_perturbationdirections: Total number of perturbation
directions.
Returns:
List of indices where Jacobian approximation is needed.
evaluate_PerturbationDirectionsIndices_MappedResponses(self, local_couplingparameters: List[SubSysCouplingParametersBasis], totalnumber_perturbationsdirections: int) → Dict[str, List[int]]
Return the dictionary of the mapping 'neighborID' to perturbation direction indices.
Maps 'neighborID' -> indices of coordinate directions where the Jacobian of the mapped responses to the subsystem w.r.t. ID 'neighborID' needs to be approximated.
Args:
local_couplingparameters: List of local coupling parameter objects.
totalnumber_perturbationsdirections: Total number of perturbation directions.
Returns:
Dictionary mapping neighbor IDs to lists of perturbation direction indices.
evaluate_PerturbationDirectionsIndices_MappedResponses_at_Neighbor(self, local_couplingparameter: SubSysCouplingParametersBasis, totalnumber_perturbationsdirections: int) → List[int]
Return the indices of coordinate directions where the Jacobian of the mapped responses needs to be approximated.
The Jacobian is for the mapped responses to the subsystem in the input 'local_couplingparameter'. Note that the Jacobian of mapped responses is stored in 'local_couplingparameter' by Analysis_xxx.py.
Args:
local_couplingparameter: The coupling parameter object for a specific neighbor.
totalnumber_perturbationsdirections: Total number of perturbation directions.
Returns:
List of indices where Jacobian approximation is needed.
evaluate_Gradient_LocalObjective(self) → None
Evaluate the gradient of the local objective and store it in self._optimdata.
evaluate_Gradient_TotalObjective(self) → None
Add get_Gradient_LocalObjective to get_Gradient_CoordinationObjective depending on subsystem type.
The total objective gradient is stored in self._optimdata.
evaluate_Hessian_LocalObjective(self) → List[List[float | None]] | None
Evaluate the Hessian of the local objective.
Returns:
The Hessian matrix of the local objective, or None if not provided.
evaluate_Jacobian_LocalEqualityConstraints(self) → None
Evaluate the Jacobian of the local equality constraints and store it in self._optimdata.
evaluate_Jacobian_LocalInequalityConstraints(self) → None
Evaluate the Jacobian of the local inequality constraints and store it in self._optimdata.
evaluate_Hessian_EqualityLocalConstraints(self) → List[List[List[float | None]]] | None
Evaluate the Hessian of the local equality constraints.
Returns:
The Hessian tensor of the local equality constraints, or None if not provided.
evaluate_Hessian_InequalityLocalConstraints(self) → List[List[List[float | None]]] | None
Evaluate the Hessian of the local inequality constraints.
Returns:
The Hessian tensor of the local inequality constraints, or None if not provided.
evaluate_Jacobian_TotalEqualityConstraints(self) → None
Evaluate the Jacobian of the total equality constraints if it exists.
Includes both local and coordination equality constraints. The Jacobian is stored in self._optimdata.
evaluate_Jacobian_TotalInEqualityConstraints(self) → None
Evaluate the Jacobian of the total inequality constraints if it exists.
Includes both local and coordination inequality constraints. The Jacobian is stored in self._optimdata.
evaluate_Jacobian_MappedResponses(self) → None
Evaluate the Jacobians of the mapped responses and store them in the coupling parameters.
This method calls the mapLocalResponsesDesignVariables_to_CouplingParameters_Jacobians function of self._analysis. The method in self._analysis directly calls set_MappedResponses_Jacobian of the local subsystem subclass which is abstractly defined, but this is defined in the userfiles for the specific design problems
evaluate_Hessians_MappedResponses(self) → List[List[List[List[float | None]]]] | None
Evaluate the Hessians of the mapped responses.
This method calls the mapLocalResponsesDesignVariables_to_CouplingParameters_Hessian function of self._analysis.
Returns:
The Hessian tensor of the mapped responses, or None if not provided.
evaluateAllJacobians(self) → None
Get the gradients, Jacobians, and Hessians needed for optimization.
Calls evaluate_Gradient_xxx / evaluate_Jacobian_xxx / evaluate_Hessian_xxx of LocalSubSystemBasis. It fills in missing information (e.g. by using a jacobian approximator) and stores the results via setters into the LocalToControllerCouplingParamaters.
update_LocalObjective_Gradient(self, gradient_localobjective: List[float | None] | None, indices_gradient_localobjective: List[int]) → None
Update the missing entries of the gradient of the local objective using finite differences.
Args:
gradient_localobjective: The local objective gradient with None entries
where approximation is needed.
indices_gradient_localobjective: Indices of coordinate directions to update.
update_CoordinationObjective_Gradient(self, gradient_coordinationobjective: List[float | None] | None, indices_gradient_coordinationobjective: List[int]) → None
Update the missing entries of the gradient of the coordination objective using finite differences.
Args:
gradient_coordinationobjective: The coordination objective gradient with None entries
where approximation is needed.
indices_gradient_coordinationobjective: Indices of coordinate directions to update.
update_Jacobian_LocalEqualityConstraints(self, jacobian_localequalityconstraints: List[List[float | None]] | None, indices_jacobian_localequalityconstraints: List[int]) → None
Update the missing entries of the Jacobian of the local equality constraints using finite differences.
Args:
jacobian_localequalityconstraints: The Jacobian with None entries
where approximation is needed.
indices_jacobian_localequalityconstraints: Indices of coordinate directions to update.
update_Jacobian_CoordinationEqualityConstraints(self, jacobian_coordinationequalityconstraints: List[List[float | None]] | None, indices_jacobian_coordinationequalityconstraints: List[int]) → None
Update the missing entries of the Jacobian of the coordination equality constraints using finite differences.
Args:
jacobian_coordinationequalityconstraints: The Jacobian with None entries
where approximation is needed.
indices_jacobian_coordinationequalityconstraints: Indices of coordinate directions to update.
update_Jacobian_LocalInequalityConstraints(self, jacobian_localinequalityconstraints: List[List[float | None]] | None, indices_jacobian_localinequalityconstraints: List[int]) → None
Update the missing entries of the Jacobian of the local inequality constraints using finite differences.
Args:
jacobian_localinequalityconstraints: The Jacobian with None entries
where approximation is needed.
indices_jacobian_localinequalityconstraints: Indices of coordinate directions to update.
update_Jacobian_CoordinationInequalityConstraints(self, jacobian_coordinationinequalityconstraints: List[List[float | None]] | None, indices_jacobian_coordinationinequalityconstraints: List[int]) → None
Update the missing entries of the Jacobian of all coordination inequality constraints using finite differences.
Args:
jacobian_coordinationinequalityconstraints: The Jacobian with None entries
where approximation is needed.
indices_jacobian_coordinationinequalityconstraints: Indices of coordinate directions to update.
update_Jacobians_MappedResponses(self, local_couplingparameters: List[SubSysCouplingParametersBasis], dict_indices_jacobians_mappedresponses: Dict[str, List[int]]) → None
Update the missing entries of the Jacobians of the mapped responses using finite differences.
Args:
local_couplingparameters: List of local coupling parameters to update.
dict_indices_jacobians_mappedresponses: Dictionary mapping neighbor IDs to
indices of coordinate directions to update.
update_Jacobian_LowerBounds(self, totalnumber_perturbationdirections: int) → None
Compute and store the Jacobian of all lower bounds.
The Jacobian of the lower bound constraints g_i(x) = -x_i + lb_i <= 0 is a negative identity matrix: each row i has -1 on the diagonal and 0 elsewhere. Computed for all bounds regardless of active set.
Args:
totalnumber_perturbationdirections: Total number of perturbation directions.
update_Jacobian_UpperBounds(self, totalnumber_perturbationdirections: int) → None
Compute and store the Jacobian of all upper bounds.
The Jacobian of the upper bound constraints g_i(x) = x_i - ub_i <= 0 is a positive identity matrix: each row i has +1 on the diagonal and 0 elsewhere. Computed for all bounds regardless of active set.
Args:
totalnumber_perturbationdirections: Total number of perturbation directions.
get_MappedResponse_Jacobian(self, id: str) → List[List[float]]
Get from the LocalToLocalForController_CouplingParameters the mapped responses Jacobian.
Args:
id: Identifier of the neighbor.
Returns:
The Jacobian matrix of the mapped responses for the given neighbor.
set_MappedResponses_Jacobian(self, id: str, mappedresponses_jacobian_in: List[List[float | None]]) → None
Set the mapped responses Jacobian in the LocalToLocalForController_CouplingParameters.
Only sets values if every entry is a float and the lengths are correct (which is not checked here, but typically in evaluateAllJacobians).
Args:
id: Identifier of the neighbor subsystem.
mappedresponses_jacobian_in: The Jacobian matrix to set.
get_LocalObjective_Gradient(self) → List[float]
Return the local objective gradient from self._optimdata.
Returns:
The gradient of the local objective function.
set_LocalObjective_Gradient(self, localobjective_gradient_in: List[float]) → None
Set the local objective gradient in self._optimdata.
Args:
localobjective_gradient_in: The local objective gradient to set.
get_LocalEqualityConstraint_Jacobian(self) → List[List[float]]
Return the Jacobian of the local equality constraints from self._optimdata.
Returns:
The Jacobian matrix of the local equality constraints.
set_LocalEqualityConstraint_Jacobian(self, localequalityconstraints_gradient_in: List[List[float]]) → None
Set the Jacobian of the local equality constraints in self._optimdata.
Args:
localequalityconstraints_gradient_in: The Jacobian to set.
get_LocalActiveInequalityConstraint_Jacobian(self) → List[List[float]]
Return the Jacobian of the local inequality constraints from self._optimdata.
Returns:
The Jacobian matrix of the local inequality constraints.
set_LocalActiveInequalityConstraint_Jacobian(self, localactiveinequalityconstraints_gradient_in: List[List[float]]) → None
Set the Jacobian of the local inequality constraints in self._optimdata.
Args:
localactiveinequalityconstraints_gradient_in: The Jacobian to set.
set_ReferenceDesignVariables(self, refdesignvariables: List[float] | List[None]) → None
Set the reference design variables (scaled01 values).
Args:
refdesignvariables: Reference design variable values.
Can be a list of floats in [0.0, 1.0] or a list of None values.
get_ReferenceDesignVariables(self) → List[float] | List[None] | None
Get the reference design variables.
Returns:
The reference design variables (scaled), or None if not set.
get_ReferenceDesignVariables_Unscaled(self) → List[float] | List[None] | None
Get the unscaled reference design variables.
Returns:
The reference design variables (unscaled), or None if not set.
set_ReferenceLocalObjectiveValue(self, referencelocalobjectivevalue: float | None) → None
Set the reference local objective value.
Args:
referencelocalobjectivevalue: The reference local objective value to set.
get_ReferenceLocalObjectiveValue(self) → float | None
Get the reference local objective value.
Returns:
The reference local objective value, or None if not set.
set_ReferenceLocalObjectiveValueUnscaled(self, referencelocalobjectivevalueunscaled: float | None) → None
Set the unscaled reference local objective value.
Args:
referencelocalobjectivevalueunscaled: The unscaled reference local objective value to set.
get_ReferenceLocalObjectiveValueUnscaled(self) → float | None
Get the unscaled reference local objective value.
Returns:
The unscaled reference local objective value, or None if not set.
set_MappedResponseVariables(self, id: str, mappedresponsesin: List[float], mappedresponsesin_unscaled: List[float]) → None
Store the mapped response variables for the neighboring subsystems.
Args:
id: Identifier of the neighbor.
mappedresponsesin: Mapped response values (scaled to [0, 1]).
mappedresponsesin_unscaled: Mapped response values (unscaled).
set_Copy_MappedResponseVariables(self, id: str, copymappedresponsesin: List[float]) → None
Copy the mapped variables from neighboring subsystems (scaled01 values).
Args:
id: Identifier of the neighbor.
copymappedresponsesin: Copy of mapped response values (scaled to [0, 1]).
get_Copy_MappedResponseVariables(self, id: str) → List[float] | None
Get the copy of mapped variables from neighboring subsystems (scaled01 values).
Args:
id: Identifier of the neighbor.
Returns:
Copy of mapped response values (scaled to [0, 1]).
set_CouplingVariables(self, id: str, couplingvariablein: List[float], couplingvariablein_unscaled: List[float]) → None
Store the target coupling variables for each individual subsystem.
Args:
id: Identifier of the neighboring subsystem.
couplingvariablein: Target variable for the physical response of the neighboring subsystem (scaled to [0, 1]).
couplingvariablein_unscaled: Target variable for the physical response of the neighboring subsystem (unscaled).
set_Copy_CouplingVariables(self, id: str, copycouplingvariablesin: List[float]) → None
Store a copy of the coupling variables from neighboring subsystems (scaled01 values).
Args:
id: Identifier of the subsystem from which the variables originate.
copycouplingvariablesin: Copy of coupling variable values (scaled to [0, 1]).
set_SharedDesignVariables(self, id: str, shareddesignvariablesin: List[float], shareddesignvariablesin_unscaled: List[float]) → None
Store the shared design variables for the neighboring subsystems (scaled01 values).
Args:
id: Identifier of the neighbor.
shareddesignvariablesin: Shared design variable values (scaled to [0, 1]).
shareddesignvariablesin_unscaled: Shared design variable values (unscaled).
set_Copy_SharedDesignVariables(self, id: str, copyshareddesignvariablesin: List[float]) → None
Store a copy of the shared design variables from neighboring subsystems (scaled01 values).
Args:
id: Identifier of the subsystem from which the variables originate.
copyshareddesignvariablesin: Copy of shared design variable values (scaled to [0, 1]).
set_TargetSharedDesignVariables(self, id: str, targetdesignvariablesin: List[float], targetdesignvariablesin_unscaled: List[float]) → None
Store the target shared design variables for the neighboring subsystems (scaled01 values).
Args:
id: Identifier of the neighbor.
targetdesignvariablesin: Target design variable values (scaled to [0, 1]).
targetdesignvariablesin_unscaled: Target design variable values (unscaled).
set_Copy_TargetSharedDesignVariables(self, id: str, copytargetdesignvariablesin: List[float]) → None
Store a copy of the target design variables from neighboring subsystems (scaled01 values).
Args:
id: Identifier of the subsystem from which the variables originate.
copytargetdesignvariablesin: Copy of target design variable values (scaled to [0, 1]).
set_Indices_CouplingVariables_in_DesignVariables(self, id: str, indices_couplingvariables_in_designvariables_in: List[int]) → None
Set the coupling variable indices within the design variables vector.
Args:
id: Identifier of the neighbor subsystem.
indices_couplingvariables_in_designvariables_in: The indices to set.
set_Indices_SharedDesignVariables_in_DesignVariables(self, id: str, indices_shareddesignvariables_in_designvariables_in: List[int]) → None
Set the shared design variable indices within the design variables vector.
Args:
id: Identifier of the neighbor subsystem.
indices_shareddesignvariables_in_designvariables_in: The indices to set.
set_Indices_TargetSharedDesignVariables_in_DesignVariables(self, id: str, indices_targetshareddesignvariables_in_designvariables_in: List[int]) → None
Set the target shared design variable indices within the design variables vector.
Args:
id: Identifier of the neighbor subsystem.
indices_targetshareddesignvariables_in_designvariables_in: The indices to set.
run_updateCouplingParameters_outerLoop_job(self) → None
📐 Pseudocode: Copy coupling parameters from interface storage (outer loop update) (Line 37), Update relevant coupling parameters (outer loop) (Line 38) → Unified Algorithmic Structure
Update coupling parameters in the outer loop, including inconsistency evaluation.
run_prepare_updateCouplingParameters_job(self) → None
📐 Pseudocode: Copy coupling parameters from interface storage (outer loop prepare update) (Line 32), Prepare update of relevant coupling parameters (outer loop) (Line 33) → Unified Algorithmic Structure; Dual and Penalty Update loop (Lines 17, 18) → Augmented Lagrangian Coordination; Compute consensus constraint residual (Lines 20, 21) → Consensus Augmented Lagrangian Coordination; Compute outerloop iterate d_hat and prepare hatted coupling quantities (Lines 27, 28, 29, 30, 31, 32) → Augmented Lagrangian Alternating Direction Inexact Newton
Prepare coupling parameters update after inner loop, including inconsistency evaluation.
evaluate_Inconsistencies(self) → None
📐 Pseudocode: Compute outerloop convergence criterion (Line 41) → Unified Algorithmic Structure; Compute consistency residual c (Line 19) → Augmented Lagrangian Coordination
Compute the difference between stored coupling and mapped variables compared to the latest available data.
It returns a matrix containing fourvectors. The first row vector are the mapped-response side differences of the coupling circle. The second row vector returns differences of the coupling-variable side of the coupling circle. The third and fourth rows return the difference between the shared design variable vector.
This method does not evaluate consensus inconsistencies; Current variant: This has to be specified in each LocalSubSystemBasis subclass, e.g. consensus ALC, after calling super().evaluate_Inconsistencies.
appendtohistory(self) → None
Append the current subsystem state to the history, including inconsistency data.
copy_Inconsistencies_at_Iteration(self, outerloop_itr: int, innerloop_itr: int) → List[InConsistencySizeInterface]
Copy the inconsistencies of the specified iteration at number (outerloop_itr, innerloop_itr).
Args:
outerloop_itr (int): outer loop iteration number
innerloop_itr (int): inner loop iteration number
Returns:
The inconsistencies at the specified iteration, or initialized inconsistencies if not found.
copy_Inconsistencies_Past_outerloop_itr(self, outerloop_itr_before: int) → List[InConsistencySizeInterface]
Copy the inconsistencies from the self._outerloop_itr-th previous outer iteration.
Args:
outerloop_itr_before: The number of outer loop iterations to go to the history
self._outerloop_itr (int): The current outer loop iteration number
Returns:
The inconsistencies from the specified past iteration, or initialized inconsistencies if not found.
copy_Inconsistencies_Previous_outerloop_itr(self) → List[InConsistencySizeInterface]
Copy the inconsistencies from the previous outer loop iteration.
Returns:
The inconsistencies from the previous outer loop iteration.
copy_Inconsistencies_Previous_Previous_outerloop_itr(self) → List[InConsistencySizeInterface]
Copy the inconsistencies from the previous previous outer loop iteration.
Returns:
The inconsistencies from two outer loop iterations ago.
get_Ignore_CouplingId_for_CoordinationObjective(self) → str | None
Get the coupling IDs to ignore for the coordination objective.
Returns:
The coupling ID to ignore, or None if all couplings are considered.
set_Ignore_CouplingId_for_CoordinationObjective(self, id: str | None) → None
Set the coupling ID to ignore for coordination objective calculation.
Args:
id: Coupling ID to ignore, or None to consider all couplings.
compute_KKT_system_matrix_and_bounds(self) → List[List[List[float]] | List[Tuple[float | None, float | None]]]
Return the total linear KKT system matrix.
Returns:
A list containing the constraint matrix and bounds for the KKT system.
decompose_KKT_multipliers(self, all_multipliers: List[float]) → None
Decompose the solution of the KKT system and store the parts into self._optimdata.
Decomposes the multipliers stored in optimization_result into different parts (e.g. local inequality constraints) and stores them into self._optimdata.
Args:
all_multipliers: Total accumulation of all multipliers (only for constraints, not for objective)
compute_Jacobian_MappedResponse_Wrt_DesignVariables(self) → None
Compute the Jacobian of mapped responses with respect to design variables.
set_Jacobian_MappedResponse_Wrt_DesignVariables_Value(self, jacobinain: List[List[List[float]] | None]) → None
Set the Jacobian matrix of mapped response variables with respect to design variables.
Args:
jacobinain: Jacobian matrix for each coupling.
get_Jacobian_MappedResponse_Wrt_DesignVariables_Value(self) → List[List[List[float]] | None] | None
Return the Jacobian matrix of mapped response variables with respect to design variables.
Returns:
Jacobian matrix for each coupling, or None if not computed.
get_scaler_bound_violations(self) → List[Tuple[int, str]]
Collect scaler bound violations for this subsystem.
Returns:
List of (scaler_index, warning_message) tuples.
print_scaler_bound_violations(self) → None
Print any scaler bound violations for this subsystem.
print_scaler_bound_utilization_report(self) → None
Print a compact scaler bound utilization report for this subsystem.
print_startup_summary(self) → None
Print local subsystem info at startup.
print_end_of_innerloop_iteration(self) → None
Print local subsystem results at the end of an inner loop iteration.
print_termination_summary(self) → None
Print local subsystem results at the end of the optimization run.
update_state(self, other_subsystem: LocalSubSystemBasis) → None
Update the state of this LocalSubSystemBasis instance with values from another instance.
This method is necessary for multiprocessing. When subsystems are executed in parallel using multiprocessing.Pool, they are serialized and deserialized, creating new objects in separate memory spaces. After parallel execution completes, this method updates the original object's attribute values while preserving their memory addresses.
The update preserves memory addresses by modifying attribute contents in-place where possible, rather than reassigning references. This is essential for maintaining object identity across the multiprocessing boundary.
Args:
other_subsystem: The source LocalSubSystemBasis containing updated values
from parallel execution.