gemseo.problems.optimization.power_2 module
A quadratic analytical problem.
-
class Power2(exception_error=False, initial_value=1.0)[source]
Bases: OptimizationProblem
Power2 is a very basic quadratic analytical OptimizationProblem
.
Objective to minimize: \(x_0^2 + x_1^2 + x_2^2\)
Inequality constraint 1: \(x_0^3 - 0.5 > 0\)
Inequality constraint 2: \(x_1^3 - 0.5 > 0\)
Equality constraint: \(x_2^3 - 0.9 = 0\)
Analytical optimum: \(x^*=(0.5^{1/3}, 0.5^{1/3}, 0.9^{1/3})\)
- Parameters:
exception_error (bool) --
Whether to raise an error when calling the objective;
useful for tests.
By default it is set to False.
initial_value (float) --
The initial design value of the problem.
By default it is set to 1.0.
-
static eq_constraint(x_dv)[source]
Compute the equality constraint \(x_2^3 - 0.9 = 0\).
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the equality constraint.
- Return type:
ndarray
-
static eq_constraint_jac(x_dv)[source]
Compute the gradient of the equality constraint.
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the gradient of the equality constraint.
- Return type:
ndarray
-
static get_solution()[source]
Return the analytical solution of the problem.
- Returns:
The theoretical optimum of the problem.
- Return type:
tuple[ndarray, ndarray]
-
static ineq_constraint1(x_dv)[source]
Compute the first inequality constraint \(x_0^3 - 0.5 > 0\).
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the first inequality constraint.
- Return type:
ndarray
-
static ineq_constraint1_jac(x_dv)[source]
Compute the gradient of the first inequality constraint.
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the gradient of the first inequality constraint.
- Return type:
ndarray
-
static ineq_constraint2(x_dv)[source]
Compute the second inequality constraint \(x_1^3 - 0.5 > 0\).
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the second inequality constraint.
- Return type:
ndarray
-
static ineq_constraint2_jac(x_dv)[source]
Compute the gradient of the second inequality constraint.
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the gradient of the second inequality constraint.
- Return type:
ndarray
-
pow2(x_dv)[source]
Compute the objective \(x_0^2 + x_1^2 + x_2^2\).
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The objective value.
- Raises:
ValueError -- When exception_error
is True
and the method has already been called three times.
- Return type:
ndarray
-
static pow2_jac(x_dv)[source]
Compute the gradient of the objective.
- Parameters:
x_dv (ndarray) -- The design variable vector.
- Returns:
The value of the objective gradient.
- Return type:
ndarray