gemseo.formulations.bilevel_settings module#
Settings of the BiLevel formulation .
- Settings BiLevel_Settings(*, differentiated_input_names_substitute=(), main_mda_name='MDAChain', main_mda_settings=<factory>, parallel_scenarios=False, multithread_scenarios=True, apply_cstr_tosub_scenarios=True, apply_cstr_to_system=True, reset_x0_before_opt=False, set_x0_before_opt=False, sub_scenarios_log_level=None, keep_opt_history=True, save_opt_history=False, naming=Naming.NUMBERED)[source]#
Bases:
MDF_SettingsSettings of the
BiLevelformulation.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 ().
main_mda_name (str) --
By default it is set to "MDAChain".
main_mda_settings (Mapping[str, Any] | BaseMDASettings) --
By default it is set to <factory>.
parallel_scenarios (bool) --
By default it is set to False.
multithread_scenarios (bool) --
By default it is set to True.
apply_cstr_tosub_scenarios (bool) --
By default it is set to True.
apply_cstr_to_system (bool) --
By default it is set to True.
reset_x0_before_opt (bool) --
By default it is set to False.
set_x0_before_opt (bool) --
By default it is set to False.
sub_scenarios_log_level (int | None)
keep_opt_history (bool) --
By default it is set to True.
save_opt_history (bool) --
By default it is set to False.
naming (Naming) --
By default it is set to "NUMBERED".
- Return type:
None
- apply_cstr_to_system: bool = True#
Whether the
add_constraint()method adds the constraint to the optimization problem of the system scenario.
- apply_cstr_tosub_scenarios: bool = True#
Whether the
add_constraint()method adds the constraint to the optimization problem of the sub-scenario capable of computing the constraint.
- keep_opt_history: bool = True#
Whether to keep database copies of the sub-scenario adapters after each execution. Depending on the size of the databases and the number of consecutive executions, this can be very memory consuming. If the adapter will be executed in parallel, the databases will not be saved to the main process by the sub-processes, so this setting should be set to
Falseto avoid unnecessary memory use in the sub-processes.
- multithread_scenarios: bool = True#
If
Trueand parallel_scenarios=True, the sub-scenarios are run in parallel using multi-threading; if False and parallel_scenarios=True, multiprocessing is used.
- naming: NameGenerator.Naming = Naming.NUMBERED#
The way of naming the database files. When the adapter will be executed in parallel, this method shall be set to
UUIDbecause this method is multiprocess-safe.
- reset_x0_before_opt: bool = False#
Whether to restart the sub-optimizations from the initial guesses, otherwise warm start them.
- save_opt_history: bool = False#
Whether to save the optimization history to an HDF5 file after each execution.
- set_x0_before_opt: bool = False#
Whether to warm start the sub-optimizations from the disciplines' data, otherwise from the design space.
- sub_scenarios_log_level: int | None = None#
The level of the root logger during the sub-scenarios executions. If
None, do not change the level of the root logger.
- 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