power_2 module¶
A quadratic analytical problem¶
-
class
gemseo.problems.analytical.power_2.
Power2
(exception_error=False)[source]¶ Bases:
gemseo.algos.opt_problem.OptimizationProblem
Power2 is a very basic quadratic analytical
OptimizationProblem
:Objective to minimize: \(x_{dv,0}^2+x_1^2+x_2^2\)
Inequality constraint 1: \(x_{dv,0}^3 - 0.5 > 0\)
Inequality constraint 2: \(x_{dv,1}^3 - 0.5 > 0\)
Equality constraint: \(x_{dv,2}^3 - 0.9 = 0\)
Analytical optimum: \((0.5^{1/3}, 0.5^{1/3}, 0.9^{1/3})\)
The constructor initializes the Power2
OptimizationProblem
by defining theDesignSpace
, the objective function and the constraints.- Parameters
exception_error (bool) – if True, call to the objective raises errors useful for tests
-
static
eq_constraint
(x_dv)[source]¶ Compute the equality constraint.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the equality constraint
- Return type
numpy array
-
static
eq_constraint_jac
(x_dv)[source]¶ Compute the equality constraint gradient.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the equality constraint gradient
- Return type
numpy array
-
static
get_solution
()[source]¶ Return analytical result of optimization.
- Returns
theoretical optimum
- Return type
numpy array
-
static
ineq_constraint1
(x_dv)[source]¶ Compute the first inequality constraint.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the first inequality constraint
- Return type
numpy array
-
static
ineq_constraint1_jac
(x_dv)[source]¶ Compute the first inequality constraint gradient.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the first inequality constraint gradient
- Return type
numpy array
-
static
ineq_constraint2
(x_dv)[source]¶ Compute the second inequality constraint.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the second inequality constraint
- Return type
numpy array
-
static
ineq_constraint2_jac
(x_dv)[source]¶ Compute the second inequality constraint gradient.
- Parameters
x_dv (numpy array) – design variable vector
- Returns
value of the second inequality constraint gradient
- Return type
numpy array