taylor_polynomial module¶
Taylor polynomials for multidisciplinary design problems under uncertainty.
[TaylorPolynomial][gemseo_umdo.formulations.taylor_polynomial.TaylorPolynomial] is an [UMDOFormulation][gemseo_umdo.formulations.formulation.UMDOFormulation] estimating the statistics with first- or second-order Taylor polynomials around the expectation of the uncertain variables: $f(x,U)approx f(x,mu) + (U-mu)f’(x,mu) pm 0.5(U-mu)^2f’’(x,mu)$.
E.g. $mathbb{E}[f(x,U)]approx frac{1}{N}sum_{i=1}^N fleft(x,U^{(i)}right)$ or $mathbb{V}[f(x,U)]approx sigma^2f’(x,mu)$ where $U$ is normally distributed with mean $mu$ and variance $sigma^2$.
- class gemseo_umdo.formulations.taylor_polynomial.HessianFunction(func)[source]
Bases:
MDOFunction
Approximation of the Hessian function with finite differences.
Take an original function and approximate its Hessian with finite differences applied to its analytical or approximated Jacobian.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
func (MDOFunction) – The original function.
- force_real: bool
Whether to cast the results to real value.
- has_default_name: bool
Whether the name has been set with a default value.
- last_eval: OutputType | None
The value of the function output at the last evaluation.
None
if it has not yet been evaluated.
- special_repr: str
The string representation of the function overloading its default string ones.
- class gemseo_umdo.formulations.taylor_polynomial.TaylorPolynomial(disciplines, objective_name, design_space, mdo_formulation, uncertain_space, objective_statistic_name, objective_statistic_parameters=None, maximize_objective=False, grammar_type=GrammarType.JSON, differentiation_method=DifferentiationMethod.USER_GRAD, second_order=False, **options)[source]
Bases:
UMDOFormulation
Robust MDO formulation based on Taylor polynomials.
- Parameters:
disciplines (Sequence[MDODiscipline]) – The disciplines.
objective_name (str) – The name(s) of the discipline output(s) used as objective. If multiple names are passed, the objective will be a vector.
design_space (DesignSpace) – The design space.
mdo_formulation (MDOFormulation) – The class name of the MDO formulation, e.g. “MDF”.
uncertain_space (ParameterSpace) – The uncertain variables with their probability distributions.
objective_statistic_name (str) – The name of the statistic to be applied to the objective.
objective_statistic_parameters (Mapping[str, Any] | None) – The values of the parameters of the statistic to be applied to the objective, if any.
maximize_objective (bool) –
Whether to maximize the objective.
By default it is set to False.
grammar_type (MDODiscipline.GrammarType) –
The type of the input and output grammars.
By default it is set to “JSONGrammar”.
differentiation_method (OptimizationProblem.DifferentiationMethod) –
The description is missing.
By default it is set to “user”.
second_order (bool) –
The description is missing.
By default it is set to False.
**options (Any) – The options of the formulation.
- add_constraint(output_name, statistic_name, constraint_type=ConstraintType.INEQ, constraint_name=None, value=None, positive=False, **statistic_parameters)[source]
Add a user constraint.
A user constraint is a design constraint in addition to the formulation specific constraints such as the targets (a.k.a. consistency constraints) in IDF.
The strategy of repartition of constraints is defined in the formulation class.
- Parameters:
output_name (str | Sequence[str]) – The name of the output to be used as a constraint. For instance, if g_1 is given and constraint_type=”eq”, g_1=0 will be added as a constraint to the optimizer.
statistic_name (str) – The name of the statistic to be applied to the constraint.
constraint_type (str) –
The type of constraint, either “eq” for equality constraint or “ineq” for inequality constraint.
By default it is set to “ineq”.
constraint_name (str | None) – The name of the constraint to be stored, If
None
, the name is generated from the output name.value (float | None) – The value of activation of the constraint. If
None
, the value is equal to 0.positive (bool) –
Whether to consider an inequality constraint as positive.
By default it is set to False.
**statistic_parameters (Any) – The description is missing.
- Return type:
None
- add_observable(output_names, statistic_name, observable_name=None, discipline=None, **statistic_parameters)[source]
Add an observable to the optimization problem.
The repartition strategy of the observable is defined in the formulation class.
- Parameters:
output_names (Sequence[str]) – The name(s) of the output(s) to observe.
statistic_name (str) – The name of the statistic to be applied to the observable.
observable_name (Sequence[str] | None) – The name of the observable.
discipline (MDODiscipline | None) – The discipline computing the observed outputs. If
None
, the discipline is detected from inner disciplines.**statistic_parameters (Any) – The description is missing.
- Return type:
None
- evaluate_with_mean(problem, eval_jac)[source]
Evaluate the functions of a problem at the mean of the uncertain variables.
- Parameters:
problem (OptimizationProblem) – The problem.
eval_jac (bool) – Whether to evaluate the Jacobian functions.
- Return type:
None
- property hessian_fd_problem: OptimizationProblem
The problem related to the approximation of the Hessian.
- opt_problem: OptimizationProblem
The optimization problem generated by the formulation from the disciplines.
- property second_order: bool
Whether to use a second order approximation.