gemseo / problems / scalable / data_driven

Show inherited members

problem module

Scalable MDO problem.

This module implements the concept of scalable problem by means of the ScalableProblem class.

Given

  • an MDO scenario based on a set of sampled disciplines with a particular problem dimension,

  • a new problem dimension (= number of inputs and outputs),

a scalable problem:

  1. makes each discipline scalable based on the new problem dimension,

  2. creates the corresponding MDO scenario.

Then, this MDO scenario can be executed and post-processed.

We can repeat this tasks for different sizes of variables and compare the scalability, which is the dependence of the scenario results on the problem dimension.

class gemseo.problems.scalable.data_driven.problem.ScalableProblem(datasets, design_variables, objective_function, eq_constraints=None, ineq_constraints=None, maximize_objective=False, sizes=None, **parameters)[source]

Bases: object

Scalable problem.

Parameters:
  • datasets (Iterable[IODataset]) – One input-output dataset per discipline.

  • design_variables (Iterable[str]) – The names of the design variables.

  • objective_function (str) – The name of the objective.

  • eq_constraints (Iterable[str] | None) – The names of the equality constraints, if any.

  • ineq_constraints (Iterable[str] | None) – The names of the inequality constraints, if any.

  • maximize_objective (bool) –

    Whether to maximize the objective.

    By default it is set to False.

  • sizes (Mapping[str, int] | None) – The sizes of the inputs and outputs. If None, use the original sizes.

  • **parameters (Any) – The optional parameters of the scalable model.

create_scenario(formulation='DisciplinaryOpt', scenario_type='MDO', start_at_equilibrium=False, active_probability=0.1, feasibility_level=0.5, **options)[source]

Create a Scenario from the scalable disciplines.

Parameters:
  • formulation (str) –

    The MDO formulation to use for the scenario.

    By default it is set to “DisciplinaryOpt”.

  • scenario_type (str) –

    The type of scenario, either MDO or DOE.

    By default it is set to “MDO”.

  • start_at_equilibrium (bool) –

    Whether to start at equilibrium using a preliminary MDA.

    By default it is set to False.

  • active_probability (float) –

    The probability to set the inequality constraints as active at the initial step of the optimization.

    By default it is set to 0.1.

  • feasibility_level (float) –

    The offset of satisfaction for inequality constraints.

    By default it is set to 0.5.

  • **options – The formulation options.

Returns:

The Scenario from the scalable disciplines.

Return type:

Scenario

exec_time(do_sum=True)[source]

Get the total execution time.

Parameters:

do_sum (bool) –

Whether to sum the disciplinary execution times.

By default it is set to True.

Returns:

Either the total execution time or the total execution times per disciplines.

Return type:

float | list[float]

plot_1d_interpolations(save=True, show=False, step=0.01, varnames=None, directory='.', png=False)[source]

Plot 1d interpolations.

Parameters:
  • save (bool) –

    Whether to save the figure.

    By default it is set to True.

  • show (bool) –

    Whether to display the figure.

    By default it is set to False.

  • step (float) –

    The step to evaluate the 1d interpolation function.

    By default it is set to 0.01.

  • varnames (Sequence[str] | None) – The names of the variable to plot. If None, all the variables are plotted.

  • directory (Path | str) –

    The directory path.

    By default it is set to “.”.

  • png (bool) –

    Whether to use PNG file format instead of PDF.

    By default it is set to False.

plot_coupling_graph()[source]

Plot a coupling graph.

Return type:

None

plot_dependencies(save=True, show=False, directory='.')[source]

Plot dependency matrices.

Parameters:
  • save (bool) –

    Whether to save the figure.

    By default it is set to True.

  • show (bool) –

    Whether to display the figure.

    By default it is set to False.

  • directory (str) –

    The directory path.

    By default it is set to “.”.

plot_n2_chart(save=True, show=False)[source]

Plot a N2 chart.

Parameters:
  • save (bool) –

    Whether to save the figure.

    By default it is set to True.

  • show (bool) –

    Whether to display the figure.

    By default it is set to False.

Return type:

None

property is_feasible: bool

Whether the solution is feasible.

property n_calls: dict[str, int]

The number of disciplinary calls per discipline.

property n_calls_linearize: dict[str, int]

The number of disciplinary linearizations per discipline.

property n_calls_linearize_top_level: dict[str, int]

The number of top-level disciplinary linearizations per discipline.

property n_calls_top_level: dict[str, int]

The number of top-level disciplinary calls per discipline.

property status: int

The status of the scenario.

Examples using ScalableProblem

Scalable problem

Scalable problem