A lightweight wrapper of the ql algorithm by Professor Schittkowski. It handles the workspace memory to be passed to the solver along with the problem. More...
#include <eigen-qld/QLDDirect.h>
Public Member Functions | |
EIGEN_QLD_API | QLDDirect () |
EIGEN_QLD_API | QLDDirect (int nrvar, int nreq, int nrineq, int ldq=-1, int lda=-1, bool verbose=false) |
EIGEN_QLD_API void | fdOut (int fd) |
EIGEN_QLD_API int | fdOut () const |
EIGEN_QLD_API void | verbose (bool v) |
EIGEN_QLD_API bool | verbose () const |
EIGEN_QLD_API int | fail () const |
EIGEN_QLD_API void | problem (int nrvar, int nreq, int nrineq, int ldq=-1, int lda=-1) |
EIGEN_QLD_API const VectorXd & | result () const |
EIGEN_QLD_API const VectorXd & | multipliers () const |
template<typename MatObj , typename VecObj , typename MatConstr , typename VecConstr , typename VecVar > | |
bool | solve (const MatrixBase< MatObj > &Q, const MatrixBase< VecObj > &c, const MatrixBase< MatConstr > &A, const MatrixBase< VecConstr > &b, const MatrixBase< VecVar > &xl, const MatrixBase< VecVar > &xu, int nreq, bool isDecomp=false, double eps=1e-12) |
A lightweight wrapper of the ql algorithm by Professor Schittkowski. It handles the workspace memory to be passed to the solver along with the problem.
EIGEN_QLD_API Eigen::QLDDirect::QLDDirect | ( | ) |
Create a solver without allocating memory. A call to QLDDirect::problem will be necessary before calling QLDDirect::solve
EIGEN_QLD_API Eigen::QLDDirect::QLDDirect | ( | int | nrvar, |
int | nreq, | ||
int | nrineq, | ||
int | ldq = -1 , |
||
int | lda = -1 , |
||
bool | verbose = false |
||
) |
Create a solver and allocate the memory necessary to solve a problem with the given dimensions. See also QLDDirect::problem
EIGEN_QLD_API int Eigen::QLDDirect::fail | ( | ) | const |
Return the fail code of the last call to QLDDirect::solve. 0 means succes.
EIGEN_QLD_API int Eigen::QLDDirect::fdOut | ( | ) | const |
Get the file number used for output
EIGEN_QLD_API void Eigen::QLDDirect::fdOut | ( | int | fd | ) |
Specify a file number for output (Fortran unit specification).
EIGEN_QLD_API const VectorXd& Eigen::QLDDirect::multipliers | ( | ) | const |
Return the lagrange multipliers associated with results, with the multipliers corresponding to equality constraints first, then to inequality constraints, then lower bounds, then upper bounds.
EIGEN_QLD_API void Eigen::QLDDirect::problem | ( | int | nrvar, |
int | nreq, | ||
int | nrineq, | ||
int | ldq = -1 , |
||
int | lda = -1 |
||
) |
Allocate the memory necessary to solve a problem with the given dimensions.
nrvar | Size of the variable vector \(x\). |
nreq | Number of equality constraints, i.e. the row size of \(A_{eq}\). |
nrineq | Number of inequality constraints, i.e. the row size of \(A_{ineq}\). |
ldq | Leading dimension of the matrix \(Q\) (see below). If smaller than nrvar , nrvar will be used instead (which is the default case). |
lda | Leading dimension of the matrix \(A = \begin{bmatrix} A_{eq} \\ A_{ineq} \end{bmatrix} \). If smaller than nreq + nrineq , it will be set to this value (which is the default case). |
\begin{align} \begin{bmatrix} 4 & 3 & 7 & 2 \\ 2 & 8 & 1 & 5 \\ 6 & 5 & 1 & 2 \end{bmatrix} \end{align}
It can be stored with a leading dimension of 5 asEIGEN_QLD_API const VectorXd& Eigen::QLDDirect::result | ( | ) | const |
Return the result from the latest call to QLDDirect::solve.
|
inline |
Solve the problem
\begin{align} \underset{{x} \in \mathbb{R}^n}{\text{minimize}} & \ \frac{1}{2}{x^TQx} + {c^Tx} \nonumber \\ \text{subject to} & \ A_{1:m_e} x + b_{1:m_e} = 0 \\ & \ A_{m_e+1:\mbox{end}} x + b_{m_e+1:\mbox{end}} \geq 0 \\ & \ x_l \leq x \leq x_u \end{align}
For a positive definite matrix \(Q\), we have the Cholesky decomposition \(Q = R^T R\) with \(R\) upper triangular. If isDecomp
is true, \(R\) should be given instead of \(Q\). Only the upper triangular part of \(R\) will be used.
Q | The matrix \(Q\), or its Cholesky factor \(R\) if isDecomp is true. \(Q\) should be symmetric and positive definite, \(R\) should be upper triangular. |
c | The vector \(c\). |
A | The matrix \(A = \begin{bmatrix} A_{eq} \\ A_{ineq} \end{bmatrix} \). |
b | The vector \(b = \begin{bmatrix} b_{eq} \\ b_{ineq} \end{bmatrix} \). |
xl | The vector \(x_{l}\). |
xu | The vector \(x_{u}\). |
nreq | The number \(m_e\) of equality constraints (i.e. the row size of \(A_{eq}\)). |
isDecomp | specify if the Cholesky decomposition of \(Q\) is used or not. |
eps | Desired final accuracy. |
EIGEN_QLD_API bool Eigen::QLDDirect::verbose | ( | ) | const |
Check if QLD must generate outputs or not.
EIGEN_QLD_API void Eigen::QLDDirect::verbose | ( | bool | v | ) |
Specify if QLD must generate outputs or not.