gemseo.formulations.idf_settings module#

Settings of the IDF formulation.

Settings IDF_Settings(*, differentiated_input_names_substitute=(), include_weak_coupling_targets=True, mda_chain_settings_for_start_at_equilibrium=<factory>, n_processes=1, normalize_constraints=True, start_at_equilibrium=False, use_threading=True)[source]#

Bases: BaseFormulationSettings

Settings of the IDF formulation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • differentiated_input_names_substitute (Sequence[str]) --

    By default it is set to ().

  • include_weak_coupling_targets (bool) --

    By default it is set to True.

  • mda_chain_settings_for_start_at_equilibrium (Mapping[str, Any] | MDAChain_Settings) --

    By default it is set to <factory>.

  • n_processes (Annotated[int, Gt(gt=0)]) --

    By default it is set to 1.

  • normalize_constraints (bool) --

    By default it is set to True.

  • start_at_equilibrium (bool) --

    By default it is set to False.

  • use_threading (bool) --

    By default it is set to True.

Return type:

None

include_weak_coupling_targets: bool = True#

If True, all disciplines are executed in parallel, and all couplings (weak and strong) are set as target variables in the design space. This maximizes the exploitation of the parallelism but leads to a larger design space, so usually more iterations by the optimizer. Otherwise, the coupling graph is analyzed and the disciplines are chained in sequence and in parallel to solve all weak couplings. In this case, only the strong couplings are used as target variables in the design space. This reduces the size of the optimization problem, so usually leads to less iterations. The best option depends on the number of strong vs weak couplings, the availability of gradients, the availability of CPUs versus the number of disciplines, so it is very context dependant. Otherwise, IDF will consider only the strong coupling targets.

mda_chain_settings_for_start_at_equilibrium: StrKeyMapping | MDAChain_Settings [Optional]#

The settings for the MDA when start_at_equilibrium=True.

See detailed settings in MDAChain.

n_processes: PositiveInt = 1#

The maximum simultaneous number of threads if use_threading is True, or processes otherwise, used to parallelize the execution.

Constraints:
  • gt = 0

normalize_constraints: bool = True#

Whether the outputs of the coupling consistency constraints are scaled.

start_at_equilibrium: bool = False#

Whether an MDA is used to initialize the coupling variables.

use_threading: bool = True#

Whether to use threads instead of processes to parallelize the execution when include_weak_coupling_targets is True; multiprocessing will copy (serialize) all the disciplines, while threading will share all the memory. This is important to note if you want to execute the same discipline multiple times, you shall use multiprocessing.

model_post_init(context, /)#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) -- The BaseModel instance.

  • context (Any) -- The context.

Return type:

None