Eigen::QLDDirect Class Reference

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>

Inheritance diagram for Eigen::QLDDirect:

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QLDDirect() [1/2]

EIGEN_QLD_API Eigen::QLDDirect::QLDDirect ( )

Create a solver without allocating memory. A call to QLDDirect::problem will be necessary before calling QLDDirect::solve

◆ QLDDirect() [2/2]

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

Member Function Documentation

◆ fail()

EIGEN_QLD_API int Eigen::QLDDirect::fail ( ) const

Return the fail code of the last call to QLDDirect::solve. 0 means succes.

◆ fdOut() [1/2]

EIGEN_QLD_API int Eigen::QLDDirect::fdOut ( ) const

Get the file number used for output

◆ fdOut() [2/2]

EIGEN_QLD_API void Eigen::QLDDirect::fdOut ( int  fd)

Specify a file number for output (Fortran unit specification).

◆ multipliers()

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.

◆ problem()

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.

Parameters
nrvarSize of the variable vector \(x\).
nreqNumber of equality constraints, i.e. the row size of \(A_{eq}\).
nrineqNumber of inequality constraints, i.e. the row size of \(A_{ineq}\).
ldqLeading dimension of the matrix \(Q\) (see below). If smaller than nrvar, nrvar will be used instead (which is the default case).
ldaLeading 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).
Note
For a column-major matrix (which is the default case in Eigen and what QLD is expecting), the matrix values are stored in a simple, 1-d array, one column after the other. Often the column are place in this arry one right after the other but this needs not be the case: there can be unused values in the array between the values of two columns. The offset between the start of two consecutive columns in the array is called the leading dimension. For a matrix M with leading dimension ld, and data ordered in an array data, element M(i,j) is found at data[i+ld*j].
As an example, consider the matrix

\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 as
[4, 2, 6, x, x, 3, 8, 5, x, x, 7, 1, 1, x, x, 2, 5, 2]
where the x are unimportant value with respect to this matrix.
For classical Eigen matrices like MatrixXd, ld is equal to the row size, but if for example we consider a matrix B that is the block of another one M, the leading dimension of B will be the row dimension of M.

◆ result()

EIGEN_QLD_API const VectorXd& Eigen::QLDDirect::result ( ) const

Return the result from the latest call to QLDDirect::solve.

◆ solve()

template<typename MatObj , typename VecObj , typename MatConstr , typename VecConstr , typename VecVar >
bool Eigen::QLDDirect::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 
)
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.

Parameters
QThe matrix \(Q\), or its Cholesky factor \(R\) if isDecomp is true. \(Q\) should be symmetric and positive definite, \(R\) should be upper triangular.
cThe vector \(c\).
AThe matrix \(A = \begin{bmatrix} A_{eq} \\ A_{ineq} \end{bmatrix} \).
bThe vector \(b = \begin{bmatrix} b_{eq} \\ b_{ineq} \end{bmatrix} \).
xlThe vector \(x_{l}\).
xuThe vector \(x_{u}\).
nreqThe number \(m_e\) of equality constraints (i.e. the row size of \(A_{eq}\)).
isDecompspecify if the Cholesky decomposition of \(Q\) is used or not.
epsDesired final accuracy.

◆ verbose() [1/2]

EIGEN_QLD_API bool Eigen::QLDDirect::verbose ( ) const

Check if QLD must generate outputs or not.

◆ verbose() [2/2]

EIGEN_QLD_API void Eigen::QLDDirect::verbose ( bool  v)

Specify if QLD must generate outputs or not.


The documentation for this class was generated from the following file: