discipline module¶
Scalable discipline¶
The discipline
implements the concept of scalable discipline.
This is a particular discipline
built from an input-output learning dataset associated with a function
and generalizing its behavior to a new user-defined problem dimension,
that is to say new user-defined input and output dimensions.
Alone or in interaction with other objects of the same type, a scalable discipline can be used to compare the efficiency of an algorithm applying to disciplines with respect to the problem dimension, e.g. optimization algorithm, surrogate model, MDO formulation, MDA, …
The ScalableDiscipline class implements this concept.
It inherits from the MDODiscipline class
in such a way that it can easily be used in a Scenario.
It is composed of a ScalableModel.
The user only needs to provide:
the name of a class overloading
ScalableModel,a dataset as an
Datasetvariables sizes as a dictionary whose keys are the names of inputs and outputs and values are their new sizes. If a variable is missing, its original size is considered.
The ScalableModel parameters can also be filled in,
otherwise the model uses default values.
- class gemseo.problems.scalable.data_driven.discipline.ScalableDiscipline(name, data, sizes=None, **parameters)[source]
Bases:
MDODisciplineScalable discipline.
Constructor.
- Parameters:
name (str) – scalable model class name.
data (Dataset) – learning dataset.
sizes (dict) – sizes of input and output variables. If None, use the original sizes. Default: None.
parameters – model parameters
name – The name of the discipline. If None, use the class name.
input_grammar_file – The input grammar file path. If
Noneandauto_detect_grammar_files=True, look for"ClassName_input.json"in theGRAMMAR_DIRECTORYif any or in the directory of the discipline class module. IfNoneandauto_detect_grammar_files=False, do not initialize the input grammar from a schema file.output_grammar_file – The output grammar file path. If
Noneandauto_detect_grammar_files=True, look for"ClassName_output.json"in theGRAMMAR_DIRECTORYif any or in the directory of the discipline class module. IfNoneandauto_detect_grammar_files=False, do not initialize the output grammar from a schema file.auto_detect_grammar_files – Whether to look for
"ClassName_{input,output}.json"in theGRAMMAR_DIRECTORYif any or in the directory of the discipline class module when{input,output}_grammar_fileisNone.grammar_type – The type of the input and output grammars.
cache_type – The type of cache.
cache_file_path – The HDF file path when
grammar_typeisMDODiscipline.CacheType.HDF5.
- initialize_grammars(data)[source]
Initialize input and output grammars from data names.
- Parameters:
data (Dataset) – learning dataset.
- Return type:
None
- 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.
- input_grammar: BaseGrammar
The input grammar.
- jac: dict[str, dict[str, ndarray]]
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.
- re_exec_policy: ReExecutionPolicy
The policy to re-execute the same discipline.
- residual_variables: Mapping[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.