qpOASES
3.1.1
|
Implements the online active set strategy for box-constrained QPs. More...
#include <QProblemB.hpp>
Public Member Functions | |
QProblemB () | |
QProblemB (int _nV, HessianType _hessianType=HST_UNKNOWN) | |
QProblemB (const QProblemB &rhs) | |
virtual | ~QProblemB () |
QProblemB & | operator= (const QProblemB &rhs) |
virtual returnValue | reset () |
returnValue | init (SymmetricMatrix *_H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub, int &nWSR, real_t *const cputime=0, const real_t *const xOpt=0, const real_t *const yOpt=0, const Bounds *const guessedBounds=0, const real_t *const _R=0) |
returnValue | init (const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub, int &nWSR, real_t *const cputime=0, const real_t *const xOpt=0, const real_t *const yOpt=0, const Bounds *const guessedBounds=0, const real_t *const _R=0) |
returnValue | init (const char *const H_file, const char *const g_file, const char *const lb_file, const char *const ub_file, int &nWSR, real_t *const cputime=0, const real_t *const xOpt=0, const real_t *const yOpt=0, const Bounds *const guessedBounds=0, const char *const R_file=0) |
returnValue | hotstart (const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime=0, const Bounds *const guessedBounds=0) |
returnValue | hotstart (const char *const g_file, const char *const lb_file, const char *const ub_file, int &nWSR, real_t *const cputime=0, const Bounds *const guessedBounds=0) |
virtual returnValue | getWorkingSet (real_t *workingSet) |
virtual returnValue | getWorkingSetBounds (real_t *workingSetB) |
virtual returnValue | getWorkingSetConstraints (real_t *workingSetC) |
returnValue | getBounds (Bounds &_bounds) const |
int | getNV () const |
int | getNFR () const |
int | getNFX () const |
int | getNFV () const |
virtual int | getNZ () const |
real_t | getObjVal () const |
real_t | getObjVal (const real_t *const _x) const |
returnValue | getPrimalSolution (real_t *const xOpt) const |
virtual returnValue | getDualSolution (real_t *const yOpt) const |
QProblemStatus | getStatus () const |
BooleanType | isInitialised () const |
BooleanType | isSolved () const |
BooleanType | isInfeasible () const |
BooleanType | isUnbounded () const |
HessianType | getHessianType () const |
returnValue | setHessianType (HessianType _hessianType) |
BooleanType | usingRegularisation () const |
Options | getOptions () const |
returnValue | setOptions (const Options &_options) |
PrintLevel | getPrintLevel () const |
returnValue | setPrintLevel (PrintLevel _printlevel) |
unsigned int | getCount () const |
returnValue | resetCounter () |
virtual returnValue | printProperties () |
returnValue | printOptions () const |
Protected Member Functions | |
returnValue | clear () |
returnValue | copy (const QProblemB &rhs) |
returnValue | determineHessianType () |
virtual returnValue | setupSubjectToType () |
virtual returnValue | setupSubjectToType (const real_t *const lb_new, const real_t *const ub_new) |
returnValue | computeCholesky () |
virtual returnValue | setupInitialCholesky () |
returnValue | obtainAuxiliaryWorkingSet (const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, Bounds *auxiliaryBounds) const |
returnValue | areBoundsConsistent (const real_t *const lb, const real_t *const ub) const |
returnValue | backsolveR (const real_t *const b, BooleanType transposed, real_t *const a) const |
returnValue | backsolveR (const real_t *const b, BooleanType transposed, BooleanType removingBound, real_t *const a) const |
returnValue | determineDataShift (const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, real_t *const delta_g, real_t *const delta_lb, real_t *const delta_ub, BooleanType &Delta_bB_isZero) |
returnValue | setupQPdata (SymmetricMatrix *_H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub) |
returnValue | setupQPdata (const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub) |
returnValue | setupQPdataFromFile (const char *const H_file, const char *const g_file, const char *const lb_file, const char *const ub_file) |
returnValue | loadQPvectorsFromFile (const char *const g_file, const char *const lb_file, const char *const ub_file, real_t *const g_new, real_t *const lb_new, real_t *const ub_new) const |
returnValue | setInfeasibilityFlag (returnValue returnvalue, BooleanType doThrowError=BT_FALSE) |
BooleanType | isCPUtimeLimitExceeded (const real_t *const cputime, real_t starttime, int nWSR) const |
returnValue | regulariseHessian () |
returnValue | setH (SymmetricMatrix *H_new) |
returnValue | setH (const real_t *const H_new) |
returnValue | setG (const real_t *const g_new) |
returnValue | setLB (const real_t *const lb_new) |
returnValue | setLB (int number, real_t value) |
returnValue | setUB (const real_t *const ub_new) |
returnValue | setUB (int number, real_t value) |
void | computeGivens (real_t xold, real_t yold, real_t &xnew, real_t &ynew, real_t &c, real_t &s) const |
void | applyGivens (real_t c, real_t s, real_t nu, real_t xold, real_t yold, real_t &xnew, real_t &ynew) const |
real_t | getRelativeHomotopyLength (const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new) |
virtual returnValue | performRamping () |
returnValue | updateFarBounds (real_t curFarBound, int nRamp, const real_t *const lb_new, real_t *const lb_new_far, const real_t *const ub_new, real_t *const ub_new_far) const |
returnValue | performRatioTest (int nIdx, const int *const idxList, const SubjectTo *const subjectTo, const real_t *const num, const real_t *const den, real_t epsNum, real_t epsDen, real_t &t, int &BC_idx) const |
BooleanType | isBlocking (real_t num, real_t den, real_t epsNum, real_t epsDen, real_t &t) const |
SymSparseMat * | createDiagSparseMat (int n, real_t diagVal=1.0) |
virtual returnValue | setupAuxiliaryQP (const Bounds *const guessedBounds) |
Protected Attributes | |
BooleanType | freeHessian |
SymmetricMatrix * | H |
real_t * | g |
real_t * | lb |
real_t * | ub |
Bounds | bounds |
real_t * | R |
BooleanType | haveCholesky |
real_t * | x |
real_t * | y |
real_t | tau |
QProblemStatus | status |
BooleanType | infeasible |
BooleanType | unbounded |
HessianType | hessianType |
real_t | regVal |
unsigned int | count |
real_t * | delta_xFR_TMP |
real_t | ramp0 |
real_t | ramp1 |
int | rampOffset |
Options | options |
Flipper | flipper |
TabularOutput | tabularOutput |
Private Member Functions | |
returnValue | solveInitialQP (const real_t *const xOpt, const real_t *const yOpt, const Bounds *const guessedBounds, const real_t *const _R, int &nWSR, real_t *const cputime) |
returnValue | solveQP (const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime, int nWSRperformed=0, BooleanType isFirstCall=BT_TRUE) |
returnValue | solveRegularisedQP (const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime, int nWSRperformed=0, BooleanType isFirstCall=BT_TRUE) |
returnValue | setupAuxiliaryWorkingSet (const Bounds *const auxiliaryBounds, BooleanType setupAfresh) |
returnValue | setupAuxiliaryQPsolution (const real_t *const xOpt, const real_t *const yOpt) |
returnValue | setupAuxiliaryQPgradient () |
returnValue | setupAuxiliaryQPbounds (BooleanType useRelaxation) |
returnValue | determineStepDirection (const real_t *const delta_g, const real_t *const delta_lb, const real_t *const delta_ub, BooleanType Delta_bB_isZero, real_t *const delta_xFX, real_t *const delta_xFR, real_t *const delta_yFX) |
returnValue | performStep (const real_t *const delta_g, const real_t *const delta_lb, const real_t *const delta_ub, const real_t *const delta_xFX, const real_t *const delta_xFR, const real_t *const delta_yFX, int &BC_idx, SubjectToStatus &BC_status) |
returnValue | changeActiveSet (int BC_idx, SubjectToStatus BC_status) |
virtual returnValue | performDriftCorrection () |
BooleanType | shallRefactorise (const Bounds *const guessedBounds) const |
returnValue | addBound (int number, SubjectToStatus B_status, BooleanType updateCholesky) |
returnValue | removeBound (int number, BooleanType updateCholesky) |
returnValue | printIteration (int iter, int BC_idx, SubjectToStatus BC_status, real_t homotopyLength, BooleanType isFirstCall=BT_TRUE) |
Friends | |
class | SolutionAnalysis |
Class for setting up and solving quadratic programs with bounds (= box constraints) only. The main feature is the possibily to use the newly developed online active set strategy for parametric quadratic programming.
Default constructor.
References BT_FALSE, count, delta_xFR_TMP, Options::finalRamping, freeHessian, g, getGlobalMessageHandler(), H, haveCholesky, hessianType, HST_UNKNOWN, infeasible, Options::initialRamping, lb, options, PL_NONE, printCopyrightNotice(), Options::printLevel, QPS_NOTINITIALISED, R, ramp0, ramp1, rampOffset, regVal, MessageHandling::reset(), setPrintLevel(), status, tau, ub, unbounded, x, and y.
QProblemB::QProblemB | ( | int | _nV, |
HessianType | _hessianType = HST_UNKNOWN |
||
) |
Constructor which takes the QP dimension and Hessian type information. If the Hessian is the zero (i.e. HST_ZERO) or the identity matrix (i.e. HST_IDENTITY), respectively, no memory is allocated for it and a NULL pointer can be passed for it to the init() functions.
_nV | Number of variables. |
_hessianType | Type of Hessian matrix. |
References bounds, BT_FALSE, count, delta_xFR_TMP, Options::finalRamping, flipper, freeHessian, g, getGlobalMessageHandler(), H, haveCholesky, hessianType, infeasible, Bounds::init(), Flipper::init(), Options::initialRamping, lb, options, PL_NONE, printCopyrightNotice(), Options::printLevel, QPS_NOTINITIALISED, R, ramp0, ramp1, rampOffset, real_t, regVal, MessageHandling::reset(), RET_INVALID_ARGUMENTS, setPrintLevel(), status, tau, THROWERROR, ub, unbounded, x, and y.
QProblemB::QProblemB | ( | const QProblemB & | rhs | ) |
Copy constructor (deep copy).
rhs | Rhs object. |
References BT_FALSE, copy(), freeHessian, and H.
QProblemB::~QProblemB | ( | ) | [virtual] |
Destructor.
References clear(), getGlobalMessageHandler(), and MessageHandling::reset().
returnValue QProblemB::addBound | ( | int | number, |
SubjectToStatus | B_status, | ||
BooleanType | updateCholesky | ||
) | [private] |
Adds a bound to active set (specialised version for the case where no constraints exist).
number | Number of bound to be added to active set. |
B_status | Status of new active bound. |
updateCholesky | Flag indicating if Cholesky decomposition shall be updated. |
References applyGivens(), bounds, BT_TRUE, computeGivens(), Bounds::getFree(), Indexlist::getIndex(), getNFR(), getNV(), getStatus(), hessianType, HST_IDENTITY, HST_ZERO, TabularOutput::idxAddB, Bounds::moveFreeToFixed(), QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_NOTINITIALISED, QPS_PREPARINGAUXILIARYQP, QPS_SOLVED, real_t, RET_ADDBOUND_FAILED, RET_UNKNOWN_BUG, RR, SUCCESSFUL_RETURN, tabularOutput, and THROWERROR.
Referenced by changeActiveSet(), and setupAuxiliaryWorkingSet().
void QProblemB::applyGivens | ( | real_t | c, |
real_t | s, | ||
real_t | nu, | ||
real_t | xold, | ||
real_t | yold, | ||
real_t & | xnew, | ||
real_t & | ynew | ||
) | const [inline, protected] |
Applies Givens matrix determined by c and s (cf. computeGivens).
c | Cosine entry of Givens matrix. |
s | Sine entry of Givens matrix. |
nu | Further factor: s/(1+c). |
xold | Matrix entry to be transformed corresponding to the normalised entry of the original matrix. |
yold | Matrix entry to be transformed corresponding to the annihilated entry of the original matrix. |
xnew | Output: Transformed matrix entry corresponding to the normalised entry of the original matrix. |
ynew | Output: Transformed matrix entry corresponding to the annihilated entry of the original matrix. |
Referenced by QProblem::addBound(), addBound(), QProblem::addConstraint(), QProblem::removeBound(), and QProblem::removeConstraint().
returnValue QProblemB::areBoundsConsistent | ( | const real_t *const | lb, |
const real_t *const | ub | ||
) | const [protected] |
Decides if lower bounds are smaller than upper bounds
lb | Vector of lower bounds |
ub | Vector of upper bounds |
References EPS, getNV(), RET_QP_INFEASIBLE, and SUCCESSFUL_RETURN.
Referenced by QProblem::areBoundsConsistent(), and hotstart().
returnValue QProblemB::backsolveR | ( | const real_t *const | b, |
BooleanType | transposed, | ||
real_t *const | a | ||
) | const [protected] |
Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix.
b | Right hand side vector. |
transposed | Indicates if the transposed system shall be solved. |
a | Output: Solution vector |
References BT_FALSE.
Referenced by QProblem::determineStepDirection(), determineStepDirection(), QProblem::removeBound(), removeBound(), and QProblem::removeConstraint().
returnValue QProblemB::backsolveR | ( | const real_t *const | b, |
BooleanType | transposed, | ||
BooleanType | removingBound, | ||
real_t *const | a | ||
) | const [protected] |
Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix.
Special variant for the case that this function is called from within "removeBound()".
b | Right hand side vector. |
transposed | Indicates if the transposed system shall be solved. |
removingBound | Indicates if function is called from "removeBound()". |
a | Output: Solution vector |
References BT_FALSE, BT_TRUE, getAbs(), getNV(), getNZ(), real_t, RET_DIV_BY_ZERO, RR, SUCCESSFUL_RETURN, THROWERROR, and ZERO.
returnValue QProblemB::changeActiveSet | ( | int | BC_idx, |
SubjectToStatus | BC_status | ||
) | [private] |
Updates active set.
BC_idx | Index of blocking constraint. |
BC_status | Status of blocking constraint. |
References __FILE__, __FUNC__, __LINE__, addBound(), BT_TRUE, getGlobalMessageHandler(), MAX_STRING_LENGTH, removeBound(), RET_ADD_TO_ACTIVESET, RET_ADD_TO_ACTIVESET_FAILED, RET_OPTIMAL_SOLUTION_FOUND, RET_REMOVE_FROM_ACTIVESET, RET_REMOVE_FROM_ACTIVESET_FAILED, ST_INACTIVE, ST_LOWER, ST_UNDEFINED, SUCCESSFUL_RETURN, THROWERROR, MessageHandling::throwInfo(), VS_VISIBLE, and y.
Referenced by solveQP().
returnValue QProblemB::clear | ( | ) | [protected] |
Frees all allocated memory.
Reimplemented in QProblem.
References BT_TRUE, delta_xFR_TMP, freeHessian, g, H, lb, R, SUCCESSFUL_RETURN, ub, x, and y.
Referenced by operator=(), and ~QProblemB().
returnValue QProblemB::computeCholesky | ( | ) | [protected] |
Computes the Cholesky decomposition of the (simply projected) Hessian (i.e. R^T*R = Z^T*H*Z). It only works in the case where Z is a simple projection matrix! Note: If Hessian turns out not to be positive definite, the Hessian type is set to HST_SEMIDEF accordingly.
References bounds, BT_TRUE, Options::epsRegularisation, getAbs(), Matrix::getCol(), Bounds::getFree(), getMin(), getNFR(), Indexlist::getNumberArray(), getNV(), getSqrt(), H, hessianType, HST_IDENTITY, HST_SEMIDEF, HST_ZERO, options, POTRF, R, regVal, RET_CHOLESKY_OF_ZERO_HESSIAN, RET_HESSIAN_NOT_SPD, RR, SUCCESSFUL_RETURN, THROWERROR, and usingRegularisation().
Referenced by QProblem::computeProjectedCholesky(), setupAuxiliaryQP(), setupInitialCholesky(), and solveQP().
void QProblemB::computeGivens | ( | real_t | xold, |
real_t | yold, | ||
real_t & | xnew, | ||
real_t & | ynew, | ||
real_t & | c, | ||
real_t & | s | ||
) | const [inline, protected] |
Computes parameters for the Givens matrix G for which [x,y]*G = [z,0]
xold | Matrix entry to be normalised. |
yold | Matrix entry to be annihilated. |
xnew | Output: Normalised matrix entry. |
ynew | Output: Annihilated matrix entry. |
c | Output: Cosine entry of Givens matrix. |
s | Output: Sine entry of Givens matrix. |
References BT_TRUE, getAbs(), getSqrt(), isZero(), and real_t.
Referenced by QProblem::addBound(), addBound(), QProblem::addConstraint(), QProblem::removeBound(), and QProblem::removeConstraint().
returnValue QProblemB::copy | ( | const QProblemB & | rhs | ) | [protected] |
Copies all members from given rhs object.
rhs | Rhs object. |
References bounds, BT_TRUE, count, delta_xFR_TMP, SymmetricMatrix::duplicateSym(), flipper, freeHessian, g, getNV(), H, haveCholesky, hessianType, infeasible, lb, options, Options::printLevel, R, ramp0, ramp1, real_t, regVal, setG(), setLB(), setPrintLevel(), setUB(), status, SUCCESSFUL_RETURN, tau, ub, unbounded, x, and y.
Referenced by operator=(), and QProblemB().
SymSparseMat * QProblemB::createDiagSparseMat | ( | int | n, |
real_t | diagVal = 1.0 |
||
) | [protected] |
Creates a sparse diagonal (square-)matrix which is a given multiple of the identity matrix.
n | Row/column dimension of matrix to be created. |
diagVal | Value of all diagonal entries. |
References SparseMatrix::createDiagInfo(), Matrix::doFreeMemory(), real_t, and sparse_int_t.
Referenced by QProblem::computeProjectedCholesky().
returnValue QProblemB::determineDataShift | ( | const real_t *const | g_new, |
const real_t *const | lb_new, | ||
const real_t *const | ub_new, | ||
real_t *const | delta_g, | ||
real_t *const | delta_lb, | ||
real_t *const | delta_ub, | ||
BooleanType & | Delta_bB_isZero | ||
) | [protected] |
Determines step direction of the shift of the QP data.
g_new | New gradient vector. |
lb_new | New lower bounds. |
ub_new | New upper bounds. |
delta_g | Output: Step direction of gradient vector. |
delta_lb | Output: Step direction of lower bounds. |
delta_ub | Output: Step direction of upper bounds. |
Delta_bB_isZero | Output: Indicates if active bounds are to be shifted. |
References bounds, BT_FALSE, BT_TRUE, EPS, g, getAbs(), Bounds::getFixed(), getNFX(), Indexlist::getNumberArray(), getNV(), INFTY, lb, SUCCESSFUL_RETURN, and ub.
Referenced by solveQP().
returnValue QProblemB::determineHessianType | ( | ) | [protected] |
If Hessian type has been set by the user, nothing is done. Otherwise the Hessian type is set to HST_IDENTITY, HST_ZERO, or HST_POSDEF (default), respectively.
References BT_FALSE, BT_TRUE, Matrix::diag(), Options::enableFlippingBounds, Options::enableRegularisation, EPS, getAbs(), getNV(), H, hessianType, HST_IDENTITY, HST_INDEF, HST_POSDEF, HST_POSDEF_NULLSPACE, HST_SEMIDEF, HST_ZERO, INFTY, Matrix::isDiag(), isZero(), Options::numRegularisationSteps, options, real_t, RET_DIAGONAL_NOT_INITIALISED, RET_HESSIAN_INDEFINITE, RET_ZERO_HESSIAN_ASSUMED, SUCCESSFUL_RETURN, THROWERROR, THROWINFO, and ZERO.
Referenced by SQProblem::setupNewAuxiliaryQP(), QProblem::solveInitialQP(), and solveInitialQP().
returnValue QProblemB::determineStepDirection | ( | const real_t *const | delta_g, |
const real_t *const | delta_lb, | ||
const real_t *const | delta_ub, | ||
BooleanType | Delta_bB_isZero, | ||
real_t *const | delta_xFX, | ||
real_t *const | delta_xFR, | ||
real_t *const | delta_yFX | ||
) | [private] |
Determines step direction of the homotopy path.
delta_g | Step direction of gradient vector. |
delta_lb | Step direction of lower bounds. |
delta_ub | Step direction of upper bounds. |
Delta_bB_isZero | Indicates if active bounds are to be shifted. |
delta_xFX | Output: Primal homotopy step direction of fixed variables. |
delta_xFR | Output: Primal homotopy step direction of free variables. |
delta_yFX | Output: Dual homotopy step direction of fixed variables' multiplier. |
References backsolveR(), bounds, BT_FALSE, BT_TRUE, delta_xFR_TMP, Options::epsIterRef, getAbs(), Bounds::getFixed(), Bounds::getFree(), getNFR(), getNFX(), Indexlist::getNumberArray(), SubjectTo::getStatus(), H, hessianType, HST_IDENTITY, HST_ZERO, Options::numRefinementSteps, options, real_t, regVal, RET_STEPDIRECTION_FAILED_CHOLESKY, ST_LOWER, SUCCESSFUL_RETURN, THROWERROR, Matrix::times(), and usingRegularisation().
Referenced by solveQP().
BEGIN_NAMESPACE_QPOASES returnValue QProblemB::getBounds | ( | Bounds & | _bounds | ) | const [inline] |
Returns current bounds object of the QP (deep copy).
_bounds | Output: Bounds object. |
References bounds, getNV(), RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, and THROWERROR.
unsigned int QProblemB::getCount | ( | ) | const [inline] |
Returns the current number of QP problems solved.
References count.
returnValue QProblemB::getDualSolution | ( | real_t *const | yOpt | ) | const [virtual] |
Returns the dual solution vector.
yOpt | Output: Dual solution vector (if QP has been solved). |
Reimplemented in QProblem.
References getNV(), getStatus(), QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_SOLVED, RET_QP_NOT_SOLVED, SUCCESSFUL_RETURN, and y.
Referenced by solveOQPbenchmark().
HessianType QProblemB::getHessianType | ( | ) | const [inline] |
Returns Hessian type flag (type is not determined due to this call!).
References hessianType.
Referenced by SolutionAnalysis::getKktViolation().
int QProblemB::getNFR | ( | ) | const [inline] |
Returns the number of free variables.
References bounds, and Bounds::getNFR().
Referenced by QProblem::addBound(), addBound(), QProblem::addBound_checkLI(), QProblem::addConstraint(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), computeCholesky(), QProblem::computeProjectedCholesky(), QProblem::determineStepDirection(), determineStepDirection(), QProblem::ensureNonzeroCurvature(), getNZ(), QProblem::getNZ(), SolutionAnalysis::getVarianceCovariance(), QProblem::performStep(), performStep(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), setupInitialCholesky(), QProblem::setupInitialCholesky(), QProblem::setupTQfactorisation(), QProblem::solveCurrentEQP(), and QProblem::writeQpWorkspaceIntoMatFile().
int QProblemB::getNFV | ( | ) | const [inline] |
Returns the number of implicitly fixed variables.
References bounds, and Bounds::getNFV().
Referenced by setupInitialCholesky(), and QProblem::setupInitialCholesky().
int QProblemB::getNFX | ( | ) | const [inline] |
Returns the number of fixed variables.
References bounds, and Bounds::getNFX().
Referenced by QProblem::addBound_checkLI(), QProblem::addBound_ensureLI(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), QProblem::computeProjectedCholesky(), determineDataShift(), QProblem::determineStepDirection(), determineStepDirection(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), SolutionAnalysis::getVarianceCovariance(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblem::solveCurrentEQP(), and QProblem::writeQpWorkspaceIntoMatFile().
int QProblemB::getNV | ( | ) | const [inline] |
Returns the number of variables.
References bounds, and Bounds::getNV().
Referenced by QProblem::addBound(), addBound(), QProblem::addBound_checkLI(), QProblem::addBound_ensureLI(), QProblem::addConstraint(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), areBoundsConsistent(), backsolveR(), QProblem::changeActiveSet(), computeCholesky(), QProblem::computeProjectedCholesky(), QProblem::copy(), copy(), determineDataShift(), determineHessianType(), QProblem::determineStepDirection(), QProblem::ensureNonzeroCurvature(), getBounds(), QProblem::getConstraints(), getDualSolution(), QProblem::getDualSolution(), SolutionAnalysis::getKktViolation(), getObjVal(), getPrimalSolution(), getRelativeHomotopyLength(), SolutionAnalysis::getVarianceCovariance(), QProblem::getWorkingSet(), getWorkingSetBounds(), SQProblem::hotstart(), hotstart(), QProblem::hotstart(), init(), QProblem::init(), loadQPvectorsFromFile(), obtainAuxiliaryWorkingSet(), QProblem::obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblem::printProperties(), printProperties(), regulariseHessian(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), QProblem::reset(), reset(), QProblem::setA(), setG(), setH(), setLB(), QProblem::setLBA(), setUB(), QProblem::setUBA(), QProblem::setupAuxiliaryQP(), setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), QProblem::setupAuxiliaryQPsolution(), setupAuxiliaryQPsolution(), QProblem::setupAuxiliaryWorkingSet(), setupAuxiliaryWorkingSet(), setupInitialCholesky(), QProblem::setupInitialCholesky(), SQProblem::setupNewAuxiliaryQP(), setupQPdataFromFile(), QProblem::setupQPdataFromFile(), setupSubjectToType(), QProblem::setupTQfactorisation(), QProblem::shallRefactorise(), shallRefactorise(), QProblem::solveCurrentEQP(), QProblem::solveInitialQP(), solveInitialQP(), QProblem::solveQP(), solveQP(), QProblem::solveRegularisedQP(), solveRegularisedQP(), updateFarBounds(), QProblem::updateFarBounds(), QProblem::writeQpDataIntoMatFile(), and QProblem::writeQpWorkspaceIntoMatFile().
int QProblemB::getNZ | ( | ) | const [virtual] |
Returns the dimension of null space.
Reimplemented in QProblem.
References getNFR().
Referenced by backsolveR().
real_t QProblemB::getObjVal | ( | ) | const |
Returns the optimal objective function value.
References getStatus(), INFTY, QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_SOLVED, real_t, and x.
Referenced by main().
real_t QProblemB::getObjVal | ( | const real_t *const | _x | ) | const |
Returns the objective function value at an arbitrary point x.
_x | Point at which the objective function shall be evaluated. |
References BT_TRUE, g, getNV(), H, hessianType, HST_IDENTITY, HST_ZERO, real_t, regVal, Matrix::times(), and usingRegularisation().
Options QProblemB::getOptions | ( | ) | const [inline] |
returnValue QProblemB::getPrimalSolution | ( | real_t *const | xOpt | ) | const |
Returns the primal solution vector.
xOpt | Output: Primal solution vector (if QP has been solved). |
References getNV(), getStatus(), QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_SOLVED, RET_QP_NOT_SOLVED, SUCCESSFUL_RETURN, and x.
Referenced by main(), and solveOQPbenchmark().
PrintLevel QProblemB::getPrintLevel | ( | ) | const [inline] |
real_t QProblemB::getRelativeHomotopyLength | ( | const real_t *const | g_new, |
const real_t *const | lb_new, | ||
const real_t *const | ub_new | ||
) | [protected] |
QProblemStatus QProblemB::getStatus | ( | ) | const [inline] |
Returns status of the solution process.
References status.
Referenced by QProblem::addBound(), addBound(), QProblem::addConstraint(), getDualSolution(), QProblem::getDualSolution(), getObjVal(), getPrimalSolution(), SQProblem::hotstart(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), SQProblem::setupNewAuxiliaryQP(), QProblem::solveQP(), and solveQP().
returnValue QProblemB::getWorkingSet | ( | real_t * | workingSet | ) | [virtual] |
Writes a vector with the state of the working set
workingSet | Output: array containing state of the working set. |
Reimplemented in QProblem.
References getWorkingSetBounds().
returnValue QProblemB::getWorkingSetBounds | ( | real_t * | workingSetB | ) | [virtual] |
Writes a vector with the state of the working set of bounds
workingSetB | Output: array containing state of the working set of bounds. |
Reimplemented in QProblem.
References bounds, getNV(), SubjectTo::getStatus(), RET_INVALID_ARGUMENTS, ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by SolutionAnalysis::getKktViolation(), and getWorkingSet().
returnValue QProblemB::getWorkingSetConstraints | ( | real_t * | workingSetC | ) | [virtual] |
Writes a vector with the state of the working set of constraints
workingSetC | Output: array containing state of the working set of constraints. |
Reimplemented in QProblem.
References RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and THROWERROR.
returnValue QProblemB::hotstart | ( | const real_t *const | g_new, |
const real_t *const | lb_new, | ||
const real_t *const | ub_new, | ||
int & | nWSR, | ||
real_t *const | cputime = 0 , |
||
const Bounds *const | guessedBounds = 0 |
||
) |
Solves an initialised QP sequence using the online active set strategy. By default, QP solution is started from previous solution. If a guess for the working set is provided, an initialised homotopy is performed.
Note: This function internally calls solveQP/solveRegularisedQP for solving an initialised QP!
g_new | Gradient of neighbouring QP to be solved. |
lb_new | Lower bounds of neighbouring QP to be solved. If no lower bounds exist, a NULL pointer can be passed. |
ub_new | Upper bounds of neighbouring QP to be solved. If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations; Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP solution. Output: CPU time spent for QP solution (or to perform nWSR iterations). |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). (If a null pointer is passed, the previous working set is kept!) |
References areBoundsConsistent(), Options::boundTolerance, BT_FALSE, BT_TRUE, count, Options::enableFarBounds, getAbs(), getCPUtime(), getNV(), Options::growFarBounds, haveCholesky, infeasible, INFTY, Options::initialFarBounds, options, QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_SOLVED, rampOffset, real_t, RET_HOTSTART_STOPPED_INFEASIBILITY, RET_HOTSTART_STOPPED_UNBOUNDEDNESS, RET_QPOBJECT_NOT_SETUP, RET_SETUP_AUXILIARYQP_FAILED, setInfeasibilityFlag(), setupAuxiliaryQP(), setupInitialCholesky(), solveRegularisedQP(), status, SUCCESSFUL_RETURN, THROWERROR, unbounded, updateFarBounds(), and x.
Referenced by hotstart(), main(), solveInitialQP(), and solveOQPbenchmark().
returnValue QProblemB::hotstart | ( | const char *const | g_file, |
const char *const | lb_file, | ||
const char *const | ub_file, | ||
int & | nWSR, | ||
real_t *const | cputime = 0 , |
||
const Bounds *const | guessedBounds = 0 |
||
) |
Solves an initialised QP sequence using the online active set strategy, where QP data is read from files. By default, QP solution is started from previous solution. If a guess for the working set is provided, an initialised homotopy is performed.
Note: This function internally calls solveQP/solveRegularisedQP for solving an initialised QP!
g_file | Name of file where gradient, of neighbouring QP to be solved, is stored. |
lb_file | Name of file where lower bounds, of neighbouring QP to be solved, is stored. If no lower bounds exist, a NULL pointer can be passed. |
ub_file | Name of file where upper bounds, of neighbouring QP to be solved, is stored. If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations; Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP solution. Output: CPU time spent for QP solution (or to perform nWSR iterations). |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). (If a null pointer is passed, the previous working set is kept!) |
References getNV(), hotstart(), loadQPvectorsFromFile(), real_t, RET_INVALID_ARGUMENTS, RET_QPOBJECT_NOT_SETUP, RET_UNABLE_TO_READ_FILE, SUCCESSFUL_RETURN, and THROWERROR.
returnValue QProblemB::init | ( | SymmetricMatrix * | _H, |
const real_t *const | _g, | ||
const real_t *const | _lb, | ||
const real_t *const | _ub, | ||
int & | nWSR, | ||
real_t *const | cputime = 0 , |
||
const real_t *const | xOpt = 0 , |
||
const real_t *const | yOpt = 0 , |
||
const Bounds *const | guessedBounds = 0 , |
||
const real_t *const | _R = 0 |
||
) |
Initialises a simply bounded QP problem with given QP data and tries to solve it using at most nWSR iterations. Depending on the parameter constellation it:
1. 0, 0, 0 : starts with xOpt = 0, yOpt = 0 and gB empty (or all implicit equality bounds),
2. xOpt, 0, 0 : starts with xOpt, yOpt = 0 and obtain gB by "clipping",
3. 0, yOpt, 0 : starts with xOpt = 0, yOpt and obtain gB from yOpt != 0,
4. 0, 0, gB: starts with xOpt = 0, yOpt = 0 and gB,
5. xOpt, yOpt, 0 : starts with xOpt, yOpt and obtain gB from yOpt != 0,
6. xOpt, 0, gB: starts with xOpt, yOpt = 0 and gB,
7. xOpt, yOpt, gB: starts with xOpt, yOpt and gB (assume them to be consistent!)
Note: This function internally calls solveInitialQP for initialisation!
_H | Hessian matrix (a shallow copy is made). |
_g | Gradient vector. |
_lb | Lower bounds (on variables). If no lower bounds exist, a NULL pointer can be passed. |
_ub | Upper bounds (on variables). If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations when using initial homotopy. Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP initialisation. Output: CPU time spent for QP initialisation (if pointer passed). |
xOpt | Optimal primal solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old primal solution is kept!) |
yOpt | Optimal dual solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old dual solution is kept!) |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). (If a null pointer is passed, all bounds are assumed inactive!) |
_R | Pre-computed (upper triangular) Cholesky factor of Hessian matrix. The Cholesky factor must be stored in a real_t array of size nV*nV in row-major format. Note: Only used if xOpt/yOpt and gB are NULL! (If a null pointer is passed, Cholesky decomposition is computed internally!) |
References BT_TRUE, getNV(), SubjectTo::getStatus(), isInitialised(), reset(), RET_INVALID_ARGUMENTS, RET_NO_CHOLESKY_WITH_INITIAL_GUESS, RET_QP_ALREADY_INITIALISED, RET_QPOBJECT_NOT_SETUP, setupQPdata(), solveInitialQP(), ST_UNDEFINED, SUCCESSFUL_RETURN, THROWERROR, and THROWWARNING.
Referenced by main(), and solveOQPbenchmark().
returnValue QProblemB::init | ( | const real_t *const | _H, |
const real_t *const | _g, | ||
const real_t *const | _lb, | ||
const real_t *const | _ub, | ||
int & | nWSR, | ||
real_t *const | cputime = 0 , |
||
const real_t *const | xOpt = 0 , |
||
const real_t *const | yOpt = 0 , |
||
const Bounds *const | guessedBounds = 0 , |
||
const real_t *const | _R = 0 |
||
) |
Initialises a simply bounded QP problem with given QP data and tries to solve it using at most nWSR iterations. Depending on the parameter constellation it:
1. 0, 0, 0 : starts with xOpt = 0, yOpt = 0 and gB empty (or all implicit equality bounds),
2. xOpt, 0, 0 : starts with xOpt, yOpt = 0 and obtain gB by "clipping",
3. 0, yOpt, 0 : starts with xOpt = 0, yOpt and obtain gB from yOpt != 0,
4. 0, 0, gB: starts with xOpt = 0, yOpt = 0 and gB,
5. xOpt, yOpt, 0 : starts with xOpt, yOpt and obtain gB from yOpt != 0,
6. xOpt, 0, gB: starts with xOpt, yOpt = 0 and gB,
7. xOpt, yOpt, gB: starts with xOpt, yOpt and gB (assume them to be consistent!)
Note: This function internally calls solveInitialQP for initialisation!
_H | Hessian matrix (a shallow copy is made). If Hessian matrix is trivial, a NULL pointer can be passed. |
_g | Gradient vector. |
_lb | Lower bounds (on variables). If no lower bounds exist, a NULL pointer can be passed. |
_ub | Upper bounds (on variables). If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations when using initial homotopy. Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP initialisation. Output: CPU time spent for QP initialisation (if pointer passed). |
xOpt | Optimal primal solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old primal solution is kept!) |
yOpt | Optimal dual solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old dual solution is kept!) |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). (If a null pointer is passed, all bounds are assumed inactive!) |
_R | Pre-computed (upper triangular) Cholesky factor of Hessian matrix. The Cholesky factor must be stored in a real_t array of size nV*nV in row-major format. Note: Only used if xOpt/yOpt and gB are NULL! (If a null pointer is passed, Cholesky decomposition is computed internally!) |
References BT_TRUE, getNV(), SubjectTo::getStatus(), isInitialised(), reset(), RET_INVALID_ARGUMENTS, RET_NO_CHOLESKY_WITH_INITIAL_GUESS, RET_QP_ALREADY_INITIALISED, RET_QPOBJECT_NOT_SETUP, setupQPdata(), solveInitialQP(), ST_UNDEFINED, SUCCESSFUL_RETURN, THROWERROR, and THROWWARNING.
returnValue QProblemB::init | ( | const char *const | H_file, |
const char *const | g_file, | ||
const char *const | lb_file, | ||
const char *const | ub_file, | ||
int & | nWSR, | ||
real_t *const | cputime = 0 , |
||
const real_t *const | xOpt = 0 , |
||
const real_t *const | yOpt = 0 , |
||
const Bounds *const | guessedBounds = 0 , |
||
const char *const | R_file = 0 |
||
) |
Initialises a simply bounded QP problem with given QP data to be read from files and solves it using at most nWSR iterations. Depending on the parameter constellation it:
1. 0, 0, 0 : starts with xOpt = 0, yOpt = 0 and gB empty (or all implicit equality bounds),
2. xOpt, 0, 0 : starts with xOpt, yOpt = 0 and obtain gB by "clipping",
3. 0, yOpt, 0 : starts with xOpt = 0, yOpt and obtain gB from yOpt != 0,
4. 0, 0, gB: starts with xOpt = 0, yOpt = 0 and gB,
5. xOpt, yOpt, 0 : starts with xOpt, yOpt and obtain gB from yOpt != 0,
6. xOpt, 0, gB: starts with xOpt, yOpt = 0 and gB,
7. xOpt, yOpt, gB: starts with xOpt, yOpt and gB (assume them to be consistent!)
Note: This function internally calls solveInitialQP for initialisation!
H_file | Name of file where Hessian matrix is stored. If Hessian matrix is trivial, a NULL pointer can be passed. |
g_file | Name of file where gradient vector is stored. |
lb_file | Name of file where lower bound vector. If no lower bounds exist, a NULL pointer can be passed. |
ub_file | Name of file where upper bound vector. If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations when using initial homotopy. Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP initialisation. Output: CPU time spent for QP initialisation (if pointer passed). |
xOpt | Optimal primal solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old primal solution is kept!) |
yOpt | Optimal dual solution vector. A NULL pointer can be passed. (If a null pointer is passed, the old dual solution is kept!) |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). (If a null pointer is passed, all bounds are assumed inactive!) |
R_file | Name of the file where a pre-computed (upper triangular) Cholesky factor of the Hessian matrix is stored. (If a null pointer is passed, Cholesky decomposition is computed internally!) |
References BT_TRUE, getNV(), SubjectTo::getStatus(), isInitialised(), R, readFromFile(), reset(), RET_INVALID_ARGUMENTS, RET_NO_CHOLESKY_WITH_INITIAL_GUESS, RET_QP_ALREADY_INITIALISED, RET_QPOBJECT_NOT_SETUP, RET_UNABLE_TO_READ_FILE, setupQPdataFromFile(), solveInitialQP(), ST_UNDEFINED, SUCCESSFUL_RETURN, THROWERROR, and THROWWARNING.
BooleanType QProblemB::isBlocking | ( | real_t | num, |
real_t | den, | ||
real_t | epsNum, | ||
real_t | epsDen, | ||
real_t & | t | ||
) | const [inline, protected] |
Checks whether given ratio is blocking, i.e. limits the maximum step length along the homotopy path to a value lower than given one.
num | Numerator for performing the ratio test. |
den | Denominator for performing the ratio test. |
epsNum | Numerator tolerance. |
epsDen | Denominator tolerance. |
t | Input: Current maximum step length along the homotopy path, Output: Updated maximum possible step length along the homotopy path. |
References BT_FALSE, and BT_TRUE.
Referenced by performRatioTest().
BooleanType QProblemB::isCPUtimeLimitExceeded | ( | const real_t *const | cputime, |
real_t | starttime, | ||
int | nWSR | ||
) | const [protected] |
Determines if next QP iteration can be performed within given CPU time limit.
cputime | Maximum CPU time allowed for QP solution. |
starttime | Start time of current QP solution. |
nWSR | Number of working set recalculations performed so far. |
References BT_FALSE, BT_TRUE, getCPUtime(), and real_t.
Referenced by QProblem::solveQP(), and solveQP().
BooleanType QProblemB::isInfeasible | ( | ) | const [inline] |
Returns if the QP is infeasible.
References infeasible.
Referenced by QProblem::solveInitialQP(), solveInitialQP(), and QProblem::solveQP().
BooleanType QProblemB::isInitialised | ( | ) | const [inline] |
Returns if the QProblem object is initialised.
References BT_FALSE, BT_TRUE, QPS_NOTINITIALISED, and status.
Referenced by init(), and QProblem::init().
BooleanType QProblemB::isSolved | ( | ) | const [inline] |
BooleanType QProblemB::isUnbounded | ( | ) | const [inline] |
Returns if the QP is unbounded.
References unbounded.
Referenced by QProblem::solveInitialQP(), and solveInitialQP().
returnValue QProblemB::loadQPvectorsFromFile | ( | const char *const | g_file, |
const char *const | lb_file, | ||
const char *const | ub_file, | ||
real_t *const | g_new, | ||
real_t *const | lb_new, | ||
real_t *const | ub_new | ||
) | const [protected] |
Loads new QP vectors from files (internal members are not affected!).
g_file | Name of file where gradient, of neighbouring QP to be solved, is stored. |
lb_file | Name of file where lower bounds, of neighbouring QP to be solved, is stored. If no lower bounds exist, a NULL pointer can be passed. |
ub_file | Name of file where upper bounds, of neighbouring QP to be solved, is stored. If no upper bounds exist, a NULL pointer can be passed. |
g_new | Output: Gradient of neighbouring QP to be solved. |
lb_new | Output: Lower bounds of neighbouring QP to be solved |
ub_new | Output: Upper bounds of neighbouring QP to be solved |
References getNV(), readFromFile(), RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by hotstart().
returnValue QProblemB::obtainAuxiliaryWorkingSet | ( | const real_t *const | xOpt, |
const real_t *const | yOpt, | ||
const Bounds *const | guessedBounds, | ||
Bounds * | auxiliaryBounds | ||
) | const [protected] |
Obtains the desired working set for the auxiliary initial QP in accordance with the user specifications
xOpt | Optimal primal solution vector. If a NULL pointer is passed, all entries are assumed to be zero. |
yOpt | Optimal dual solution vector. If a NULL pointer is passed, all entries are assumed to be zero. |
guessedBounds | Guessed working set for solution (xOpt,yOpt). |
auxiliaryBounds | Input: Allocated bound object. Output: Working set for auxiliary QP. |
References bounds, Options::boundTolerance, EPS, getNV(), SubjectTo::getStatus(), SubjectTo::getType(), Options::initialStatusBounds, lb, options, RET_INVALID_ARGUMENTS, RET_OBTAINING_WORKINGSET_FAILED, Bounds::setupBound(), ST_EQUALITY, ST_INACTIVE, ST_LOWER, ST_UNBOUNDED, ST_UPPER, SUCCESSFUL_RETURN, THROWERROR, and ub.
Referenced by QProblem::obtainAuxiliaryWorkingSet(), and solveInitialQP().
returnValue QProblemB::performDriftCorrection | ( | ) | [private, virtual] |
Drift correction at end of each active set iteration
Reimplemented in QProblem.
References bounds, getMax(), getMin(), getNV(), SubjectTo::getStatus(), SubjectTo::getType(), lb, setupAuxiliaryQPgradient(), ST_BOUNDED, ST_DISABLED, ST_EQUALITY, ST_INACTIVE, ST_INFEASIBLE_LOWER, ST_INFEASIBLE_UPPER, ST_LOWER, ST_UNBOUNDED, ST_UNDEFINED, ST_UNKNOWN, ST_UPPER, ub, x, and y.
Referenced by solveQP().
returnValue QProblemB::performRamping | ( | ) | [protected, virtual] |
Ramping Strategy to avoid ties. Modifies homotopy start without changing current active set.
Reimplemented in QProblem.
References bounds, getNV(), SubjectTo::getStatus(), SubjectTo::getType(), lb, ramp0, ramp1, rampOffset, real_t, setupAuxiliaryQPgradient(), ST_DISABLED, ST_EQUALITY, ST_INACTIVE, ST_LOWER, ST_UNBOUNDED, ST_UPPER, SUCCESSFUL_RETURN, ub, x, and y.
Referenced by solveQP().
returnValue QProblemB::performRatioTest | ( | int | nIdx, |
const int *const | idxList, | ||
const SubjectTo *const | subjectTo, | ||
const real_t *const | num, | ||
const real_t *const | den, | ||
real_t | epsNum, | ||
real_t | epsDen, | ||
real_t & | t, | ||
int & | BC_idx | ||
) | const [protected] |
Performs robustified ratio test yield the maximum possible step length along the homotopy path.
nIdx | Number of ratios to be checked. |
idxList | Array containing the indices of all ratios to be checked. |
subjectTo | Bound/Constraint object corresponding to ratios to be checked. |
num | Array containing all numerators for performing the ratio test. |
den | Array containing all denominators for performing the ratio test. |
epsNum | Numerator tolerance. |
epsDen | Denominator tolerance. |
t | Output: Maximum possible step length along the homotopy path. |
BC_idx | Output: Index of blocking constraint. |
References BT_TRUE, SubjectTo::getStatus(), SubjectTo::getType(), isBlocking(), ST_EQUALITY, ST_INACTIVE, ST_LOWER, ST_UPPER, and SUCCESSFUL_RETURN.
Referenced by QProblem::addBound_ensureLI(), QProblem::addConstraint_ensureLI(), QProblem::performStep(), and performStep().
returnValue QProblemB::performStep | ( | const real_t *const | delta_g, |
const real_t *const | delta_lb, | ||
const real_t *const | delta_ub, | ||
const real_t *const | delta_xFX, | ||
const real_t *const | delta_xFR, | ||
const real_t *const | delta_yFX, | ||
int & | BC_idx, | ||
SubjectToStatus & | BC_status | ||
) | [private] |
Determines the maximum possible step length along the homotopy path and performs this step (without changing working set).
delta_g | Step direction of gradient. |
delta_lb | Step direction of lower bounds. |
delta_ub | Step direction of upper bounds. |
delta_xFX | Primal homotopy step direction of fixed variables. |
delta_xFR | Primal homotopy step direction of free variables. |
delta_yFX | Dual homotopy step direction of fixed variables' multiplier. |
BC_idx | Output: Index of blocking constraint. |
BC_status | Output: Status of blocking constraint. |
References __FILE__, __FUNC__, __LINE__, bounds, BT_FALSE, Options::epsDen, Options::epsNum, g, Bounds::getFixed(), Bounds::getFree(), getGlobalMessageHandler(), getMax(), getNFR(), getNFX(), Indexlist::getNumberArray(), getNV(), SubjectTo::hasNoLower(), SubjectTo::hasNoUpper(), lb, MAX_STRING_LENGTH, options, performRatioTest(), real_t, RET_STEPSIZE, RET_STEPSIZE_NONPOSITIVE, ST_INACTIVE, ST_LOWER, ST_UNDEFINED, ST_UPPER, SUCCESSFUL_RETURN, tau, MessageHandling::throwInfo(), MessageHandling::throwWarning(), ub, VS_VISIBLE, x, y, and ZERO.
Referenced by solveQP().
returnValue QProblemB::printIteration | ( | int | iter, |
int | BC_idx, | ||
SubjectToStatus | BC_status, | ||
real_t | homotopyLength, | ||
BooleanType | isFirstCall = BT_TRUE |
||
) | [private] |
Prints concise information on the current iteration.
iter | Number of current iteration. |
BC_idx | Index of blocking bound. |
BC_status | Status of blocking bound. |
homotopyLength | Current homotopy distance. |
isFirstCall | Indicating whether this is the first call for current QP. |
References BT_TRUE, count, EPS, TabularOutput::excAddB, TabularOutput::excRemB, g, getAbs(), getNFX(), getNV(), H, hessianType, HST_ZERO, TabularOutput::idxAddB, TabularOutput::idxRemB, lb, MAX_STRING_LENGTH, myPrintf(), options, PL_DEBUG_ITER, PL_MEDIUM, PL_TABULAR, Options::printLevel, real_t, RET_INVALID_ARGUMENTS, ST_INACTIVE, ST_UNDEFINED, SUCCESSFUL_RETURN, tabularOutput, tau, THROWERROR, Matrix::times(), ub, x, and y.
Referenced by solveQP().
returnValue QProblemB::printOptions | ( | ) | const |
Prints a list of all options and their current values.
References options, and Options::print().
Referenced by main().
returnValue QProblemB::printProperties | ( | ) | [virtual] |
Prints concise list of properties of the current QP.
Reimplemented in QProblem.
References bounds, BT_TRUE, getNV(), SubjectTo::hasNoLower(), SubjectTo::hasNoUpper(), hessianType, HST_IDENTITY, HST_INDEF, HST_POSDEF, HST_POSDEF_NULLSPACE, HST_SEMIDEF, HST_ZERO, infeasible, MAX_STRING_LENGTH, myPrintf(), options, PL_DEBUG_ITER, PL_HIGH, PL_LOW, PL_MEDIUM, PL_NONE, PL_TABULAR, Options::printLevel, QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_NOTINITIALISED, QPS_PERFORMINGHOMOTOPY, QPS_PREPARINGAUXILIARYQP, QPS_SOLVED, status, SUCCESSFUL_RETURN, and unbounded.
returnValue QProblemB::regulariseHessian | ( | ) | [protected] |
Regularise Hessian matrix by adding a scaled identity matrix to it.
References Matrix::addToDiag(), BT_FALSE, BT_TRUE, Options::enableRegularisation, Options::epsRegularisation, g, Matrix::getNorm(), getNorm(), getNV(), H, hessianType, HST_IDENTITY, HST_ZERO, options, regVal, RET_CANNOT_REGULARISE_IDENTITY, RET_CANNOT_REGULARISE_SPARSE, RET_NO_DIAGONAL_AVAILABLE, RET_USING_REGULARISATION, SUCCESSFUL_RETURN, THROWERROR, THROWINFO, and usingRegularisation().
Referenced by setupInitialCholesky(), QProblem::setupInitialCholesky(), SQProblem::setupNewAuxiliaryQP(), QProblem::solveInitialQP(), and solveInitialQP().
returnValue QProblemB::removeBound | ( | int | number, |
BooleanType | updateCholesky | ||
) | [private] |
Removes a bounds from active set (specialised version for the case where no constraints exist).
number | Number of bound to be removed from active set. |
updateCholesky | Flag indicating if Cholesky decomposition shall be updated. |
References backsolveR(), bounds, BT_FALSE, BT_TRUE, Matrix::diag(), Options::enableFlippingBounds, Options::epsFlipping, Bounds::flipFixed(), flipper, Flipper::get(), Bounds::getFree(), getNFR(), Indexlist::getNumberArray(), getNV(), Matrix::getRow(), getSqrt(), SubjectTo::getStatus(), getStatus(), H, hessianType, HST_IDENTITY, HST_SEMIDEF, HST_ZERO, TabularOutput::idxRemB, lb, Bounds::moveFixedToFree(), options, QPS_AUXILIARYQPSOLVED, QPS_HOMOTOPYQPSOLVED, QPS_NOTINITIALISED, QPS_PREPARINGAUXILIARYQP, QPS_SOLVED, R, real_t, regVal, RET_HESSIAN_NOT_SPD, RET_MOVING_BOUND_FAILED, RET_REMOVEBOUND_FAILED, RET_UNKNOWN_BUG, RR, Flipper::set(), ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, tabularOutput, THROWERROR, ub, usingRegularisation(), and ZERO.
Referenced by changeActiveSet(), and setupAuxiliaryWorkingSet().
returnValue QProblemB::reset | ( | ) | [virtual] |
Clears all data structures of QProblemB except for QP data.
Reimplemented in QProblem.
References bounds, BT_FALSE, Options::finalRamping, flipper, getNV(), haveCholesky, hessianType, HST_UNKNOWN, infeasible, Bounds::init(), Flipper::init(), Options::initialRamping, options, QPS_NOTINITIALISED, R, ramp0, ramp1, rampOffset, regVal, RET_QPOBJECT_NOT_SETUP, status, SUCCESSFUL_RETURN, tau, THROWERROR, and unbounded.
Referenced by init(), and QProblem::reset().
returnValue QProblemB::resetCounter | ( | ) | [inline] |
Resets QP problem counter (to zero).
References count, and SUCCESSFUL_RETURN.
returnValue QProblemB::setG | ( | const real_t *const | g_new | ) | [inline, protected] |
Changes gradient vector of the QP.
g_new | New gradient vector (with correct dimension!). |
References g, getNV(), real_t, RET_INVALID_ARGUMENTS, RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by copy(), and setupQPdata().
returnValue QProblemB::setH | ( | SymmetricMatrix * | H_new | ) | [inline, protected] |
Sets Hessian matrix of the QP.
H_new | New Hessian matrix (a shallow copy is made). |
References BT_FALSE, BT_TRUE, freeHessian, H, and SUCCESSFUL_RETURN.
Referenced by SQProblem::setupNewAuxiliaryQP(), setupQPdata(), and setupQPdataFromFile().
returnValue QProblemB::setH | ( | const real_t *const | H_new | ) | [inline, protected] |
Sets dense Hessian matrix of the QP. If a null pointer is passed and a) hessianType is HST_IDENTITY, nothing is done, b) hessianType is not HST_IDENTITY, Hessian matrix is set to zero.
H_new | New dense Hessian matrix (with correct dimension!), a shallow copy is made. |
References BT_FALSE, BT_TRUE, freeHessian, getNV(), H, hessianType, HST_IDENTITY, HST_ZERO, real_t, and SUCCESSFUL_RETURN.
returnValue QProblemB::setHessianType | ( | HessianType | _hessianType | ) | [inline] |
Changes the print level.
_hessianType | New Hessian type. |
References hessianType, and SUCCESSFUL_RETURN.
returnValue QProblemB::setInfeasibilityFlag | ( | returnValue | returnvalue, |
BooleanType | doThrowError = BT_FALSE |
||
) | [protected] |
Sets internal infeasibility flag and throws given error in case the far bound strategy is not enabled (as QP might actually not be infeasible in this case).
returnvalue | Returnvalue to be tunneled. |
doThrowError | Flag forcing to throw an error. |
References BT_FALSE, BT_TRUE, Options::enableFarBounds, infeasible, options, and THROWERROR.
Referenced by QProblem::addBound_ensureLI(), QProblem::addConstraint_ensureLI(), hotstart(), QProblem::hotstart(), QProblem::solveQP(), and solveQP().
returnValue QProblemB::setLB | ( | const real_t *const | lb_new | ) | [inline, protected] |
Changes lower bound vector of the QP.
lb_new | New lower bound vector (with correct dimension!). |
References getNV(), INFTY, lb, real_t, RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by copy(), and setupQPdata().
returnValue QProblemB::setLB | ( | int | number, |
real_t | value | ||
) | [inline, protected] |
Changes single entry of lower bound vector of the QP.
number | Number of entry to be changed. |
value | New value for entry of lower bound vector. |
References getNV(), lb, RET_INDEX_OUT_OF_BOUNDS, RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, and THROWERROR.
returnValue QProblemB::setOptions | ( | const Options & | _options | ) | [inline] |
Overrides current options with given ones.
_options | New options. |
References Options::ensureConsistency(), options, Options::printLevel, setPrintLevel(), and SUCCESSFUL_RETURN.
Referenced by main(), and solveOQPbenchmark().
returnValue QProblemB::setPrintLevel | ( | PrintLevel | _printlevel | ) |
Changes the print level.
_printlevel | New print level. |
References getGlobalMessageHandler(), options, PL_DEBUG_ITER, PL_HIGH, PL_LOW, PL_MEDIUM, PL_NONE, PL_TABULAR, Options::printLevel, RET_PRINTLEVEL_CHANGED, MessageHandling::setErrorVisibilityStatus(), MessageHandling::setInfoVisibilityStatus(), MessageHandling::setWarningVisibilityStatus(), SUCCESSFUL_RETURN, THROWINFO, VS_HIDDEN, and VS_VISIBLE.
Referenced by copy(), main(), QProblemB(), and setOptions().
returnValue QProblemB::setUB | ( | const real_t *const | ub_new | ) | [inline, protected] |
Changes upper bound vector of the QP.
ub_new | New upper bound vector (with correct dimension!). |
References getNV(), INFTY, real_t, RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, THROWERROR, and ub.
Referenced by copy(), and setupQPdata().
returnValue QProblemB::setUB | ( | int | number, |
real_t | value | ||
) | [inline, protected] |
Changes single entry of upper bound vector of the QP.
number | Number of entry to be changed. |
value | New value for entry of upper bound vector. |
References getNV(), RET_INDEX_OUT_OF_BOUNDS, RET_QPOBJECT_NOT_SETUP, SUCCESSFUL_RETURN, THROWERROR, and ub.
returnValue QProblemB::setupAuxiliaryQP | ( | const Bounds *const | guessedBounds | ) | [protected, virtual] |
Updates QP vectors, working sets and internal data structures in order to start from an optimal solution corresponding to initial guesses of the working set for bounds
guessedBounds | Initial guess for working set of bounds. |
References bounds, BT_FALSE, BT_TRUE, computeCholesky(), getNV(), SubjectTo::getStatus(), Bounds::init(), QPS_PREPARINGAUXILIARYQP, RET_SETUP_AUXILIARYQP_FAILED, Bounds::setupAllFree(), setupAuxiliaryQPbounds(), setupAuxiliaryQPgradient(), setupAuxiliaryWorkingSet(), setupSubjectToType(), shallRefactorise(), ST_INACTIVE, status, SUCCESSFUL_RETURN, THROWERROR, and y.
Referenced by hotstart().
returnValue QProblemB::setupAuxiliaryQPbounds | ( | BooleanType | useRelaxation | ) | [private] |
Sets up bounds of the auxiliary initial QP for given optimal primal/dual solution and given initial working set (assumes that members X, Y and BOUNDS have already been initialised!).
useRelaxation | Flag indicating if inactive bounds shall be relaxed. |
References Options::boundRelaxation, bounds, BT_TRUE, getNV(), SubjectTo::getStatus(), SubjectTo::getType(), lb, options, RET_UNKNOWN_BUG, ST_DISABLED, ST_EQUALITY, ST_INACTIVE, ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, THROWERROR, ub, and x.
Referenced by setupAuxiliaryQP(), and solveInitialQP().
returnValue QProblemB::setupAuxiliaryQPgradient | ( | ) | [private] |
Sets up gradient of the auxiliary initial QP for given optimal primal/dual solution and given initial working set (assumes that members X, Y and BOUNDS have already been initialised!).
Reimplemented in QProblem.
References BT_FALSE, g, getNV(), H, hessianType, HST_IDENTITY, HST_ZERO, regVal, SUCCESSFUL_RETURN, Matrix::times(), usingRegularisation(), x, and y.
Referenced by performDriftCorrection(), performRamping(), setupAuxiliaryQP(), and solveInitialQP().
returnValue QProblemB::setupAuxiliaryQPsolution | ( | const real_t *const | xOpt, |
const real_t *const | yOpt | ||
) | [private] |
Sets up the optimal primal/dual solution of the auxiliary initial QP.
xOpt | Optimal primal solution vector. If a NULL pointer is passed, all entries are set to zero. |
yOpt | Optimal dual solution vector. If a NULL pointer is passed, all entries are set to zero. |
Reimplemented in QProblem.
References getNV(), SUCCESSFUL_RETURN, x, and y.
Referenced by solveInitialQP().
returnValue QProblemB::setupAuxiliaryWorkingSet | ( | const Bounds *const | auxiliaryBounds, |
BooleanType | setupAfresh | ||
) | [private] |
Sets up bound data structure according to auxiliaryBounds. (If the working set shall be setup afresh, make sure that bounds data structure has been resetted!)
auxiliaryBounds | Working set for auxiliary QP. |
setupAfresh | Flag indicating if given working set shall be setup afresh or by updating the current one. |
References addBound(), bounds, BT_FALSE, BT_TRUE, getNV(), SubjectTo::getStatus(), removeBound(), RET_INVALID_ARGUMENTS, RET_SETUP_WORKINGSET_FAILED, RET_UNKNOWN_BUG, ST_INACTIVE, ST_LOWER, ST_UNDEFINED, ST_UPPER, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by setupAuxiliaryQP(), and solveInitialQP().
returnValue QProblemB::setupInitialCholesky | ( | ) | [protected, virtual] |
Computes initial Cholesky decomposition of the (simply projected) Hessian making use of the function computeCholesky().
Reimplemented in QProblem.
References BT_TRUE, computeCholesky(), Options::enableRegularisation, getNFR(), getNFV(), getNV(), haveCholesky, options, regulariseHessian(), RET_HESSIAN_NOT_SPD, RET_INIT_FAILED_CHOLESKY, RET_INIT_FAILED_REGULARISATION, and SUCCESSFUL_RETURN.
Referenced by hotstart().
returnValue QProblemB::setupQPdata | ( | SymmetricMatrix * | _H, |
const real_t *const | _g, | ||
const real_t *const | _lb, | ||
const real_t *const | _ub | ||
) | [protected] |
Sets up internal QP data.
_H | Hessian matrix. |
_g | Gradient vector. |
_lb | Lower bounds (on variables). If no lower bounds exist, a NULL pointer can be passed. |
_ub | Upper bounds (on variables). If no upper bounds exist, a NULL pointer can be passed. |
References RET_INVALID_ARGUMENTS, setG(), setH(), setLB(), setUB(), SUCCESSFUL_RETURN, and THROWERROR.
Referenced by init(), and QProblem::setupQPdata().
returnValue QProblemB::setupQPdata | ( | const real_t *const | _H, |
const real_t *const | _g, | ||
const real_t *const | _lb, | ||
const real_t *const | _ub | ||
) | [protected] |
Sets up internal QP data. If the current Hessian is trivial (i.e. HST_ZERO or HST_IDENTITY) but a non-trivial one is given, memory for Hessian is allocated and it is set to the given one.
_H | Hessian matrix. If Hessian matrix is trivial,a NULL pointer can be passed. |
_g | Gradient vector. |
_lb | Lower bounds (on variables). If no lower bounds exist, a NULL pointer can be passed. |
_ub | Upper bounds (on variables). If no upper bounds exist, a NULL pointer can be passed. |
References RET_INVALID_ARGUMENTS, setG(), setH(), setLB(), setUB(), SUCCESSFUL_RETURN, and THROWERROR.
returnValue QProblemB::setupQPdataFromFile | ( | const char *const | H_file, |
const char *const | g_file, | ||
const char *const | lb_file, | ||
const char *const | ub_file | ||
) | [protected] |
Sets up internal QP data by loading it from files. If the current Hessian is trivial (i.e. HST_ZERO or HST_IDENTITY) but a non-trivial one is given, memory for Hessian is allocated and it is set to the given one.
H_file | Name of file where Hessian matrix, of neighbouring QP to be solved, is stored. If Hessian matrix is trivial,a NULL pointer can be passed. |
g_file | Name of file where gradient, of neighbouring QP to be solved, is stored. |
lb_file | Name of file where lower bounds, of neighbouring QP to be solved, is stored. If no lower bounds exist, a NULL pointer can be passed. |
ub_file | Name of file where upper bounds, of neighbouring QP to be solved, is stored. If no upper bounds exist, a NULL pointer can be passed. |
References Matrix::doFreeMemory(), g, getNV(), H, INFTY, lb, readFromFile(), real_t, RET_INVALID_ARGUMENTS, setH(), SUCCESSFUL_RETURN, THROWERROR, and ub.
Referenced by init().
returnValue QProblemB::setupSubjectToType | ( | ) | [protected, virtual] |
Determines type of existing constraints and bounds (i.e. implicitly fixed, unbounded etc.).
Reimplemented in QProblem.
Referenced by setupAuxiliaryQP(), QProblem::setupSubjectToType(), solveInitialQP(), and solveQP().
returnValue QProblemB::setupSubjectToType | ( | const real_t *const | lb_new, |
const real_t *const | ub_new | ||
) | [protected, virtual] |
Determines type of new constraints and bounds (i.e. implicitly fixed, unbounded etc.).
lb_new | New lower bounds. |
ub_new | New upper bounds. |
References bounds, Options::boundTolerance, BT_FALSE, BT_TRUE, Options::enableEqualities, Options::enableFarBounds, getNV(), INFTY, lb, options, SubjectTo::setNoLower(), SubjectTo::setNoUpper(), SubjectTo::setType(), ST_BOUNDED, ST_EQUALITY, ST_UNBOUNDED, SUCCESSFUL_RETURN, and ub.
BooleanType QProblemB::shallRefactorise | ( | const Bounds *const | guessedBounds | ) | const [private] |
Determines if it is more efficient to refactorise the matrices when hotstarting or not (i.e. better to update the existing factorisations).
guessedBounds | Guessed new working set. |
References bounds, BT_FALSE, BT_TRUE, Bounds::getNFX(), getNV(), SubjectTo::getStatus(), hessianType, HST_INDEF, and HST_SEMIDEF.
Referenced by setupAuxiliaryQP().
returnValue QProblemB::solveInitialQP | ( | const real_t *const | xOpt, |
const real_t *const | yOpt, | ||
const Bounds *const | guessedBounds, | ||
const real_t *const | _R, | ||
int & | nWSR, | ||
real_t *const | cputime | ||
) | [private] |
Solves a QProblemB whose QP data is assumed to be stored in the member variables. A guess for its primal/dual optimal solution vectors and the corresponding optimal working set can be provided. Note: This function is internally called by all init functions!
xOpt | Optimal primal solution vector. |
yOpt | Optimal dual solution vector. |
guessedBounds | Optimal working set of bounds for solution (xOpt,yOpt). |
_R | Pre-computed (upper triangular) Cholesky factor of Hessian matrix. |
nWSR | Input: Maximum number of working set recalculations; Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP solution. Output: CPU time spent for QP solution (or to perform nWSR iterations). |
References bounds, BT_FALSE, BT_TRUE, determineHessianType(), g, getCPUtime(), getNV(), haveCholesky, hessianType, hotstart(), HST_SEMIDEF, HST_ZERO, Options::initialStatusBounds, isInfeasible(), isUnbounded(), lb, obtainAuxiliaryWorkingSet(), options, QPS_AUXILIARYQPSOLVED, QPS_NOTINITIALISED, QPS_PREPARINGAUXILIARYQP, R, real_t, regulariseHessian(), RET_INIT_FAILED, RET_INIT_FAILED_HOTSTART, RET_INIT_FAILED_INFEASIBILITY, RET_INIT_FAILED_REGULARISATION, RET_INIT_FAILED_UNBOUNDEDNESS, RET_INIT_SUCCESSFUL, RET_MAX_NWSR_REACHED, RET_NO_CHOLESKY_WITH_INITIAL_GUESS, RR, Bounds::setupAllFree(), setupAuxiliaryQPbounds(), setupAuxiliaryQPgradient(), setupAuxiliaryQPsolution(), setupAuxiliaryWorkingSet(), setupSubjectToType(), ST_INACTIVE, status, SUCCESSFUL_RETURN, THROWERROR, THROWINFO, THROWWARNING, and ub.
Referenced by init().
returnValue QProblemB::solveQP | ( | const real_t *const | g_new, |
const real_t *const | lb_new, | ||
const real_t *const | ub_new, | ||
int & | nWSR, | ||
real_t *const | cputime, | ||
int | nWSRperformed = 0 , |
||
BooleanType | isFirstCall = BT_TRUE |
||
) | [private] |
Solves an initialised QProblemB using online active set strategy. Note: This function is internally called by all hotstart functions!
g_new | Gradient of neighbouring QP to be solved. |
lb_new | Lower bounds of neighbouring QP to be solved. If no lower bounds exist, a NULL pointer can be passed. |
ub_new | Upper bounds of neighbouring QP to be solved. If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations; Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP solution. Output: CPU time spent for QP solution (or to perform nWSR iterations). |
nWSRperformed | Number of working set recalculations already performed to solve this QP within previous solveQP() calls. This number is always zero, except for successive calls from solveRegularisedQP() or when using the far bound strategy. |
isFirstCall | Indicating whether this is the first call for current QP. |
References __FILE__, __FUNC__, __LINE__, BT_FALSE, BT_TRUE, changeActiveSet(), computeCholesky(), determineDataShift(), determineStepDirection(), Options::enableCholeskyRefactorisation, Options::enableDriftCorrection, Options::enableRamping, EPS, TabularOutput::excAddB, TabularOutput::excAddC, TabularOutput::excRemB, TabularOutput::excRemC, getCPUtime(), getGlobalMessageHandler(), getNV(), getRelativeHomotopyLength(), getStatus(), TabularOutput::idxAddB, TabularOutput::idxAddC, TabularOutput::idxRemB, TabularOutput::idxRemC, infeasible, isCPUtimeLimitExceeded(), MAX_STRING_LENGTH, options, performDriftCorrection(), performRamping(), performStep(), PL_HIGH, printIteration(), Options::printLevel, QPS_HOMOTOPYQPSOLVED, QPS_NOTINITIALISED, QPS_PERFORMINGHOMOTOPY, QPS_PREPARINGAUXILIARYQP, QPS_SOLVED, real_t, RET_HOMOTOPY_STEP_FAILED, RET_HOTSTART_FAILED, RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, RET_HOTSTART_STOPPED_INFEASIBILITY, RET_HOTSTART_STOPPED_UNBOUNDEDNESS, RET_ITERATION_STARTED, RET_MAX_NWSR_REACHED, RET_OPTIMAL_SOLUTION_FOUND, RET_PRINT_ITERATION_FAILED, RET_SHIFT_DETERMINATION_FAILED, RET_STEPDIRECTION_DETERMINATION_FAILED, RET_STEPLENGTH_DETERMINATION_FAILED, setInfeasibilityFlag(), setupSubjectToType(), status, SUCCESSFUL_RETURN, tabularOutput, tau, Options::terminationTolerance, THROWERROR, MessageHandling::throwInfo(), THROWINFO, MessageHandling::throwWarning(), unbounded, and VS_VISIBLE.
Referenced by solveRegularisedQP().
returnValue QProblemB::solveRegularisedQP | ( | const real_t *const | g_new, |
const real_t *const | lb_new, | ||
const real_t *const | ub_new, | ||
int & | nWSR, | ||
real_t *const | cputime, | ||
int | nWSRperformed = 0 , |
||
BooleanType | isFirstCall = BT_TRUE |
||
) | [private] |
Solves an initialised QProblemB using online active set strategy. Note: This function is internally called by all hotstart functions!
g_new | Gradient of neighbouring QP to be solved. |
lb_new | Lower bounds of neighbouring QP to be solved. If no lower bounds exist, a NULL pointer can be passed. |
ub_new | Upper bounds of neighbouring QP to be solved. If no upper bounds exist, a NULL pointer can be passed. |
nWSR | Input: Maximum number of working set recalculations; Output: Number of performed working set recalculations. |
cputime | Input: Maximum CPU time allowed for QP solution. Output: CPU time spent for QP solution (or to perform nWSR iterations). |
nWSRperformed | Number of working set recalculations already performed to solve this QP within previous solveRegularisedQP() calls. This number is always zero, except for successive calls when using the far bound strategy. |
isFirstCall | Indicating whether this is the first call for current QP. |
References BT_FALSE, g, getNV(), Options::numRegularisationSteps, options, real_t, regVal, RET_FEWER_REGSTEPS_NWSR, RET_MAX_NWSR_REACHED, RET_NO_REGSTEP_NWSR, solveQP(), SUCCESSFUL_RETURN, THROWWARNING, usingRegularisation(), and x.
Referenced by hotstart().
returnValue QProblemB::updateFarBounds | ( | real_t | curFarBound, |
int | nRamp, | ||
const real_t *const | lb_new, | ||
real_t *const | lb_new_far, | ||
const real_t *const | ub_new, | ||
real_t *const | ub_new_far | ||
) | const [protected] |
...
curFarBound | ... |
nRamp | ... |
lb_new | ... |
lb_new_far | ... |
ub_new | ... |
ub_new_far | ... |
References BT_TRUE, Options::enableRamping, getMax(), getMin(), getNV(), options, ramp0, ramp1, rampOffset, real_t, and SUCCESSFUL_RETURN.
Referenced by hotstart().
BooleanType QProblemB::usingRegularisation | ( | ) | const [inline] |
Returns if the QP has been internally regularised.
References BT_FALSE, BT_TRUE, regVal, and ZERO.
Referenced by computeCholesky(), QProblem::computeProjectedCholesky(), QProblem::determineStepDirection(), determineStepDirection(), SolutionAnalysis::getKktViolation(), getObjVal(), regulariseHessian(), removeBound(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), SQProblem::setupNewAuxiliaryQP(), QProblem::solveRegularisedQP(), and solveRegularisedQP().
Bounds QProblemB::bounds [protected] |
Data structure for problem's bounds.
Referenced by QProblem::addBound(), addBound(), QProblem::addBound_ensureLI(), QProblem::addConstraint(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), computeCholesky(), QProblem::computeProjectedCholesky(), copy(), determineDataShift(), QProblem::determineStepDirection(), determineStepDirection(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), getBounds(), getNFR(), getNFV(), getNFX(), getNV(), SolutionAnalysis::getVarianceCovariance(), getWorkingSetBounds(), QProblem::hotstart(), obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printProperties(), printProperties(), QProblemB(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), reset(), QProblem::setupAuxiliaryQP(), setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), setupSubjectToType(), QProblem::setupTQfactorisation(), QProblem::shallRefactorise(), shallRefactorise(), QProblem::solveCurrentEQP(), QProblem::solveInitialQP(), solveInitialQP(), and QProblem::writeQpWorkspaceIntoMatFile().
unsigned int QProblemB::count [protected] |
Counts the number of hotstart function calls.
Referenced by copy(), getCount(), hotstart(), QProblem::hotstart(), QProblem::printIteration(), printIteration(), QProblemB(), and resetCounter().
real_t* QProblemB::delta_xFR_TMP [protected] |
Temporary for determineStepDirection
Referenced by clear(), copy(), QProblem::determineStepDirection(), determineStepDirection(), and QProblemB().
Flipper QProblemB::flipper [protected] |
Struct for making a temporary copy of the matrix factorisations.
Referenced by copy(), QProblem::QProblem(), QProblemB(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), QProblem::reset(), and reset().
BooleanType QProblemB::freeHessian [protected] |
Flag indicating whether the Hessian matrix needs to be de-allocated.
Referenced by clear(), copy(), QProblemB(), setH(), and SQProblem::setupNewAuxiliaryQP().
real_t* QProblemB::g [protected] |
Gradient.
Referenced by clear(), copy(), determineDataShift(), SolutionAnalysis::getKktViolation(), getObjVal(), getRelativeHomotopyLength(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblemB(), regulariseHessian(), setG(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), setupQPdataFromFile(), QProblem::solveInitialQP(), solveInitialQP(), QProblem::solveRegularisedQP(), solveRegularisedQP(), and QProblem::writeQpDataIntoMatFile().
SymmetricMatrix* QProblemB::H [protected] |
Hessian matrix.
Referenced by clear(), computeCholesky(), QProblem::computeProjectedCholesky(), copy(), determineHessianType(), QProblem::determineStepDirection(), determineStepDirection(), SolutionAnalysis::getKktViolation(), getObjVal(), QProblem::printIteration(), printIteration(), QProblemB(), regulariseHessian(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), setH(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), SQProblem::setupNewAuxiliaryQP(), setupQPdataFromFile(), and QProblem::writeQpDataIntoMatFile().
BooleanType QProblemB::haveCholesky [protected] |
Flag indicating whether Cholesky decomposition has already been setup.
Referenced by copy(), hotstart(), QProblem::hotstart(), QProblemB(), reset(), setupInitialCholesky(), QProblem::setupInitialCholesky(), QProblem::solveInitialQP(), and solveInitialQP().
HessianType QProblemB::hessianType [protected] |
Type of Hessian matrix.
Referenced by QProblem::addBound(), addBound(), QProblem::addConstraint(), computeCholesky(), QProblem::computeProjectedCholesky(), copy(), determineHessianType(), QProblem::determineStepDirection(), determineStepDirection(), getHessianType(), getObjVal(), QProblem::printIteration(), printIteration(), QProblem::printProperties(), printProperties(), QProblemB(), regulariseHessian(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), reset(), setH(), setHessianType(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), SQProblem::setupNewAuxiliaryQP(), QProblem::shallRefactorise(), shallRefactorise(), QProblem::solveInitialQP(), and solveInitialQP().
BooleanType QProblemB::infeasible [protected] |
QP infeasible?
Referenced by copy(), hotstart(), QProblem::hotstart(), isInfeasible(), QProblem::printProperties(), printProperties(), QProblemB(), reset(), setInfeasibilityFlag(), QProblem::solveQP(), and solveQP().
real_t* QProblemB::lb [protected] |
Lower bound vector (on variables).
Referenced by clear(), copy(), determineDataShift(), QProblem::ensureNonzeroCurvature(), SolutionAnalysis::getKktViolation(), getRelativeHomotopyLength(), obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblemB(), QProblem::removeBound(), removeBound(), setLB(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), setupQPdataFromFile(), setupSubjectToType(), QProblem::setupSubjectToType(), QProblem::solveInitialQP(), solveInitialQP(), and QProblem::writeQpDataIntoMatFile().
Options QProblemB::options [protected] |
Struct containing all user-defined options for solving QPs.
Referenced by QProblem::addBound_checkLI(), QProblem::addBound_ensureLI(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), QProblem::changeActiveSet(), computeCholesky(), QProblem::computeProjectedCholesky(), copy(), determineHessianType(), QProblem::determineStepDirection(), determineStepDirection(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), getOptions(), getPrintLevel(), hotstart(), QProblem::hotstart(), obtainAuxiliaryWorkingSet(), QProblem::obtainAuxiliaryWorkingSet(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), printOptions(), QProblem::printProperties(), printProperties(), QProblemB(), regulariseHessian(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), reset(), setInfeasibilityFlag(), setOptions(), setPrintLevel(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), setupInitialCholesky(), QProblem::setupInitialCholesky(), SQProblem::setupNewAuxiliaryQP(), setupSubjectToType(), QProblem::setupSubjectToType(), QProblem::solveInitialQP(), solveInitialQP(), QProblem::solveQP(), solveQP(), QProblem::solveRegularisedQP(), solveRegularisedQP(), updateFarBounds(), and QProblem::updateFarBounds().
real_t* QProblemB::R [protected] |
Cholesky factor of H (i.e. H = R^T*R).
Referenced by clear(), computeCholesky(), QProblem::computeProjectedCholesky(), copy(), init(), QProblem::init(), QProblemB(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), reset(), QProblem::solveInitialQP(), and solveInitialQP().
real_t QProblemB::ramp0 [protected] |
Start value for Ramping Strategy.
Referenced by copy(), performRamping(), QProblem::performRamping(), QProblemB(), reset(), updateFarBounds(), and QProblem::updateFarBounds().
real_t QProblemB::ramp1 [protected] |
Final value for Ramping Strategy.
Referenced by copy(), performRamping(), QProblem::performRamping(), QProblemB(), reset(), updateFarBounds(), and QProblem::updateFarBounds().
int QProblemB::rampOffset [protected] |
Offset index for Ramping.
Referenced by hotstart(), QProblem::hotstart(), performRamping(), QProblem::performRamping(), QProblemB(), reset(), updateFarBounds(), and QProblem::updateFarBounds().
real_t QProblemB::regVal [protected] |
Holds the offset used to regularise Hessian matrix (zero by default).
Referenced by computeCholesky(), QProblem::computeProjectedCholesky(), copy(), QProblem::determineStepDirection(), determineStepDirection(), SolutionAnalysis::getKktViolation(), getObjVal(), QProblem::printIteration(), QProblemB(), regulariseHessian(), removeBound(), reset(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), SQProblem::setupNewAuxiliaryQP(), QProblem::solveRegularisedQP(), solveRegularisedQP(), and usingRegularisation().
QProblemStatus QProblemB::status [protected] |
Current status of the solution process.
Referenced by copy(), getStatus(), hotstart(), QProblem::hotstart(), isInitialised(), isSolved(), QProblem::printProperties(), printProperties(), QProblemB(), reset(), QProblem::setupAuxiliaryQP(), setupAuxiliaryQP(), SQProblem::setupNewAuxiliaryQP(), QProblem::solveInitialQP(), solveInitialQP(), QProblem::solveQP(), and solveQP().
TabularOutput QProblemB::tabularOutput [protected] |
Struct storing information for tabular output (printLevel == PL_TABULAR).
Referenced by QProblem::addBound(), addBound(), QProblem::addBound_ensureLI(), QProblem::addConstraint(), QProblem::addConstraint_ensureLI(), QProblem::printIteration(), printIteration(), QProblem::removeBound(), removeBound(), QProblem::removeConstraint(), QProblem::solveQP(), and solveQP().
real_t QProblemB::tau [protected] |
Last homotopy step length.
Referenced by copy(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblemB(), reset(), QProblem::solveQP(), and solveQP().
real_t* QProblemB::ub [protected] |
Upper bound vector (on variables).
Referenced by clear(), copy(), determineDataShift(), QProblem::ensureNonzeroCurvature(), SolutionAnalysis::getKktViolation(), getRelativeHomotopyLength(), obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblemB(), QProblem::removeBound(), removeBound(), setUB(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), setupQPdataFromFile(), setupSubjectToType(), QProblem::setupSubjectToType(), QProblem::solveInitialQP(), solveInitialQP(), and QProblem::writeQpDataIntoMatFile().
BooleanType QProblemB::unbounded [protected] |
QP unbounded?
Referenced by copy(), QProblem::ensureNonzeroCurvature(), hotstart(), QProblem::hotstart(), isUnbounded(), QProblem::printProperties(), printProperties(), QProblemB(), reset(), QProblem::solveQP(), and solveQP().
real_t* QProblemB::x [protected] |
Primal solution vector.
Referenced by clear(), copy(), QProblem::ensureNonzeroCurvature(), SolutionAnalysis::getKktViolation(), getObjVal(), getPrimalSolution(), hotstart(), QProblem::hotstart(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblemB(), QProblem::setA(), QProblem::setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), QProblem::setupAuxiliaryQPsolution(), setupAuxiliaryQPsolution(), QProblem::solveRegularisedQP(), and solveRegularisedQP().
real_t* QProblemB::y [protected] |
Dual solution vector.
Referenced by QProblem::addBound_ensureLI(), QProblem::addConstraint_ensureLI(), QProblem::changeActiveSet(), changeActiveSet(), clear(), QProblem::copy(), copy(), getDualSolution(), QProblem::getDualSolution(), SolutionAnalysis::getKktViolation(), QProblem::performDriftCorrection(), performDriftCorrection(), performRamping(), QProblem::performRamping(), QProblem::performStep(), performStep(), QProblem::printIteration(), printIteration(), QProblem::QProblem(), QProblemB(), QProblem::setupAuxiliaryQP(), setupAuxiliaryQP(), QProblem::setupAuxiliaryQPgradient(), setupAuxiliaryQPgradient(), QProblem::setupAuxiliaryQPsolution(), setupAuxiliaryQPsolution(), and SQProblem::setupNewAuxiliaryQP().