Eigen wrapper class of osqp. The class wraps the c-library osqp for Eigen matrix. It accepts both dense and sparse matrix. To compute a QP, just set the number of variables and solve. More...
#include <eigen-osqp/OSQP.h>
Public Member Functions | |
OSQP () | |
Default constructor. More... | |
~OSQP () noexcept=default | |
Default destructor. More... | |
void | admmStepRho (c_float rho) noexcept |
ADMM step rho. Default is 0.1. More... | |
c_float | admmStepRho () const noexcept |
void | admmStepSigma (c_float sigma) noexcept |
ADMM step sigma. Default is 1e-6. More... | |
c_float | admmStepSigma () const noexcept |
void | scalingIter (c_int scaling) noexcept |
Heuristic data scaling iterations. If 0, scaling disabled. Default is 10. More... | |
c_int | scalingIter () const noexcept |
void | maxIter (c_int maxIter) noexcept |
Maximum number of iteration. Default is 4000. More... | |
c_int | maxIter () const noexcept |
void | absConvergenceTol (c_float tol) noexcept |
Absolute convergence tolerance. Default is 1e-3. More... | |
c_float | absConvergenceTol () const noexcept |
void | relConvergenceTol (c_float tol) noexcept |
Relative convergence tolerance. Default is 1e-3. More... | |
c_float | relConvergenceTol () const noexcept |
void | primalInfeasibilityTol (c_float tol) noexcept |
Primal infeasibility tolerance. Default is 1e-4. More... | |
c_float | primalInfeasibilityTol () const noexcept |
void | dualInfeasibilityTol (c_float tol) noexcept |
Dual infeasibility tolerance. Default is 1e-4. More... | |
c_float | dualInfeasibilityTol () const noexcept |
void | relaxationParam (c_float alpha) noexcept |
Relaxation parameter. Default is 1.6. More... | |
c_float | relaxationParam () const noexcept |
void | linearSystemSolver (linsys_solver_type solver) noexcept |
Linear solver. Default is QDLDL_SOLVER. More... | |
linsys_solver_type | linearSystemSolver () const noexcept |
void | scaleTermination (bool doScaleTermination) noexcept |
Use scale termination criteria. Default is false. More... | |
bool | scaleTermination () const noexcept |
void | checkTermination (c_int checkValue) noexcept |
check termination interval. If 0, termination checking is disabled. Default is 25. More... | |
c_int | checkTermination () const noexcept |
void | warmStart (bool ws) noexcept |
Warm start. Default is true. More... | |
bool | warmStart () const noexcept |
void | polish (bool doPolish) noexcept |
Polish ADMM solution. More... | |
bool | polish () const noexcept |
void | polishDelta (c_float delta) noexcept |
Regularization parameter for polish. More... | |
c_float | polishDelta () const noexcept |
void | polishRefineIter (c_int iter) noexcept |
Iterative refinement steps in polish. More... | |
c_int | polishRefineIter () const noexcept |
void | verbose (bool doPrint) noexcept |
Write osqp progress. More... | |
bool | verbose () const noexcept |
void | problem (int nrVar, int nrConstr) |
Set up the problem parameters. More... | |
const VectorDense & | result () const noexcept |
Return the qp result. More... | |
template<typename TQ , typename TA > | |
bool | solve (const TQ &Q, const VectorConstRef &c, const TA &A, const VectorConstRef &AL, const VectorConstRef &AU, const VectorConstRef &XL, const VectorConstRef &XU) |
Solve the given problem. The function problem(int, int) needs to be called before calling this function. More... | |
template<typename TQ , typename TA > | |
bool | solve (const TQ &Q, const VectorConstRef &c, const TA &A, const VectorConstRef &AL, const VectorConstRef &AU) |
Solve the given problem. The function problem(int, int) needs to be called before calling this function. More... | |
template<typename TQ > | |
bool | solve (const TQ &Q, const VectorConstRef &c) |
Solve unconstrained problem. The function problem(int, int) needs to be called before calling this function. More... | |
c_int | iter () const noexcept |
Get number of iterations taken. More... | |
void | inform (std::ostream &os) const noexcept |
Print solver status. More... | |
c_int | status () const noexcept |
Get solver status. More... | |
c_float | costResult () const noexcept |
Get cost result. More... | |
c_float | primalResidualNorm () const noexcept |
Get norm of primal residual. More... | |
c_float | dualResidualNorm () const noexcept |
Get norm of dual residual. More... | |
Eigen wrapper class of osqp. The class wraps the c-library osqp for Eigen matrix. It accepts both dense and sparse matrix. To compute a QP, just set the number of variables and solve.
Eigen::OSQP::OSQP | ( | ) |
Default constructor.
|
defaultnoexcept |
Default destructor.
|
inlinenoexcept |
Absolute convergence tolerance. Default is 1e-3.
|
inlinenoexcept |
|
inlinenoexcept |
ADMM step rho. Default is 0.1.
|
inlinenoexcept |
|
inlinenoexcept |
ADMM step sigma. Default is 1e-6.
|
inlinenoexcept |
|
inlinenoexcept |
check termination interval. If 0, termination checking is disabled. Default is 25.
|
inlinenoexcept |
|
inlinenoexcept |
Get cost result.
|
inlinenoexcept |
Dual infeasibility tolerance. Default is 1e-4.
|
inlinenoexcept |
|
inlinenoexcept |
Get norm of dual residual.
|
inlinenoexcept |
Print solver status.
|
inlinenoexcept |
Get number of iterations taken.
|
inlinenoexcept |
Linear solver. Default is QDLDL_SOLVER.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Polish ADMM solution.
|
inlinenoexcept |
|
inlinenoexcept |
Regularization parameter for polish.
|
inlinenoexcept |
|
inlinenoexcept |
Iterative refinement steps in polish.
|
inlinenoexcept |
|
inlinenoexcept |
Primal infeasibility tolerance. Default is 1e-4.
|
inlinenoexcept |
|
inlinenoexcept |
Get norm of primal residual.
void Eigen::OSQP::problem | ( | int | nrVar, |
int | nrConstr | ||
) |
Set up the problem parameters.
nrVar | Number of variable |
nrConstr | Number of constraints |
|
inlinenoexcept |
Relaxation parameter. Default is 1.6.
|
inlinenoexcept |
|
inlinenoexcept |
Relative convergence tolerance. Default is 1e-3.
|
inlinenoexcept |
|
inlinenoexcept |
Return the qp result.
|
inlinenoexcept |
Use scale termination criteria. Default is false.
|
inlinenoexcept |
|
inlinenoexcept |
Heuristic data scaling iterations. If 0, scaling disabled. Default is 10.
|
inlinenoexcept |
bool Eigen::OSQP::solve | ( | const TQ & | Q, |
const VectorConstRef & | c, | ||
const TA & | A, | ||
const VectorConstRef & | AL, | ||
const VectorConstRef & | AU, | ||
const VectorConstRef & | XL, | ||
const VectorConstRef & | XU | ||
) |
Solve the given problem. The function problem(int, int) needs to be called before calling this function.
TQ | Matrix type. Either a dense or compressed sparse matrix (or a reference to it). |
TA | Matrix type. Either a dense or compressed sparse matrix (or a reference to it). |
Q | Quadratic part of the cost. |
c | Linear part of the cost. |
A | Constraint matrix. |
AL | Lower bound of the constraints. |
AU | Upper bound of the constraints. |
XL | Lower bound of the variables. |
XU | Upper bound of the variables. |
References Eigen::CSCMatrix::matrix(), Eigen::CSCMatrix::updateAndAddIdentity(), and Eigen::CSCMatrix::updateTriangularDefault().
bool Eigen::OSQP::solve | ( | const TQ & | Q, |
const VectorConstRef & | c, | ||
const TA & | A, | ||
const VectorConstRef & | AL, | ||
const VectorConstRef & | AU | ||
) |
Solve the given problem. The function problem(int, int) needs to be called before calling this function.
TQ | Matrix type. Either a dense or compressed sparse matrix (or a reference to it). |
TA | Matrix type. Either a dense or compressed sparse matrix (or a reference to it). |
Q | Quadratic part of the cost. |
c | Linear part of the cost. |
A | Constraint matrix. |
AL | Lower bound of the constraints. |
AU | Upper bound of the constraints. |
References Eigen::CSCMatrix::matrix(), Eigen::CSCMatrix::updateDefault(), and Eigen::CSCMatrix::updateTriangularDefault().
bool Eigen::OSQP::solve | ( | const TQ & | Q, |
const VectorConstRef & | c | ||
) |
Solve unconstrained problem. The function problem(int, int) needs to be called before calling this function.
TQ | Matrix type. Either a dense or compressed sparse matrix (or a reference to it). |
Q | Quadratic part of the cost. |
c | Linear part of the cost. |
References Eigen::CSCMatrix::matrix(), and Eigen::CSCMatrix::updateTriangularDefault().
|
inlinenoexcept |
Get solver status.
|
inlinenoexcept |
Write osqp progress.
|
inlinenoexcept |
|
inlinenoexcept |
Warm start. Default is true.
|
inlinenoexcept |