Skip to content

← Back to coordination

Coordinator

Source: Distributed_Design_Optimizer/coordination/Coordinator.py

Coordinator module for distributed design optimization.

This module provides the main Coordinator class that orchestrates multi-level distributed design optimization. It manages the coordination between subsystems, handles inner and outer loop iterations, convergence checks, and history tracking.

Example:

from Distributed_Design_Optimizer.coordination import Coordinator
coordinator = Coordinator(subsystems, inputfile)
coordinator.run()

Classes

Coordinator

Coordinator for multi-level distributed design optimization.

This class orchestrates the coordination between subsystems in a hierarchical optimization problem. It manages the inner and outer loop iterations, convergence checks, and history tracking.

Attributes:

_inputfile: The input file configuration interface.
_convouterloop: Flag indicating outer loop convergence.
_outerloop_itr: Current outer loop iteration counter.
_innerloop_itr: Current inner loop iteration counter.
_subsystems: List of subsystem interfaces representing the optimization structure.
_middlelevels: List of middle level data storage interfaces.

Methods

init(self, subsystemsIn: List[SubSystemInterface], inputfile: InputFileInterface) → None

📐 Pseudocode: Require hyperparameters and initial coupling parameters (Lines 1, 2, 3) → Unified Algorithmic Structure

Initialize the Coordinator.

Args:

subsystemsIn: List of subsystem interfaces to be coordinated.
inputfile: Input file interface containing coordination configuration.

run(self) → None

📐 Pseudocode: Initialize outerloop iterator (Line 4), Outer loop repeat (Line 5), Until outerloop convergence criterion is met (Line 43), Return optimized design variables (Line 44) → Unified Algorithmic Structure; Initialize outerloop iterator (Line 4) → Augmented Lagrangian Coordination; Initialize outerloop iterator (Line 3) → Consensus Augmented Lagrangian Coordination; Initialize outerloop iterator (Line 4) → Augmented Lagrangian Alternating Direction Inexact Newton; Initialize outerloop iterator (Line 3), Return converged designs (Line 15) → Sensitivity Based Distributed Programming

Run the distributed optimization coordination.

initialize(self) → None

Initialize all subsystems by evaluating responses, constraints, and coupling parameters.

Performs three rounds of middle-level data exchange to ensure all coupling parameters are fully initialized across the subsystem hierarchy.

outerloop_iteration(self) → None

📐 Pseudocode: Outer loop repeat (Line 5), Initialize innerloop iterator (Line 6), Until innerloop convergence criterion is met (Line 29), Update design variables for outer loop (Line 30), For every subsystem and Controller (outer loop prepare update) (Line 31), For every subsystem and Controller (outer loop update) (Line 36), Compute outerloop convergence criterion (Line 41), Increment outerloop iterator (Line 42) → Unified Algorithmic Structure; Outer loop repeat, initialize innerloop (Lines 5, 6), Update design variables for outer loop (Line 16), Dual and Penalty Update loop (Lines 17, 18), Outerloop convergence and return (Lines 22, 23, 24, 25) → Augmented Lagrangian Coordination; Outer loop repeat, initialize innerloop (Lines 4, 5, 6), Update design and auxiliary variables for outer loop (Line 19), Compute consensus constraint residual (Lines 20, 21), Outerloop convergence and return (Lines 24, 25, 26, 27) → Consensus Augmented Lagrangian Coordination; Outer loop repeat, initialize innerloop (Lines 5, 6, 7), Update design variables for outer loop (Line 26), Compute outerloop iterate d_hat and prepare hatted coupling quantities (Lines 27, 28, 29, 30, 31, 32), Outerloop convergence and return (Lines 40, 41, 42, 43) → Augmented Lagrangian Alternating Direction Inexact Newton; Outer loop repeat (Line 4), Outerloop convergence check (Lines 11, 12, 13, 14) → Sensitivity Based Distributed Programming

Run the inner and outer loop during the coordination.

innerloop_iteration(self) → None

📐 Pseudocode: Inner loop repeat (following some iteration scheme) (Line 7), For every subsystem and Controller (inner loop update) (Line 22), Increment innerloop iterator (Line 28) → Unified Algorithmic Structure; Innerloop repeat (decentralized Primal Update) (Lines 7, 8) → 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; Decentralized subsystem jobs in parallel (Line 5) → Sensitivity Based Distributed Programming

Execute a single inner loop iteration of the optimization process.

run_innerloop_jobs(self) → None

Run the subsystem optimization jobs for one innerloop iteration via multiprocessing.

