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, sub_scenarios_log_level=None, keep_opt_history=True, save_opt_history=False, naming=Naming.NUMBERED)[source]#
Bases:
MDF_Settings
Settings of the
BiLevel
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 ().
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.
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
False
to avoid unnecessary memory use in the sub-processes.
- multithread_scenarios: bool = True#
If
True
and 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
UUID
because 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.
- 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, /)#
We need to both initialize private attributes and call the user-defined model_post_init method.
- Parameters:
self (BaseModel)
context (Any)
- Return type:
None