gemseo_calibration

Show inherited members

scenario module

A module to calibrate a multidisciplinary system from data.

class gemseo_calibration.scenario.CalibrationScenario(disciplines, input_names, control_outputs, calibration_space, formulation='MDF', name='', **formulation_options)[source]

Bases: MDOScenario

A Scenario to calibrate a multidisciplinary system from reference data.

Set from parameters, this multidisciplinary system computes output data from input data.

The reference input-output data are used to calibrate the parameters so that the model output data are close to the reference output data for some outputs of interest. This distance is evaluated with a CalibrationMeasure. to compare the discipline outputs with the reference data.

Warning

Just like inputs, the parameters should be defined in the input grammars of the disciplines.

The parameters are calibrated with the method execute() from an optimizer and a reference input-output Dataset.

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

Parameters:
  • disciplines (MDODiscipline | list[MDODiscipline]) – The disciplines whose parameters must be calibrated from the reference data.

  • input_names (str | Iterable[str]) – The names of the inputs to be considered for the calibration.

  • control_outputs (CalibrationMeasure | Sequence[CalibrationMeasure]) – The names of the outputs used to calibrate the disciplines with the name of the calibration measure and the corresponding weight comprised between 0 and 1 (the weights must sum to 1). When the output is a 1D function discretized over an irregular mesh, the name of the mesh can be provided. E.g. CalibrationMeasure(output="z", measure="MSE") CalibrationMeasure(output="z", measure="MSE", weight=0.3) or CalibrationMeasure(output="z", measure="MSE", mesh="z_mesh") Lastly, CalibrationMeasure can be imported from gemseo-calibration.scenario.

  • calibration_space (DesignSpace) – The space of the parameters to be calibrated, whose current values are consider as a prior for calibration.

  • formulation (str) –

    The name of a formulation to manage the multidisciplinary coupling.

    By default it is set to “MDF”.

  • name (str) –

    A name for this calibration scenario. If empty, use the name of the class.

    By default it is set to “”.

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

add_constraint(control_outputs, constraint_type=ConstraintType.EQ, constraint_name='', value=0.0, positive=False)[source]

Define a constraint from a calibration measure related to discipline outputs.

Parameters:
  • control_outputs (CalibrationMeasure | Iterable[CalibrationMeasure]) – The names of the outputs used to calibrate the disciplines with the name of the calibration measure and the corresponding weight comprised between 0 and 1 (the weights must sum to 1). When the output is a 1D function discretized over an irregular mesh, the name of the mesh can be provided. E.g. CalibrationMeasure(output="z", measure="MSE") CalibrationMeasure(output="z", measure="MSE", weight=0.3) or CalibrationMeasure(output="z", measure="MSE", mesh="z_mesh") Lastly, CalibrationMeasure can be imported from gemseo-calibration.scenario.

  • constraint_type (MDOFunction.ConstraintType) –

    The type of constraint, "eq" for equality constraint and "ineq" for inequality constraint.

    By default it is set to “eq”.

  • constraint_name (str) –

    The name of the constraint to be stored. If empty, the name of the constraint is generated from the output name.

    By default it is set to “”.

  • value (float) –

    The value for which the constraint is active.

    By default it is set to 0.0.

  • positive (bool) –

    Whether to consider the inequality constraint as positive.

    By default it is set to False.

Raises:

ValueError – If the constraint type is neither ‘eq’ nor ‘ineq’.

Return type:

None

post_process(post_name, **options)[source]

Post-process the optimization history.

Parameters:
  • post_name (str) – The name of the post-processor, i.e. the name of a class inheriting from OptPostProcessor.

  • **options (Any) – The options for the post-processor.

Returns:

The post-processing instance related to the optimization scenario.

Return type:

None

cache: AbstractCache | None

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

property calibrator: Calibrator

The discipline computing calibration measures from the parameter values.

clear_history_before_run: bool

If True, clear history before run.

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.

formulation: MDOFormulation

The MDO formulation.

formulation_name: str

The name of the MDO formulation.

input_grammar: BaseGrammar

The input grammar.

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.

optimization_result: OptimizationResult | None

The optimization result if the scenario has been executed; otherwise None.

output_grammar: BaseGrammar

The output grammar.

posterior_model_data: dict[str, ndarray]

The model data after the calibration.

property posterior_parameters: DataType

The values of the parameters after the calibration stage.

property posts: list[str]

The available post-processors.

prior_model_data: dict[str, ndarray]

The model data before the calibration.

property prior_parameters: DataType

The values of the parameters before the calibration stage.

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.