QP Solver¶
Solvers for the linear and quadratic programs in active subspaces.
-
class
active_subspaces.utils.qp_solver.
QPSolver
(solver='GUROBI')¶ A class for solving linear and quadratic programs.
-
solver
¶ str
identifies which linear program software to use
Notes
The class checks to see if Gurobi is present. If it is, it uses Gurobi to solve the linear and quadratic programs. Otherwise, it uses scipy implementations to solve the linear and quadratic programs.
-
linear_program_eq
(c, A, b, lb, ub)¶ Solves an equality constrained linear program with variable bounds.
This method returns the minimizer of the following linear program.
minimize c^T x subject to A x = b lb <= x <= ub
Parameters: - c (ndarray) – m-by-1 matrix for the linear objective function
- A (ndarray) – M-by-m matrix that contains the coefficients of the linear equality constraints
- b (ndarray) – M-by-1 matrix that is the right hand side of the equality constraints
- lb (ndarray) – m-by-1 matrix that contains the lower bounds on the variables
- ub (ndarray) – m-by-1 matrix that contains the upper bounds on the variables
Returns: x – m-by-1 matrix that is the minimizer of the linear program
Return type: ndarray
-
linear_program_ineq
(c, A, b)¶ Solves an inequality constrained linear program.
This method returns the minimizer of the following linear program.
minimize c^T x subject to A x >= b
Parameters: - c (ndarray) – m-by-1 matrix for the linear objective function
- A (ndarray) – M-by-m matrix that contains the coefficients of the linear equality constraints
- b (ndarray) – size M-by-1 matrix that is the right hand side of the equality constraints
Returns: x – m-by-1 matrix that is the minimizer of the linear program
Return type: ndarray
-
quadratic_program_bnd
(c, Q, lb, ub)¶ Solves a quadratic program with variable bounds.
This method returns the minimizer of the following linear program.
minimize c^T x + x^T Q x subject to lb <= x <= ub
Parameters: - c (ndarray) – m-by-1 matrix that contains the coefficients of the linear term in the objective function
- Q (ndarray) – m-by-m matrix that contains the coefficients of the quadratic term in the objective function
- lb (ndarray) – m-by-1 matrix that contains the lower bounds on the variables
- ub (ndarray) – m-by-1 matrix that contains the upper bounds on the variables
Returns: x – m-by-1 matrix that is the minimizer of the quadratic program
Return type: ndarray
-
quadratic_program_ineq
(c, Q, A, b)¶ Solves an inequality constrained quadratic program.
This method returns the minimizer of the following quadratic program.
minimize c^T x + x^T Q x subject to A x >= b
Parameters: - c (ndarray) – m-by-1 matrix that contains the coefficients of the linear term in the objective function
- Q (ndarray) – m-by-m matrix that contains the coefficients of the quadratic term in the objective function
- A (ndarray) – M-by-m matrix that contains the coefficients of the linear equality constraints
- b (ndarray) – M-by-1 matrix that is the right hand side of the equality constraints
Returns: x – m-by-1 matrix that is the minimizer of the quadratic program.
Return type: ndarray
-