rosenbrock module¶
The Rosenbrock analytic problem.
- class gemseo.problems.analytical.rosenbrock.RosenMF(dimension=2)[source]
Bases:
MDODiscipline
A multi-fidelity Rosenbrock discipline.
Its expression is \(\mathrm{fidelity} * \mathrm{Rosenbrock}(x)\) where both \(\mathrm{fidelity}\) and \(x\) are provided as input data.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
dimension (int) –
The dimension of the design space.
By default it is set to 2.
- 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: 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.
- 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.
- class gemseo.problems.analytical.rosenbrock.Rosenbrock(n_x=2, l_b=-2.0, u_b=2.0, scalar_var=False, initial_guess=None)[source]
Bases:
OptimizationProblem
The Rosenbrock optimization problem.
\[f(x) = \sum_{i=2}^{n_x} 100(x_{i} - x_{i-1}^2)^2 + (1 - x_{i-1})^2\]with the default
DesignSpace
\([-0.2,0.2]^{n_x}\).- Parameters:
n_x (int) –
The dimension of the design space.
By default it is set to 2.
l_b (float) –
The lower bound (common value to all variables).
By default it is set to -2.0.
u_b (float) –
The upper bound (common value to all variables).
By default it is set to 2.0.
scalar_var (bool) –
If
True
, the design space will contain only scalar variables (as many as the problem dimension); ifFalse
, the design space will contain a single multidimensional variable (whose size equals the problem dimension).By default it is set to False.
initial_guess (ndarray | None) – The initial guess for optimal solution.
- get_solution()[source]
Return the theoretical optimal value.
- constraints: list[MDOFunction]
The constraints.
- current_iter: int
The current iteration.
- database: Database
The database to store the optimization problem data.
- design_space: DesignSpace
The design space on which the optimization problem is solved.
- eq_tolerance: float
The tolerance for the equality constraints.
- fd_step: float
The finite differences step.
- ineq_tolerance: float
The tolerance for the inequality constraints.
- max_iter: int
The maximum iteration.
- new_iter_observables: list[MDOFunction]
The observables to be called at each new iterate.
- nonproc_constraints: list[MDOFunction]
The non-processed constraints.
- nonproc_new_iter_observables: list[MDOFunction]
The non-processed observables to be called at each new iterate.
- nonproc_objective: MDOFunction
The non-processed objective function.
- nonproc_observables: list[MDOFunction]
The non-processed observables.
- observables: list[MDOFunction]
The observables.
- pb_type: ProblemType
The type of optimization problem.
- preprocess_options: dict
The options to pre-process the functions.
- solution: OptimizationResult | None
The solution of the optimization problem if solved; otherwise
None
.
- stop_if_nan: bool
Whether the optimization stops when a function returns
NaN
.
- use_standardized_objective: bool
Whether to use standardized objective for logging and post-processing.
The standardized objective corresponds to the original one expressed as a cost function to minimize. A
DriverLibrary
works with this standardized objective and theDatabase
stores its values. However, for convenience, it may be more relevant to log the expression and the values of the original objective.
Examples using Rosenbrock¶
Convert a database to a dataset