process module¶
Scalability study - Process.
The ScalabilityStudy
class implements
the concept of scalability study:
By instantiating a
ScalabilityStudy
, the user defines the MDO problem in terms of design parameters, objective function and constraints.For each discipline, the user adds a dataset stored in a
Dataset
and select a type ofScalableModel
to build theScalableDiscipline
associated with this discipline.The user adds different optimization strategies, defined in terms of both optimization algorithms and MDO formulation.
The user adds different scaling strategies, in terms of sizes of design parameters, coupling variables and equality and inequality constraints. The user can also define a scaling strategies according to particular parameters rather than groups of parameters.
Lastly, the user executes the
ScalabilityStudy
and the results are written in several files and stored into directories in a hierarchical way, where names depend on both MDO formulation, scaling strategy and replications when it is necessary. Different kinds of files are stored: optimization graphs, dependency matrix plots and of course, scalability results by means of a dedicated class:ScalabilityResult
.
- class gemseo.problems.scalable.data_driven.study.process.ScalabilityStudy(objective, design_variables, directory='study', prefix='', eq_constraints=None, ineq_constraints=None, maximize_objective=False, fill_factor=0.7, active_probability=0.1, feasibility_level=0.8, start_at_equilibrium=True, early_stopping=True, coupling_variables=None)[source]¶
Bases:
object
Scalability Study.
The constructor of the ScalabilityStudy class requires two mandatory arguments:
the
'objective'
name,the list of
'design_variables'
names.
Concerning output files, we can specify:
the
directory
which is'study'
by default,the prefix of output file names (default: no prefix).
Regarding optimization parametrization, we can specify:
the list of equality constraints names (
eq_constraints
),the list of inequality constraints names (
ineq_constraints
),the choice of maximizing the objective function (
maximize_objective
).
By default, the objective function is minimized and the MDO problem is unconstrained.
Last but not least, with regard to the scalability methodology, we can overwrite:
the default fill factor of the input-output dependency matrix
ineq_constraints
,the probability to set the inequality constraints as active at initial step of the optimization
active_probability
,the offset of satisfaction for inequality constraints
feasibility_level
,the use of a preliminary MDA to start at equilibrium
start_at_equilibrium
,the post-processing of the optimization database to get results earlier than final step
early_stopping
.
- Parameters:
objective (str) – The name of the objective.
design_variables (Iterable[str]) – The names of the design variables.
directory (str) –
The working directory of the study.
By default it is set to “study”.
prefix (str) –
The prefix for the output filenames.
By default it is set to “”.
eq_constraints (Iterable[str] | None) – The names of the equality constraints, if any.
ineq_constraints (Iterable[str] | None) – The names of the inequality constraints, if any.
maximize_objective (bool) –
Whether to maximize the objective.
By default it is set to False.
fill_factor (float) –
The default fill factor of the input-output dependency matrix.
By default it is set to 0.7.
active_probability (float) –
The probability to set the inequality constraints as active at initial step of the optimization.
By default it is set to 0.1.
feasibility_level (float) –
The offset of satisfaction for the inequality constraints.
By default it is set to 0.8.
start_at_equilibrium (bool) –
Whether to start at equilibrium using a preliminary MDA.
By default it is set to True.
early_stopping (bool) –
Whether to post-process the optimization database to get results earlier than final step.
By default it is set to True.
coupling_variables (Iterable[str] | None) – The names of the coupling variables.
- add_discipline(data)[source]¶
This method adds a disciplinary dataset from a dataset.
- Parameters:
data (IODataset) – The input-output dataset.
- Return type:
None
- add_optimization_strategy(algo, max_iter, formulation='DisciplinaryOpt', algo_options=None, formulation_options=None, top_level_diff='auto')[source]¶
Add both optimization algorithm and MDO formulation, as well as their options.
- Parameters:
algo (str) – The name of the optimization algorithm.
max_iter (int) – The maximum number of iterations for the optimization algorithm.
formulation (str) –
The name of the MDO formulation.
By default it is set to “DisciplinaryOpt”.
algo_options (Mapping[str, Any] | None) – The options of the optimization algorithm.
formulation_options (str | None) – The options of the MDO formulation.
top_level_diff (str) –
The differentiation method for the top level disciplines.
By default it is set to “auto”.
- Return type:
None
- add_scaling_strategies(design_size=None, coupling_size=None, eq_cstr_size=None, ineq_cstr_size=None, variables=None)[source]¶
Add different scaling strategies.
- Parameters:
design_size (int | list[int] | None) – The size of the design variables. If
None
, use 1.coupling_size (int | list[int] | None) – The size of the coupling variables. If
None
, use 1.eq_cstr_size (int | list[int] | None) – The size of the equality constraints. If
None
, use 1.ineq_cstr_size (int | list[int] | None) – The size of the inequality constraints. If
None
, use 1.variables (list[None] | None) – The size of the other variables.
- Return type:
None
- execute(n_replicates=1)[source]¶
Execute the scalability study, one or several times to take into account the random features of the scalable problems.
- Parameters:
n_replicates (int) –
The number of times the scalability study is repeated.
By default it is set to 1.
- Return type:
- set_fill_factor(discipline, output, fill_factor)[source]¶
Set the fill factor.
Args: :param discipline: The name of the discipline. :param output: The name of the output. :param fill_factor: The fill factor