gemseo.core.chains.initialization_chain module#
MDA input data initialization.
- class MDOInitializationChain(disciplines, name='', available_data_names=())[source]#
Bases:
MDOChain
An initialization process for a set of disciplines.
This MDOChain subclass computes the initialization for the computation of a set of disciplines. It is particularly useful in the case of MDAs when not all default_input_data are available, and the execution order is not obvious to compute initial values for all couplings.
From the default inputs of the disciplines, use a greedy algorithm to detect sequentially the disciplines that can be executed, and records the execution order.
The couplings are ignored, and therefore, a true MDA must be used afterward to ensure consistency.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
disciplines (Sequence[Discipline]) -- The disciplines.
name (str) --
The name of the discipline. If
None
, use the class name.By default it is set to "".
available_data_names (Iterable[str]) --
The data names that are assumed to be available at runtime, in addition to the default_input_data.
By default it is set to ().
- order_disciplines_from_default_inputs(disciplines, raise_error=True, available_data_names=())[source]#
Order disciplines such that all their input values are defined.
It is particularly useful in the case of MDAs when not all default_input_data are available, and the execution order is not obvious to compute initial values for all couplings.
From the default inputs of the disciplines, use a greedy algorithm to detect sequentially the disciplines that can be executed, and records the execution order.
- Raises:
ValueError -- When a discipline cannot be initialized.
- Parameters:
disciplines (Sequence[Discipline]) -- The disciplines to compute the initialization of.
raise_error (bool) --
Whether to raise an exception when the algorithm fails.
By default it is set to True.
available_data_names (Iterable[str]) --
The data names that are assumed to be available at runtime, in addition to the default_input_data.
By default it is set to ().
- Returns:
The ordered disciplines when the algorithm succeeds, or, if raise_error=False, the inputs that are missing.
- Return type:
list[Discipline] | list[str]