turboflow.pysolver_view.optimization_problems module
- class turboflow.pysolver_view.optimization_problems.HS71Problem[source]
Bases:
OptimizationProblem
Implementation of the Hock Schittkowski problem No.71.
This class implements the following optimization problem:
\[\begin{split}\begin{align} \text{minimize} \quad & f(\mathbf{x}) = x_1x_4(x_1+x_2+x_3) + x_3 \\ \text{s.t.} \quad & x_1^2 + x_2^2 + x_3^2 + x_4^2 = 40 \\ & 25 - x_1 x_2 x_3 x_4 \le 0 \\ & 1 \le x_1, x_2, x_3, x_4 \le 5 \end{align}\end{split}\]References
Hock and K. Schittkowski. Test examples for nonlinear programming codes. Lecture Notes in Economics and Mathematical Systems, 187, 1981. doi: 10.1007/978-3-642-48320-2.
Methods
evaluate_problem(x)`:
Compute objective, equality, and inequality constraint.
get_bounds()`:
Return variable bounds.
get_n_eq()`:
Get number of equality constraints.
get_n_ineq()`:
Get number of inequality constraints.
- fitness(x)[source]
Evaluate the objective function and constraints for given decision variables.
- Parameters:
- xarray-like
Vector of independent variables (i.e., degrees of freedom).
- Returns:
- array_like
Vector containing the objective function, equality constraints, and inequality constraints.
- get_bounds()[source]
Get the bounds for each decision variable (Pygmo format)
- Returns:
- boundstuple of lists
A tuple of two items where the first item is the list of lower bounds and the second item of the list of upper bounds for the vector of decision variables. For example, ([-2 -1], [2, 1]) indicates that the first decision variable has bounds between -2 and 2, and the second has bounds between -1 and 1.
- class turboflow.pysolver_view.optimization_problems.LorentzEquationsOpt(sigma=1.0, beta=2.0, rho=3.0)[source]
Bases:
OptimizationProblem
Implementation of the Lorentz System of Nonlinear Equations as an optimization problem
This class implements the following system of algebraic nonlinear equations:
\[\begin{split}\begin{align} \dot{x} &= \sigma(y - x) = 0\\ \dot{y} &= x(\rho - z) - y = 0\\ \dot{z} &= xy - \beta z = 0 \end{align}\end{split}\]Where:
\(\sigma\) is related to the Prandtl number
\(\rho\) is related to the Rayleigh number
\(\beta\) is a geometric factor
References
Edward N. Lorenz. “Deterministic Nonperiodic Flow”. Journal of the Atmospheric Sciences, 20(2):130-141, 1963.
- Attributes:
- sigmafloat
The Prandtl number.
- betafloat
The geometric factor.
- rhofloat
The Rayleigh number.
Methods
evaluate_problem(vars)`:
Evaluate the Lorentz system at a given state.
- fitness(vars)[source]
Evaluate the objective function and constraints for given decision variables.
- Parameters:
- xarray-like
Vector of independent variables (i.e., degrees of freedom).
- Returns:
- array_like
Vector containing the objective function, equality constraints, and inequality constraints.
- get_bounds()[source]
Get the bounds for each decision variable (Pygmo format)
- Returns:
- boundstuple of lists
A tuple of two items where the first item is the list of lower bounds and the second item of the list of upper bounds for the vector of decision variables. For example, ([-2 -1], [2, 1]) indicates that the first decision variable has bounds between -2 and 2, and the second has bounds between -1 and 1.
- class turboflow.pysolver_view.optimization_problems.RosenbrockProblem(dim)[source]
Bases:
OptimizationProblem
Implementation of the Rosenbrock problem.
The Rosenbrock problem, also known as Rosenbrock’s valley or banana function, is defined as:
\[\begin{split}\begin{align} \text{minimize} \quad & f(\mathbf{x}) = \sum_{i=1}^{n-1} \left[ 100(x_{i+1} - x_i^2)^2 + (x_i - 1)^2 \right] \\ \end{align}\end{split}\]Methods
evaluate_problem(x)
Evaluates the Rosenbrock function and its constraints.
get_bounds()
Returns the bounds for the problem.
get_n_eq()
Returns the number of equality constraints.
get_n_ineq()
Returns the number of inequality constraints.
- get_bounds()[source]
Get the bounds for each decision variable (Pygmo format)
- Returns:
- boundstuple of lists
A tuple of two items where the first item is the list of lower bounds and the second item of the list of upper bounds for the vector of decision variables. For example, ([-2 -1], [2, 1]) indicates that the first decision variable has bounds between -2 and 2, and the second has bounds between -1 and 1.
- get_nec()[source]
Return the number of equality constraints associated with the problem.
- Returns:
- neqint
Number of equality constraints.
- class turboflow.pysolver_view.optimization_problems.RosenbrockProblemConstrained(dim)[source]
Bases:
OptimizationProblem
Implementation of the Chained Rosenbrock function with trigonometric-exponential constraints.
This problem is also referred to as Example 5.1 in the report by Luksan and Vlcek. The optimization problem is described as:
\[\begin{split}\begin{align} \text{minimize} \quad & \sum_{i=1}^{n-1}\left[100\left(x_i^2-x_{i+1}\right)^2 + \left(x_i-1\right)^2\right] \\ \text{s.t.} \quad & 3x_{k+1}^3 + 2x_{k+2} - 5 + \sin(x_{k+1}-x_{k+2})\sin(x_{k+1}+x_{k+2}) + \\ & + 4x_{k+1} - x_k \exp(x_k-x_{k+1}) - 3 = 0, \; \forall k=1,...,n-2 \\ & -5 \le x_i \le 5, \forall i=1,...,n \end{align}\end{split}\]References
Luksan, L., and Jan Vlcek. “Sparse and partially separable test problems for unconstrained and equality constrained optimization.” (1999). doi: link provided.
Methods
evaluate_problem(x):
Compute objective, equality, and inequality constraint.
get_bounds():
Return variable bounds.
get_n_eq():
Get number of equality constraints.
get_n_ineq():
Get number of inequality constraints.
- fitness(x)[source]
Evaluate the objective function and constraints for given decision variables.
- Parameters:
- xarray-like
Vector of independent variables (i.e., degrees of freedom).
- Returns:
- array_like
Vector containing the objective function, equality constraints, and inequality constraints.
- get_bounds()[source]
Get the bounds for each decision variable (Pygmo format)
- Returns:
- boundstuple of lists
A tuple of two items where the first item is the list of lower bounds and the second item of the list of upper bounds for the vector of decision variables. For example, ([-2 -1], [2, 1]) indicates that the first decision variable has bounds between -2 and 2, and the second has bounds between -1 and 1.
- get_nec()[source]
Return the number of equality constraints associated with the problem.
- Returns:
- neqint
Number of equality constraints.