# gemseo.disciplines.scenario_adapters¶

Scenario adapters.

A scenario adapter is an `MDODiscipline`

wrapping a `Scenario`

. A call to
`MDODiscipline.execute()`

triggers calls to `Scenario.execute()`

.

For instance, let us consider an `MDOScenario`

defining a gradient-based
constrained minimization of a cost function over a `DesignSpace`

from several
`MDODiscipline`

instances. If this optimization problem is not convex, it is
advisable to set up a multi-start strategy to repeat this minimization from different
starting points. in order to find a *good* local minimum. In this case, an
`MDOScenarioAdapter`

takes a design value as input, use it as initial design
value of the minimization algorithm and outputs some variables of interest such as the
objective and constraints at the optimum. Then, this `MDOScenarioAdapter`

can be
used as any `MDODiscipline`

in a `DOEScenario`

defining a sampling-based
version of the previous problem. In other words, this `DOEScenario`

repeats the
gradient-based optimization from several starting points and returns the best local
minimum.

The scenario adapters can also be useful for bi-level optimization. Let us consider an
optimization problem with two design variables, namely \(x_1\) and \(x_2\). The
wrapped `MDOScenario`

solves the optimization problem with respect to the design
variables \(x_1\) and another `MDOScenario`

considers this
`MDOScenarioAdapter`

to solve the optimization problem with respect to
\(x_2\). It is particularly relevant when the design variables have different
natures, e.g. \(x_1\) is discrete and \(x_2\) is continuous, and that dedicated
algorithms exist.