qpOASES
3.1.1
|
Base class for managing working sets of bounds and constraints. More...
#include <SubjectTo.hpp>
This class manages working sets of bounds and constraints by storing index sets and other status information.
SubjectTo::SubjectTo | ( | int | _n | ) |
SubjectTo::SubjectTo | ( | const SubjectTo & | rhs | ) |
SubjectTo::~SubjectTo | ( | ) | [virtual] |
Destructor.
References clear().
returnValue SubjectTo::addIndex | ( | Indexlist *const | indexlist, |
int | newnumber, | ||
SubjectToStatus | newstatus | ||
) | [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().
returnValue SubjectTo::clear | ( | ) | [protected] |
Frees all allocated memory.
Reimplemented in Bounds, and Constraints.
References status, SUCCESSFUL_RETURN, and type.
Referenced by init(), operator=(), and ~SubjectTo().
returnValue SubjectTo::copy | ( | const SubjectTo & | rhs | ) | [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().
BEGIN_NAMESPACE_QPOASES int SubjectTo::getNumberOfType | ( | SubjectToType | _type | ) | const [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().
SubjectToStatus SubjectTo::getStatus | ( | int | i | ) | const [inline] |
Returns status of (constraints') bound.
i | Number of (constraints') bound. |
References n, ST_UNDEFINED, and status.
Referenced by QProblem::addBound(), QProblem::addConstraint(), QProblem::determineStepDirection(), QProblemB::determineStepDirection(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), QProblemB::getWorkingSetBounds(), QProblem::getWorkingSetConstraints(), QProblemB::init(), QProblem::init(), QProblemB::obtainAuxiliaryWorkingSet(), QProblem::obtainAuxiliaryWorkingSet(), QProblem::performDriftCorrection(), QProblemB::performDriftCorrection(), QProblemB::performRamping(), QProblem::performRamping(), QProblemB::performRatioTest(), QProblem::removeBound(), QProblemB::removeBound(), QProblem::removeConstraint(), Constraints::rotate(), Bounds::rotate(), QProblem::setupAuxiliaryQP(), QProblemB::setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), QProblemB::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblem::shallRefactorise(), QProblemB::shallRefactorise(), Constraints::shift(), and Bounds::shift().
SubjectToType SubjectTo::getType | ( | int | i | ) | const [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(), QProblemB::performRamping(), QProblem::performRamping(), QProblemB::performRatioTest(), QProblem::performStep(), Constraints::rotate(), Bounds::rotate(), Constraints::setupAll(), Bounds::setupAll(), QProblem::setupAuxiliaryQPbounds(), QProblemB::setupAuxiliaryQPbounds(), QProblem::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblem::setupSubjectToType(), Constraints::shift(), and Bounds::shift().
BooleanType SubjectTo::hasNoLower | ( | ) | const [inline] |
Returns status of lower (constraints') bounds.
References noLower.
Referenced by QProblem::performStep(), QProblemB::performStep(), QProblem::printProperties(), and QProblemB::printProperties().
BooleanType SubjectTo::hasNoUpper | ( | ) | const [inline] |
Returns status of upper bounds.
References noUpper.
Referenced by QProblem::performStep(), QProblemB::performStep(), QProblem::printProperties(), and QProblemB::printProperties().
returnValue SubjectTo::init | ( | int | _n = 0 | ) |
Initialises object with given number of constraints or bounds.
_n | Number of constraints or bounds. |
Reimplemented in Bounds, and Constraints.
References BT_TRUE, clear(), n, noLower, noUpper, RET_INVALID_ARGUMENTS, ST_UNDEFINED, ST_UNKNOWN, status, SUCCESSFUL_RETURN, THROWERROR, and type.
Referenced by SubjectTo().
returnValue SubjectTo::removeIndex | ( | Indexlist *const | indexlist, |
int | removenumber | ||
) | [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().
virtual returnValue SubjectTo::rotate | ( | int | offset | ) | [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.
void SubjectTo::setNoLower | ( | BooleanType | _status | ) | [inline] |
Sets status of lower (constraints') bounds.
_status | Status of lower (constraints') bounds. |
References noLower.
Referenced by QProblemB::setupSubjectToType(), and QProblem::setupSubjectToType().
void SubjectTo::setNoUpper | ( | BooleanType | _status | ) | [inline] |
Sets status of upper (constraints') bounds.
_status | Status of upper (constraints') bounds. |
References noUpper.
Referenced by QProblemB::setupSubjectToType(), and QProblem::setupSubjectToType().
returnValue SubjectTo::setStatus | ( | int | i, |
SubjectToStatus | value | ||
) | [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(), Constraints::rotate(), Bounds::rotate(), SQProblem::setupNewAuxiliaryQP(), Constraints::shift(), and Bounds::shift().
returnValue SubjectTo::setType | ( | int | i, |
SubjectToType | value | ||
) | [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 Constraints::rotate(), Bounds::rotate(), QProblem::setA(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupSubjectToType(), QProblem::setupSubjectToType(), Constraints::shift(), and Bounds::shift().
virtual returnValue SubjectTo::shift | ( | int | offset | ) | [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.
returnValue SubjectTo::swapIndex | ( | Indexlist *const | indexlist, |
int | number1, | ||
int | number2 | ||
) | [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().
int SubjectTo::n [protected] |
Total number of constraints/bounds.
Referenced by copy(), Constraints::flipFixed(), Bounds::flipFixed(), Constraints::getNC(), getNumberOfType(), Bounds::getNV(), getStatus(), getType(), init(), Constraints::moveActiveToInactive(), Bounds::moveFixedToFree(), Bounds::moveFreeToFixed(), Constraints::moveInactiveToActive(), Constraints::print(), Bounds::print(), Constraints::rotate(), Bounds::rotate(), setStatus(), setType(), Constraints::setupAll(), Bounds::setupAll(), Bounds::setupBound(), Constraints::setupConstraint(), Constraints::shift(), Bounds::shift(), and Bounds::swapFree().
BooleanType SubjectTo::noLower [protected] |
This flag indicates if there is no lower bound on any variable.
Referenced by copy(), hasNoLower(), init(), and setNoLower().
BooleanType SubjectTo::noUpper [protected] |
This flag indicates if there is no upper bound on any variable.
Referenced by copy(), hasNoUpper(), init(), and setNoUpper().
SubjectToStatus* SubjectTo::status [protected] |
Status of constraints/bounds.
Referenced by addIndex(), clear(), copy(), Constraints::flipFixed(), Bounds::flipFixed(), getStatus(), init(), removeIndex(), setStatus(), SubjectTo(), and swapIndex().
SubjectToType* SubjectTo::type [protected] |
Type of constraints/bounds.
Referenced by clear(), copy(), getNumberOfType(), getType(), init(), setType(), and SubjectTo().