gemseo / disciplines

Show inherited members

analytic module

A discipline based on analytic expressions.

class gemseo.disciplines.analytic.AnalyticDiscipline(expressions, name=None, fast_evaluation=True, grammar_type=GrammarType.JSON)[source]

Bases: MDODiscipline

A discipline based on analytic expressions.

Use SymPy, a symbolic calculation engine.

Compute the Jacobian matrices by automatically differentiating the expressions.

Examples

>>> from gemseo.disciplines.analytic import AnalyticDiscipline
>>> discipline = AnalyticDiscipline({"y_1": "2*x**2", "y_2": "4*x**2+5+z**3"})

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • expressions (Mapping[str, str | Expr]) – The outputs expressed as functions of the inputs.

  • name (str | None) – The name of the discipline. If None, use the class name.

  • fast_evaluation (bool) –

    Whether to apply sympy.lambdify to the expressions in order to accelerate their numerical evaluation; otherwise the expressions are evaluated with sympy.Expr.evalf.

    By default it is set to True.

  • grammar_type (MDODiscipline.GrammarType) –

    The type of the input and output grammars.

    By default it is set to “JSONGrammar”.

cache: AbstractCache | None

The cache containing one or several executions of the discipline according to the cache policy.

data_processor: DataProcessor

A tool to pre- and post-process discipline data.

exec_for_lin: bool

Whether the last execution was due to a linearization.

expressions: Mapping[str, str | Expr]

The outputs expressed as functions of the inputs.

input_grammar: BaseGrammar

The input grammar.

input_names: list[str]

The names of the inputs.

jac: MutableMapping[str, MutableMapping[str, ndarray | csr_array | JacobianOperator]]

The Jacobians of the outputs wrt inputs.

The structure is {output: {input: matrix}}.

name: str

The name of the discipline.

output_grammar: BaseGrammar

The output grammar.

output_names_to_symbols: dict[str, list[str]]

[‘in_1’, ‘in_2’]}``.

Type:

The names of the inputs associated to the outputs, e.g. ``{‘out’

re_exec_policy: ReExecutionPolicy

The policy to re-execute the same discipline.

residual_variables: dict[str, str]

The output variables mapping to their inputs, to be considered as residuals; they shall be equal to zero.

run_solves_residuals: bool

Whether the run method shall solve the residuals.

Examples using AnalyticDiscipline

Parameter space

Parameter space

Examples for constraint aggregation

Examples for constraint aggregation

Create a DOE Scenario

Create a DOE Scenario

Create an MDO Scenario

Create an MDO Scenario

MDO formulations for a toy example in aerostructure

MDO formulations for a toy example in aerostructure

Discipline

Discipline

Scenario

Scenario

Multistart optimization

Multistart optimization

Diagonal design of experiments

Diagonal design of experiments

Change the seed of a DOE

Change the seed of a DOE

Use a design of experiments from a file

Use a design of experiments from a file

Use a design of experiments from an array

Use a design of experiments from an array

Create a surrogate discipline

Create a surrogate discipline

API

API

GP regression

GP regression

Linear regression

Linear regression

PCE regression

PCE regression

Polynomial regression

Polynomial regression

RBF regression

RBF regression

Random forest regression

Random forest regression

Save and Load

Save and Load

Parameter space

Parameter space

Pareto front on the Binh and Korn problem using a BiLevel formulation

Pareto front on the Binh and Korn problem using a BiLevel formulation

Compute the Jacobian of a discipline analytically

Compute the Jacobian of a discipline analytically

Create a discipline from analytical expressions

Create a discipline from analytical expressions