qpOASES 3.2.1
An Implementation of the Online Active Set Strategy
|
Manages working sets of bounds (i.e. box constraints). More...
#include <Bounds.hpp>
Protected Member Functions | |
returnValue | clear () |
returnValue | copy (const Bounds &rhs) |
returnValue | setupAll (SubjectToStatus _status) |
returnValue | copy (const SubjectTo &rhs) |
returnValue | addIndex (Indexlist *const indexlist, int_t newnumber, SubjectToStatus newstatus) |
returnValue | removeIndex (Indexlist *const indexlist, int_t removenumber) |
returnValue | swapIndex (Indexlist *const indexlist, int_t number1, int_t number2) |
Protected Attributes | |
Indexlist | freee |
Indexlist | fixed |
int_t | n |
SubjectToType * | type |
SubjectToStatus * | status |
BooleanType | noLower |
BooleanType | noUpper |
This class manages working sets of bounds (= box constraints) by storing index sets and other status information.
BEGIN_NAMESPACE_QPOASES Bounds::Bounds | ( | ) |
Default constructor.
References SubjectTo::SubjectTo().
Referenced by Bounds(), copy(), and operator=().
Bounds::Bounds | ( | int_t | _n | ) |
Constructor which takes the number of bounds.
_n | Number of bounds. |
References init(), and SubjectTo::SubjectTo().
Bounds::Bounds | ( | const Bounds & | rhs | ) |
Copy constructor (deep copy).
rhs | Rhs object. |
References Bounds(), copy(), and SubjectTo::SubjectTo().
|
virtual |
Destructor.
References clear().
|
protectedinherited |
Adds the index of a new constraint or bound to index set.
indexlist | Index list to which the new index shall be added. |
newnumber | Number of new constraint or bound. |
newstatus | Status of new constraint or bound. |
References Indexlist::addNumber(), RET_ADDINDEX_FAILED, RET_INDEX_ALREADY_OF_DESIRED_STATUS, RET_INDEXLIST_EXCEEDS_MAX_LENGTH, RET_INVALID_ARGUMENTS, status, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by Constraints::moveActiveToInactive(), Bounds::moveFixedToFree(), Bounds::moveFreeToFixed(), Constraints::moveInactiveToActive(), Bounds::setupBound(), and Constraints::setupConstraint().
|
protected |
Frees all allocated memory.
References SUCCESSFUL_RETURN.
Referenced by init(), operator=(), and ~Bounds().
|
protected |
Copies all members from given rhs object.
rhs | Rhs object. |
References Bounds(), fixed, freee, and SUCCESSFUL_RETURN.
Referenced by Bounds(), and operator=().
|
protectedinherited |
Copies all members from given rhs object.
rhs | Rhs object. |
References n, noLower, noUpper, status, SubjectTo(), SUCCESSFUL_RETURN, and type.
Referenced by operator=(), and SubjectTo().
returnValue Bounds::flipFixed | ( | int_t | number | ) |
Flip fixed bound.
References SubjectTo::n, RET_INDEX_OUT_OF_BOUNDS, RET_MOVING_BOUND_FAILED, ST_LOWER, ST_UPPER, SubjectTo::status, SUCCESSFUL_RETURN, and THROWERROR.
|
inline |
Returns a pointer to fixed variables index list.
References fixed.
Referenced by SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints(), SolutionAnalysis::getVarianceCovariance(), moveFixedToFree(), moveFreeToFixed(), print(), and setupBound().
|
inline |
Returns a pointer to free variables index list.
References freee.
Referenced by SolutionAnalysis::getVarianceCovariance(), moveFixedToFree(), moveFreeToFixed(), print(), setupBound(), and swapFree().
|
inline |
Returns number of bounded (but possibly free) variables.
References SubjectTo::getNumberOfType(), and ST_BOUNDED.
|
inline |
|
inline |
Returns number of implicitly fixed variables.
References SubjectTo::getNumberOfType(), and ST_EQUALITY.
|
inline |
Returns number of fixed variables.
References fixed.
Referenced by print(), QProblem::shallRefactorise(), and QProblemB::shallRefactorise().
|
inlineinherited |
Returns number of constraints/bounds with given SubjectTo type.
_type | Type of (constraints') bound. |
Referenced by Bounds::getNBV(), Constraints::getNEC(), Bounds::getNFV(), Constraints::getNIC(), Constraints::getNUC(), and Bounds::getNUV().
|
inline |
Returns number of unbounded variables.
References SubjectTo::getNumberOfType(), and ST_UNBOUNDED.
|
inline |
|
inlineinherited |
Returns status of (constraints') bound.
i | Number of (constraints') bound. |
References n, ST_UNDEFINED, and status.
Referenced by SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints(), QProblem::init(), QProblem::init(), QProblem::init(), QProblemB::init(), QProblemB::init(), QProblemB::init(), QProblem::obtainAuxiliaryWorkingSet(), QProblemB::obtainAuxiliaryWorkingSet(), QProblemB::performRatioTest(), Bounds::rotate(), Constraints::rotate(), SQProblemSchur::setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupAuxiliaryWorkingSet(), SQProblemSchur::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblem::shallRefactorise(), QProblemB::shallRefactorise(), Bounds::shift(), and Constraints::shift().
|
inlineinherited |
Returns type of (constraints') bound.
i | Number of (constraints') bound. |
References n, ST_UNKNOWN, and type.
Referenced by QProblemB::performRatioTest(), Bounds::rotate(), Constraints::rotate(), Bounds::setupAll(), Constraints::setupAll(), SQProblem::setupNewAuxiliaryQP(), Bounds::shift(), and Constraints::shift().
|
inlineinherited |
Returns status of lower (constraints') bounds.
References noLower.
|
inlineinherited |
Returns status of upper bounds.
References noUpper.
returnValue Bounds::init | ( | int_t | _n = 0 | ) |
Initialises object with given number of bounds.
_n | Number of bounds. |
References clear(), fixed, freee, SubjectTo::init(), RET_INVALID_ARGUMENTS, and THROWERROR.
Referenced by Bounds().
returnValue Bounds::moveFixedToFree | ( | int_t | number | ) |
Moves index of a bound from index list of fixed to that of free bounds.
number | Number of bound to be freed. |
References SubjectTo::addIndex(), getFixed(), getFree(), SubjectTo::n, SubjectTo::removeIndex(), RET_INDEX_OUT_OF_BOUNDS, RET_MOVING_BOUND_FAILED, ST_INACTIVE, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints().
returnValue Bounds::moveFreeToFixed | ( | int_t | number, |
SubjectToStatus | _status ) |
Moves index of a bound from index list of free to that of fixed bounds.
number | Number of bound to be fixed. |
_status | Status of bound to be fixed. |
References SubjectTo::addIndex(), getFixed(), getFree(), SubjectTo::n, SubjectTo::removeIndex(), RET_INDEX_OUT_OF_BOUNDS, RET_MOVING_BOUND_FAILED, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints().
Assignment operator (deep copy).
rhs | Rhs object. |
References Bounds(), clear(), copy(), and SubjectTo::operator=().
returnValue Bounds::print | ( | ) |
Prints information on bounds object (in particular, lists of free and fixed bounds.
References getFixed(), getFree(), getNFR(), getNFX(), Indexlist::getNumberArray(), MAX_STRING_LENGTH, myPrintf(), SubjectTo::n, print(), REFER_NAMESPACE_QPOASES, and SUCCESSFUL_RETURN.
Referenced by print().
|
protectedinherited |
Removes the index of a constraint or bound from index set.
indexlist | Index list from which the new index shall be removed. |
removenumber | Number of constraint or bound to be removed. |
References Indexlist::removeNumber(), RET_INVALID_ARGUMENTS, RET_REMOVEINDEX_FAILED, ST_UNDEFINED, status, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by Constraints::moveActiveToInactive(), Bounds::moveFixedToFree(), Bounds::moveFreeToFixed(), and Constraints::moveInactiveToActive().
|
virtual |
Rotates forward type and status of all bounds by a given offset. This offset has to lie within the range [0,n]. Example for offset = 2:
rotate( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b1,b2}
offset | Rotation offset within the range [0,n]. |
Implements SubjectTo.
References Indexlist::addNumber(), fixed, freee, SubjectTo::getStatus(), SubjectTo::getType(), SubjectTo::n, RET_INDEX_OUT_OF_BOUNDS, RET_ROTATING_FAILED, SubjectTo::setStatus(), SubjectTo::setType(), ST_INACTIVE, ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, and THROWERROR.
|
inlineinherited |
Sets status of lower (constraints') bounds.
_status | Status of lower (constraints') bounds. |
References noLower.
|
inlineinherited |
Sets status of upper (constraints') bounds.
_status | Status of upper (constraints') bounds. |
References noUpper.
|
inlineinherited |
Sets status of (constraints') bound.
i | Number of (constraints') bound. |
value | Status of (constraints') bound. |
References n, RET_INDEX_OUT_OF_BOUNDS, status, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by Bounds::rotate(), Constraints::rotate(), SQProblemSchur::setupAuxiliaryQP(), SQProblem::setupNewAuxiliaryQP(), Bounds::shift(), and Constraints::shift().
|
inlineinherited |
Sets type of (constraints') bound.
i | Number of (constraints') bound. |
value | Type of (constraints') bound. |
References n, RET_INDEX_OUT_OF_BOUNDS, SUCCESSFUL_RETURN, THROWERROR, and type.
Referenced by Bounds::rotate(), Constraints::rotate(), Bounds::shift(), and Constraints::shift().
|
protected |
Initially adds all numbers of new (i.e. not yet in the list) bounds to to the index set corresponding to the desired status; the order depends on the SujectToType of each index.
_status | Desired initial status for all bounds. |
References SubjectTo::getType(), SubjectTo::n, RET_SETUP_BOUND_FAILED, setupBound(), ST_BOUNDED, ST_DISABLED, ST_EQUALITY, ST_UNBOUNDED, ST_UNKNOWN, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by setupAllFree(), setupAllLower(), and setupAllUpper().
returnValue Bounds::setupAllFree | ( | ) |
Initially adds all numbers of new (i.e. not yet in the list) bounds to to the index set of free bounds; the order depends on the SujectToType of each index.
References setupAll(), and ST_INACTIVE.
returnValue Bounds::setupAllLower | ( | ) |
Initially adds all numbers of new (i.e. not yet in the list) bounds to to the index set of fixed bounds (on their lower bounds); the order depends on the SujectToType of each index.
References setupAll(), and ST_LOWER.
returnValue Bounds::setupAllUpper | ( | ) |
Initially adds all numbers of new (i.e. not yet in the list) bounds to to the index set of fixed bounds (on their upper bounds); the order depends on the SujectToType of each index.
References setupAll(), and ST_UPPER.
returnValue Bounds::setupBound | ( | int_t | number, |
SubjectToStatus | _status ) |
Initially adds number of a new (i.e. not yet in the list) bound to given index set.
number | Number of new bound. |
_status | Status of new bound. |
References SubjectTo::addIndex(), getFixed(), getFree(), SubjectTo::n, RET_INDEX_OUT_OF_BOUNDS, RET_INVALID_ARGUMENTS, RET_SETUP_BOUND_FAILED, ST_INACTIVE, ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by QProblemB::obtainAuxiliaryWorkingSet(), and setupAll().
|
virtual |
Shifts forward type and status of all bounds by a given offset. This offset has to lie within the range [0,n/2] and has to be an integer divisor of the total number of bounds n. Type and status of the first <offset> bounds is thrown away, type and status of the last <offset> bounds is doubled, e.g. for offset = 2:
shift( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b5,b6}
offset | Shift offset within the range [0,n/2] and integer divisor of n. |
Implements SubjectTo.
References Indexlist::addNumber(), fixed, freee, SubjectTo::getStatus(), SubjectTo::getType(), SubjectTo::n, RET_INDEX_OUT_OF_BOUNDS, RET_INVALID_ARGUMENTS, RET_SHIFTING_FAILED, SubjectTo::setStatus(), SubjectTo::setType(), ST_INACTIVE, ST_LOWER, ST_UPPER, SUCCESSFUL_RETURN, and THROWERROR.
returnValue Bounds::swapFree | ( | int_t | number1, |
int_t | number2 ) |
Swaps the indices of two free bounds within the index set.
number1 | Number of first constraint or bound. |
number2 | Number of second constraint or bound. |
References getFree(), SubjectTo::n, RET_INDEX_OUT_OF_BOUNDS, SubjectTo::swapIndex(), and THROWERROR.
|
protectedinherited |
Swaps the indices of two constraints or bounds within the index set.
indexlist | Index list in which the indices shold be swapped. |
number1 | Number of first constraint or bound. |
number2 | Number of second constraint or bound. |
References RET_INVALID_ARGUMENTS, RET_NOTHING_TO_DO, RET_SWAPINDEX_FAILED, status, SUCCESSFUL_RETURN, Indexlist::swapNumbers(), THROWERROR, and THROWWARNING.
Referenced by Bounds::swapFree().
|
protected |
|
protected |
|
protectedinherited |
Total number of constraints/bounds.
Referenced by copy(), Bounds::flipFixed(), Constraints::flipFixed(), Constraints::getNC(), getNumberOfType(), Bounds::getNV(), getStatus(), getType(), init(), Constraints::moveActiveToInactive(), Bounds::moveFixedToFree(), Bounds::moveFreeToFixed(), Constraints::moveInactiveToActive(), Bounds::print(), Constraints::print(), Bounds::rotate(), Constraints::rotate(), setStatus(), setType(), Bounds::setupAll(), Constraints::setupAll(), Bounds::setupBound(), Constraints::setupConstraint(), Bounds::shift(), Constraints::shift(), and Bounds::swapFree().
|
protectedinherited |
This flag indicates if there is no lower bound on any variable.
Referenced by copy(), hasNoLower(), init(), and setNoLower().
|
protectedinherited |
This flag indicates if there is no upper bound on any variable.
Referenced by copy(), hasNoUpper(), init(), and setNoUpper().
|
protectedinherited |
Status of constraints/bounds.
Referenced by addIndex(), clear(), copy(), Bounds::flipFixed(), Constraints::flipFixed(), getStatus(), init(), removeIndex(), setStatus(), SubjectTo(), SubjectTo(), and swapIndex().
|
protectedinherited |
Type of constraints/bounds.
Referenced by clear(), copy(), getNumberOfType(), getType(), init(), setType(), SubjectTo(), and SubjectTo().