gemseo_umdo / formulations

Show inherited members

formulation module

Formulate a multidisciplinary design problem under uncertainty.

class gemseo_umdo.formulations.formulation.UMDOFormulation(disciplines, objective_name, design_space, mdo_formulation, uncertain_space, objective_statistic_name, objective_statistic_parameters=None, maximize_objective=False, grammar_type=GrammarType.JSON, **options)[source]

Bases: BaseFormulation

Base formulation of a multidisciplinary design problem under uncertainty.

Parameters:
  • disciplines (Sequence[MDODiscipline]) – The disciplines.

  • objective_name (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.

  • mdo_formulation (MDOFormulation) – The class name of the MDO formulation, e.g. “MDF”.

  • uncertain_space (ParameterSpace) – The uncertain variables with their probability distributions.

  • objective_statistic_name (str) – The name of the statistic to be applied to the objective.

  • objective_statistic_parameters (Mapping[str, Any] | None) – The values of the parameters of the statistic to be applied to the objective, if any.

  • maximize_objective (bool) –

    Whether to maximize the objective.

    By default it is set to False.

  • grammar_type (MDODiscipline.GrammarType) –

    The type of the input and output grammars.

    By default it is set to “JSONGrammar”.

  • **options (Any) – The options of the formulation.

add_constraint(output_name, statistic_name, constraint_type=ConstraintType.INEQ, constraint_name=None, value=None, positive=False, **statistic_parameters)[source]

Add a user constraint.

A user constraint is a design constraint in addition to the formulation specific constraints such as the targets (a.k.a. consistency constraints) in IDF.

The strategy of repartition of constraints is defined in the formulation class.

Parameters:
  • output_name (str | Sequence[str]) – The name of the output to be used as a constraint. For instance, if g_1 is given and constraint_type=”eq”, g_1=0 will be added as a constraint to the optimizer.

  • statistic_name (str) – The name of the statistic to be applied to the constraint.

  • constraint_type (str) –

    The type of constraint, either “eq” for equality constraint or “ineq” for inequality constraint.

    By default it is set to “ineq”.

  • constraint_name (str | None) – The name of the constraint to be stored, If None, the name is generated from the output name.

  • value (float | None) – The value of activation of the constraint. If None, the value is equal to 0.

  • positive (bool) –

    Whether to consider an inequality constraint as positive.

    By default it is set to False.

  • **statistic_parameters (Any) – The description is missing.

Return type:

None

add_observable(output_names, statistic_name, observable_name=None, discipline=None, **statistic_parameters)[source]

Add an observable to the optimization problem.

The repartition strategy of the observable is defined in the formulation class.

Parameters:
  • output_names (Sequence[str]) – The name(s) of the output(s) to observe.

  • statistic_name (str) – The name of the statistic to be applied to the observable.

  • observable_name (Sequence[str] | None) – The name of the observable.

  • discipline (MDODiscipline | None) – The discipline computing the observed outputs. If None, the discipline is detected from inner disciplines.

  • **statistic_parameters (Any) – The description is missing.

Return type:

None

get_expected_dataflow()[source]

Get the expected data exchange sequence.

This method is used for the XDSM representation and can be overloaded by subclasses.

Returns:

The expected sequence of data exchange where the i-th item is described by the starting discipline, the ending discipline and the coupling variables.

Return type:

list[tuple[gemseo.core.discipline.MDODiscipline, gemseo.core.discipline.MDODiscipline, list[str]]]

get_expected_workflow()[source]

Get the expected sequence of execution of the disciplines.

This method is used for the XDSM representation and can be overloaded by subclasses.

For instance:

  • [A, B] denotes the execution of A, then the execution of B

  • (A, B) denotes the concurrent execution of A and B

  • [A, (B, C), D] denotes the execution of A, then the concurrent execution of B and C, then the execution of D.

Returns:

A sequence of elements which are either an ExecutionSequence or a tuple of ExecutionSequence for concurrent execution.

Return type:

list[gemseo.core.execution_sequence.ExecutionSequence, tuple[gemseo.core.execution_sequence.ExecutionSequence]]

get_top_level_disc()[source]

Return the disciplines which inputs are required to run the scenario.

A formulation seeks to compute the objective and constraints from the input variables. It structures the optimization problem into multiple levels of disciplines. The disciplines directly depending on these inputs are called top level disciplines.

By default, this method returns all disciplines. This method can be overloaded by subclasses.

Returns:

The top level disciplines.

Return type:

list[gemseo.core.discipline.MDODiscipline]

update_top_level_disciplines(design_values)[source]

Update the default input values of the top-level disciplines.

Parameters:

design_values (Mapping[str, Any]) – The values of the design variables to update the default input values of the top-level disciplines.

Return type:

None

property available_statistics: list[str]

The names of the statistics to quantify the output uncertainties.

property mdo_formulation: MDOFormulation

The MDO formulation.

opt_problem: OptimizationProblem

The optimization problem generated by the formulation from the disciplines.

property uncertain_space: ParameterSpace

The uncertain variable space.