gemseo / formulations

bilevel module

A Bi level formulation

class gemseo.formulations.bilevel.BiLevel(disciplines, objective_name, design_space, maximize_objective=False, mda_name='MDAChain', parallel_scenarios=False, multithread_scenarios=True, apply_cstr_tosub_scenarios=True, apply_cstr_to_system=True, reset_x0_before_opt=False, **mda_options)[source]

Bases: gemseo.core.formulation.MDOFormulation

A bi-level formulation draws an optimization architecture that involves multiple optimization problems to be solved to obtain the solution of the MDO problem.

Here, at each iteration on the global design variables, the bi-level MDO formulation implementation performs a first MDA to compute the coupling variables, then disciplinary optimizations on the local design variables in parallel and then, a second MDA to update the coupling variables.

Constructor, initializes the objective functions and constraints

Parameters
  • disciplines (list(MDODiscipline)) – the disciplines list.

  • objective_name (str) – the objective function data name.

  • design_space (DesignSpace) – the design space.

  • maximize_objective (bool) – if True, the objective function is maximized, by default, a minimization is performed.

  • mda_name (str) – class name of the MDA to be used.

  • parallel_scenarios (bool) – if True, the sub scenarios are run in parallel.

  • multithread_scenarios (bool) – if True and parallel_scenarios=True, the sub scenarios are run in parallel using multi-threading, if False and parallel_scenarios=True, multi-processing is used.

  • apply_cstr_tosub_scenarios (bool) – if True, the add_constraint method adds the constraint to the optimization problem of the sub-scenario capable of computing the constraint.

  • apply_cstr_to_system (bool) – if True, the add_constraint method adds the constraint to the optimization problem of the system scenario.

  • reset_x0_before_opt (bool) – if True, restart the sub optimizations from the initial guesses, otherwise warm start them

  • mda_options – options passed to the MDA at construction

add_constraint(output_name, constraint_type='eq', constraint_name=None, value=None, positive=False)[source]

Add a contraint to the formulation

Parameters
  • output_name – param constraint_type: (Default value = MDOFunction.TYPE_EQ)

  • constraint_name – Default value = None)

  • value – Default value = None)

  • positive – Default value = False)

  • constraint_type – (Default value = MDOFunction.TYPE_EQ)

classmethod get_default_sub_options_values(**options)[source]

When some options of the formulation depend on higher level options, a sub option defaults may be specified here, mainly for use in the API

Parameters

options – options dict required to deduce the sub options grammar

Returns

None, or the sub options defaults

get_expected_dataflow()[source]

Overriden method from MDOFormulation base class delegated to chain object

get_expected_workflow()[source]

Overriden method from MDOFormulation base class delegated to chain object

classmethod get_sub_options_grammar(**options)[source]

When some options of the formulation depend on higher level options, a sub option schema may be specified here, mainly for use in the API

Parameters

options – options dict required to deduce the sub options grammar

Returns

None, or the sub options grammar

get_top_level_disc()[source]

Overriden method from MDOFormulation base class