gemseo.formulations.base_mdo_formulation module#
The base class for all MDO formulations.
- class BaseMDOFormulation(disciplines, objective_name, design_space, settings_model=None, **settings)[source]#
Bases:
BaseFormulation
A base class for MDO formulations.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
disciplines (Sequence[Discipline]) -- The disciplines.
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 design space.
settings_model (T | None) -- The settings of the formulation as a Pydantic model. If
None
, use**settings
.**settings (Any) -- The settings of the formulation. This argument is ignored when
settings_model
is notNone
.
- add_constraint(output_name, constraint_type=ConstraintType.EQ, constraint_name='', value=0, positive=False)[source]#
Add an equality or inequality constraint to the optimization problem.
An equality constraint is written as \(c(x)=a\), a positive inequality constraint is written as \(c(x)\geq a\) and a negative inequality constraint is written as \(c(x)\leq a\).
This constraint is in addition to those created by the formulation, e.g. consistency constraints in IDF.
The strategy of repartition of the constraints is defined by the formulation.
- Parameters:
output_name (str | Sequence[str]) -- The name(s) of the outputs computed by \(c(x)\). If several names are given, a single discipline must provide all outputs.
constraint_type (MDOFunction.ConstraintType) --
The type of constraint.
By default it is set to "eq".
constraint_name (str) --
The name of the constraint to be stored. If empty, the name of the constraint is generated from
output_name
,constraint_type
,value
andpositive
.By default it is set to "".
value (float) --
The value \(a\).
By default it is set to 0.
positive (bool) --
Whether the inequality constraint is positive.
By default it is set to False.
- Return type:
None
- add_observable(output_names, observable_name='', discipline=None)[source]#
Add an observable to the optimization problem.
The repartition strategy of the observable is defined in the formulation class.
- Parameters:
output_names (str | Sequence[str]) -- The name(s) of the output(s) to observe.
observable_name (str) --
The name of the observable. If empty, the output name is used by default.
By default it is set to "".
discipline (Discipline | None) -- The discipline computing the observed outputs. If
None
, the discipline is detected from inner disciplines.
- Return type:
None