gemseo.problems.mdo.opt_as_mdo_scenario module#
Make a monodisciplinary optimization problem multidisciplinary.
The literature on problems to benchmark optimization algorithms is much richer than the literature on problems to benchmark MDO algorithms. This difference is even greater in the case of MDO under uncertainties.
Faced with this limitation,
the OptAsMDOScenario
allows the user to
rewrite a monodisciplinary optimization problem into an MDO problem.
The original discipline
must have as outputs one or more objectives,
may have as outputs one or more constraints,
may have as outputs one or more observables,,
must have as inputs at least three design variables.
The MDO problem will include \(2+N\) disciplines, namely
\(N\) strongly coupled disciplines computing the values of some coupling variables from the values of the other coupling variables and the values of the design variables,
one weakly coupled discipline, called link discipline, computing the values of the design variables in the original optimization problem from the values of the design and coupling variables in the MDO problem,
the original discipline.
This scenario will also modify the design space passed as argument by renaming the first design variable as \(x_0\), the second design variable as \(x_1\), and so on. Then, \(x_0\) will be the global design variable and \(x_i\) will be the local design variable specific to the \(i\)-th discipline.
In other words, an optimization problem of the form
will be transformed into an MDO problem of the form
where \(y_i=h_i(x_0,x_i,y_{-i})\) is the coupling variable outputted by the \(i\)-th strongly coupled discipline and where \(F = f \circ L\) and \(G = f \circ L\), with \(L\) the link discipline.
The function \(h_i\) is defined as
where \(a_i\), \(D_{i,0}\), \(D_{i,i}\) and \(\left(C_{i,j}\right)_{j=1\atop j\neq i}\) are realizations of independent random variables uniformly distributed between 0 and 1, and the link discipline \(L\) is defined as
where \(c\) is the implicit function such that \(c_i(x)=h_i(x_0,x_i,c_{-i}(x))\) for all \(i\in\{1,\ldots,N\}\).
If the original discipline is analytically differentiable, so are the objective and constraint functions of this MDO problem.
By default,
this scenario applies
the technique proposed by Amine Aziz-Alaoui in his doctoral thesis
to the case of linear coupling and link disciplines,
using the previous expressions of \(h_1,\ldots,h_N\) and \(L\).
More advanced disciplines could be imagined,
using the arguments coupling_equations
and link_discipline
.
This example from the documentation illustrates this feature.
- class BaseLinkDiscipline(design_space, perform_mda_analytically, differentiate_mda_analytically=None)[source]#
Bases:
Discipline
The base class for the link discipline \(c\).
This discipline computes the values of the design variables \(z_0,z_1,\ldots,z_N\) of the original optimization problem from the values of the design variables \(x_0,x_1,\ldots,x_N\) and coupling variables \(y_0,y_1,\ldots,y_N\) of the MDO problem.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
design_space (DesignSpace) -- The design space of the original optimization problem.
perform_mda_analytically (Callable[[RealArray], RealArray]) -- The function \(c\) performing the MDA analytically at a given design point \(x=(x_0,x_1,\ldots,x_N)\).
differentiate_mda_analytically (Callable[[RealArray], RealArray] | None) -- The function \(\nabla c\) differentiating the MDA analytically at a given design point \(x=(x_0,x_1,\ldots,x_N)\). If
None
, the discipline will not be differentiable.
- class LinearLinkDiscipline(design_space, perform_mda_analytically, differentiate_mda_analytically=None)[source]#
Bases:
BaseLinkDiscipline
A linear link discipline of the form \(L(x, y) = x + y - c(x)\).
In more details, \(L_0(x, y) = x_0\) and \(L_i(x, y) = x_i + y_i - c_i(x)\) for \(i\in\{1,\ldots,N\}\).
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
design_space (DesignSpace) -- The design space of the original optimization problem.
perform_mda_analytically (Callable[[RealArray], RealArray]) -- The function \(c\) performing the MDA analytically at a given design point \(x=(x_0,x_1,\ldots,x_N)\).
differentiate_mda_analytically (Callable[[RealArray], RealArray] | None) -- The function \(\nabla c\) differentiating the MDA analytically at a given design point \(x=(x_0,x_1,\ldots,x_N)\). If
None
, the discipline will not be differentiable.
- class OptAsMDOScenario(discipline, objective_name, design_space, name='', maximize_objective=False, formulation_settings_model=None, coupling_equations=(), link_discipline_class=<class 'gemseo.problems.mdo.opt_as_mdo_scenario.LinearLinkDiscipline'>, **formulation_settings)[source]#
Bases:
MDOScenario
A monodisciplinary optimization scenario made multidisciplinary.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
discipline (Discipline) --
- The discipline
computing the objective, constraints and observables from the design variables.
- design_space: The design space
including the design variables \(z_0,z_1,\ldots,z_N\) which will be replaced by \(x_0,x_1,\ldots,x_N\) respectively in the MDO problem.
- coupling_equations: The material
to evaluate and solve the coupling equations, namely the disciplines \(h_1,\ldots,h_N\), the function \(c\) and the Jacobian function \(\nabla c(x)\). If empty, the \(i\)-th discipline is linear.
link_discipline_class: The class of the link discipline.
note:: (..) -- There is no naming convention for the input and output variables of
discipline
. So, you can use \(a,b,c\) indesign_space
instead of \(z_0,z_1,z_2\).objective_name (str | Sequence[str]) -- The name(s) of the discipline output(s) used as objective. If multiple names are passed, the objective will be a vector.
design_space (DesignSpace) -- The search space including at least the design variables (some formulations requires additional variables, e.g.
IDF
with the coupling variables).name (str) --
The name to be given to this scenario. If empty, use the name of the class.
By default it is set to "".
maximize_objective (bool) --
Whether to maximize the objective.
By default it is set to False.
formulation_settings_model (BaseFormulationSettings | None) -- The formulation settings as a Pydantic model. If
None
, use**settings
.coupling_equations (tuple[Iterable[Discipline, ...], Callable[[RealArray], RealArray], Callable[[RealArray], RealArray]]) --
The description is missing.
By default it is set to ().
link_discipline_class (type[BaseLinkDiscipline]) --
The description is missing.
By default it is set to <class 'gemseo.problems.mdo.opt_as_mdo_scenario.LinearLinkDiscipline'>.
**formulation_settings (Any) -- The formulation settings, including the formulation name (use the keyword
"formulation_name"
). These arguments are ignored whensettings_model
is notNone
.
- Raises:
ValueError -- When the design space includes less than three variables or when a design variable is not scalar.
- Settings Settings(*, algo_name, algo_settings=None)#
Bases:
_BaseSettings
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.
- algo_name: cls._algo_enum [Required]#
The name of the algorithm.