Sets the current iterators on all subsystems, swaps in managed middlelevels for the multiprocessing run, restores the originals afterwards, updates each original subsystem with its executed state, and stores the iteration accounting in self._innerloop_itr_runtime and self._innerloop_itr_numberofdesignvariableevaluations.

appendtohistory(self) → None

Append current iteration state to the coordinator history.

savecoordinatorhistory(self) → None

Save the coordinator history to a dill file.

The use-case name is read from the input file (via get_Name). The target folder is the use-case's historyfiles folder (stored as self._historyfolderpath during initialization).

get_CoordinatorHistory(self) → Deque[CoordinatorHistoryEntry]

Return the coordinator history.

Returns:

The deque containing the history of coordinator states.

evaluate_MaxInconsistency(self) → None

Evaluate the max inconsistency value of all the subsystems.

get_MaxInconsistencyValue(self) → float

Return the maximum inconsistency value.

Returns:

The maximum inconsistency value across all subsystems.

get_MaxInconsistencyValueSubsystemID(self) → str

Return the subsystem ID with maximum inconsistency.

Returns:

The subsystem ID with maximum inconsistency, or None if not set.

evaluate_MaxRatioOfActiveConstraints(self) → None

Compute the max ratio of active constraints of the entire system.

compute_InConsistencyOscillations(self) → None

Compute the oscillation behaviour of the inconsistencies using wavelet transforms.

get_MaxRatioOfActiveConstraints(self) → float

Return the maximum ratio of active constraints.

Returns:

The maximum ratio of active constraints across all subsystems.

get_MaxRatioOfActiveConstraintsSubsystemID(self) → str

Return the subsystem ID with the maximum ratio of active constraints.

Returns:

The subsystem ID with the maximum ratio of active constraints.

copy_PrimalResiduals_Previous_outer_or_innerloop_itr(self, k: int) → List[CoordinatorHistoryEntry] | None

Retrieve previous k entries from the coordinator history.

Args:

k: Number of previous entries to retrieve

Returns:

List or None: List of previous history entries (most recent first)
or None if not enough history entries available

print_banner(self, message: str) → None

Print a bordered banner with a single message line.

Args:

message: The text to display inside the banner.

print_all_scaler_bound_violations(self) → None

Collect and print scaler bound violations across all subsystems.

print_all_scaler_bound_utilization_report(self) → None

Print a full scaler bound utilization report for all subsystems.

print_startup_summary(self) → None

Print a startup summary banner to the console.

Displays information about the optimization run including use-case name, coordination method, and iteration scheme.

print_beginning_of_initialization(self) → None

Print a banner indicating the start of initialization.

print_end_of_initialization(self) → None

Print a banner indicating the end of initialization.

print_beginning_of_run_prepare_updateCouplingParameters_job(self) → None

Print a banner before preparing the coupling parameter update step.

print_beginning_of_run_updateCouplingParameters_outerloop_job(self) → None

Print a banner before updating coupling parameters in the outer loop.

print_beginning_of_outerloop_iteration(self) → None

Print a banner indicating the start of an outer loop iteration.

print_beginning_of_innerloop_iteration(self) → None

Print a banner indicating the start of an inner loop iteration.

print_beginning_of_run_updateCouplingParameters_innerloop_job(self) → None

Print a banner before updating coupling parameters in the inner loop.

print_finished_run_prepare_updateCouplingParameters_job(self) → None

Print a banner after preparing the coupling parameter update step.

print_finished_run_updateCouplingParameters_outerloop_job(self) → None

Print a banner after updating coupling parameters in the outer loop.

print_finished_run_updateCouplingParameters_innerloop_job(self) → None

Print a banner after updating coupling parameters in the inner loop.

print_beginning_of_appendto_and_saving_subsystem_history(self) → None

Print a banner before appending to and saving each subsystem history.

print_beginning_of_appendto_and_saving_coordinator_history(self) → None

Print a banner before appending to and saving the coordinator history.

print_finished_appendto_and_saving_subsystem_history(self) → None

Print a banner after appending to and saving each subsystem history.

print_finished_appendto_and_saving_coordinator_history(self) → None

Print a banner after appending to and saving the coordinator history.

print_end_of_innerloop_iteration(self) → None

Print a summary at the end of an inner loop iteration.

Displays detailed results for each subsystem including solver information, design variables, physical responses, objective values, and inconsistencies.

print_end_of_outerloop_iteration(self) → None

Print a summary at the end of an outer loop iteration.

Displays the outer loop iteration number and convergence status.

print_termination_summary(self) → None

Print a termination summary banner to the console.

Displays final results of the optimization run including iteration counts, maximum inconsistency values, and performance metrics.