qpOASES 3.2.1
An Implementation of the Online Active Set Strategy
|
Base class for managing working sets of bounds and constraints. More...
#include <SubjectTo.hpp>
Public Member Functions | |
SubjectTo () | |
SubjectTo (int_t _n) | |
SubjectTo (const SubjectTo &rhs) | |
virtual | ~SubjectTo () |
SubjectTo & | operator= (const SubjectTo &rhs) |
returnValue | init (int_t _n=0) |
int_t | getNumberOfType (SubjectToType _type) const |
SubjectToType | getType (int_t i) const |
SubjectToStatus | getStatus (int_t i) const |
returnValue | setType (int_t i, SubjectToType value) |
returnValue | setStatus (int_t i, SubjectToStatus value) |
void | setNoLower (BooleanType _status) |
void | setNoUpper (BooleanType _status) |
BooleanType | hasNoLower () const |
BooleanType | hasNoUpper () const |
virtual returnValue | shift (int_t offset)=0 |
virtual returnValue | rotate (int_t offset)=0 |
Protected Member Functions | |
returnValue | clear () |
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 | |
int_t | n |
SubjectToType * | type |
SubjectToStatus * | status |
BooleanType | noLower |
BooleanType | noUpper |
This class manages working sets of bounds and constraints by storing index sets and other status information.
BEGIN_NAMESPACE_QPOASES SubjectTo::SubjectTo | ( | ) |
SubjectTo::SubjectTo | ( | int_t | _n | ) |
SubjectTo::SubjectTo | ( | const SubjectTo & | rhs | ) |
|
virtual |
Destructor.
References clear().
|
protected |
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 status, SUCCESSFUL_RETURN, and type.
Referenced by init(), operator=(), and ~SubjectTo().
|
protected |
Copies all members from given rhs object.
rhs | Rhs object. |
References n, noLower, noUpper, status, SUCCESSFUL_RETURN, and type.
Referenced by operator=(), and SubjectTo().
|
inline |
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 status of (constraints') bound.
i | Number of (constraints') bound. |
References n, ST_UNDEFINED, and status.
Referenced by QProblem::addBound(), SQProblemSchur::addBound(), QProblem::addConstraint(), SQProblemSchur::addConstraint(), SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints(), QProblemB::determineStepDirection(), QProblem::determineStepDirection(), SQProblemSchur::determineStepDirection2(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), QProblemB::getWorkingSetBounds(), QProblem::getWorkingSetConstraints(), QProblemB::init(), QProblem::init(), QProblemB::obtainAuxiliaryWorkingSet(), QProblem::obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), QProblemB::performDriftCorrection(), QProblem::performRamping(), QProblemB::performRamping(), QProblemB::performRatioTest(), QProblemB::removeBound(), QProblem::removeBound(), SQProblemSchur::removeBound(), QProblem::removeConstraint(), SQProblemSchur::removeConstraint(), Bounds::rotate(), Constraints::rotate(), QProblemB::setupAuxiliaryQP(), QProblem::setupAuxiliaryQP(), SQProblemSchur::setupAuxiliaryQP(), QProblemB::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryQPbounds(), QProblemB::setupAuxiliaryWorkingSet(), QProblem::setupAuxiliaryWorkingSet(), SQProblemSchur::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblemB::shallRefactorise(), QProblem::shallRefactorise(), Bounds::shift(), Constraints::shift(), and QProblem::updateActivitiesForHotstart().
|
inline |
Returns type of (constraints') bound.
i | Number of (constraints') bound. |
References n, ST_UNKNOWN, and type.
Referenced by QProblem::dropInfeasibles(), QProblemB::obtainAuxiliaryWorkingSet(), QProblem::obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), QProblemB::performDriftCorrection(), QProblem::performRamping(), QProblemB::performRamping(), QProblemB::performRatioTest(), QProblem::performStep(), SQProblemSchur::repairSingularWorkingSet(), Bounds::rotate(), Constraints::rotate(), Bounds::setupAll(), Constraints::setupAll(), SQProblemSchur::setupAuxiliaryQP(), QProblemB::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblem::setupSubjectToType(), Bounds::shift(), Constraints::shift(), and QProblem::updateActivitiesForHotstart().
|
inline |
Returns status of lower (constraints') bounds.
References noLower.
Referenced by QProblemB::performStep(), QProblem::performStep(), and QProblem::printProperties().
|
inline |
Returns status of upper bounds.
References noUpper.
Referenced by QProblemB::performStep(), QProblem::performStep(), and QProblem::printProperties().
returnValue SubjectTo::init | ( | int_t | _n = 0 | ) |
Initialises object with given number of constraints or bounds.
_n | Number of constraints or bounds. |
References BT_TRUE, clear(), n, noLower, noUpper, RET_INVALID_ARGUMENTS, ST_UNDEFINED, ST_UNKNOWN, status, SUCCESSFUL_RETURN, THROWERROR, and type.
Referenced by Bounds::init(), Constraints::init(), and SubjectTo().
Assignment operator (deep copy).
rhs | Rhs object. |
References clear(), and copy().
Referenced by Bounds::operator=(), and Constraints::operator=().
|
protected |
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().
|
pure virtual |
Rotates forward type and status of all constraints/bounds by a given offset. This offset has to lie within the range [0,n]. Example for offset = 2:
rotate( {c/b1,c/b2,c/b3,c/b4,c/b5,c/b6} ) = {c/b3,c/b4,c/b5,c/b6,c/b1,c/b2}
offset | Rotation offset within the range [0,n]. |
Implemented in Bounds, and Constraints.
|
inline |
Sets status of lower (constraints') bounds.
_status | Status of lower (constraints') bounds. |
References noLower.
Referenced by QProblemB::setupSubjectToType(), and QProblem::setupSubjectToType().
|
inline |
Sets status of upper (constraints') bounds.
_status | Status of upper (constraints') bounds. |
References noUpper.
Referenced by QProblemB::setupSubjectToType(), and QProblem::setupSubjectToType().
|
inline |
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 QProblem::dropInfeasibles(), Bounds::rotate(), Constraints::rotate(), SQProblemSchur::setupAuxiliaryQP(), SQProblem::setupNewAuxiliaryQP(), Bounds::shift(), and Constraints::shift().
|
inline |
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 SQProblemSchur::repairSingularWorkingSet(), Bounds::rotate(), Constraints::rotate(), QProblem::setA(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupSubjectToType(), QProblem::setupSubjectToType(), Bounds::shift(), and Constraints::shift().
|
pure virtual |
Shifts forward type and status of all constraints/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 constraints/bounds n. Type and status of the first <offset> constraints/bounds is thrown away, type and status of the last <offset> constraints/bounds is doubled, e.g. for offset = 2:
shift( {c/b1,c/b2,c/b3,c/b4,c/b5,c/b6} ) = {c/b3,c/b4,c/b5,c/b6,c/b5,c/b6}
offset | Shift offset within the range [0,n/2] and integer divisor of n. |
Implemented in Bounds, and Constraints.
|
protected |
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 |
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().
|
protected |
This flag indicates if there is no lower bound on any variable.
Referenced by copy(), hasNoLower(), init(), and setNoLower().
|
protected |
This flag indicates if there is no upper bound on any variable.
Referenced by copy(), hasNoUpper(), init(), and setNoUpper().
|
protected |
Status of constraints/bounds.
Referenced by addIndex(), clear(), copy(), Bounds::flipFixed(), Constraints::flipFixed(), getStatus(), init(), removeIndex(), setStatus(), SubjectTo(), and swapIndex().
|
protected |
Type of constraints/bounds.
Referenced by clear(), copy(), getNumberOfType(), getType(), init(), setType(), and SubjectTo().