qpOASES  3.2.1
An Implementation of the Online Active Set Strategy
Public Member Functions | Protected Member Functions | Protected Attributes
SubjectTo Class Reference

Base class for managing working sets of bounds and constraints. More...

#include <SubjectTo.hpp>

Inheritance diagram for SubjectTo:
Bounds Constraints

List of all members.

Public Member Functions

 SubjectTo ()
 SubjectTo (int_t _n)
 SubjectTo (const SubjectTo &rhs)
virtual ~SubjectTo ()
SubjectTooperator= (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
SubjectToTypetype
SubjectToStatusstatus
BooleanType noLower
BooleanType noUpper

Detailed Description

This class manages working sets of bounds and constraints by storing index sets and other status information.

Author:
Hans Joachim Ferreau
Version:
3.2
Date:
2007-2017

Constructor & Destructor Documentation

Default constructor.

References init(), status, and type.

Constructor which takes the number of constraints or bounds.

Parameters:
_nNumber of constraints or bounds.

References init(), status, and type.

SubjectTo::SubjectTo ( const SubjectTo rhs)

Copy constructor (deep copy).

Parameters:
rhsRhs object.

References copy().

SubjectTo::~SubjectTo ( ) [virtual]

Destructor.

References clear().


Member Function Documentation

returnValue SubjectTo::addIndex ( Indexlist *const  indexlist,
int_t  newnumber,
SubjectToStatus  newstatus 
) [protected]

Adds the index of a new constraint or bound to index set.

Returns:
SUCCESSFUL_RETURN
RET_ADDINDEX_FAILED
RET_INVALID_ARGUMENTS
Parameters:
indexlistIndex list to which the new index shall be added.
newnumberNumber of new constraint or bound.
newstatusStatus 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.

Returns:
SUCCESSFUL_RETURN

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.

Returns:
SUCCESSFUL_RETURN
Parameters:
rhsRhs object.

References n, noLower, noUpper, status, SUCCESSFUL_RETURN, and type.

Referenced by operator=(), and SubjectTo().

Returns number of constraints/bounds with given SubjectTo type.

Returns:
Number of constraints/bounds with given type.
Parameters:
_typeType of (constraints') bound.

References n, and type.

Referenced by Bounds::getNBV(), Constraints::getNEC(), Bounds::getNFV(), Constraints::getNIC(), Constraints::getNUC(), and Bounds::getNUV().

Returns status of (constraints') bound.

Returns:
Status of (constraints') bound
ST_UNDEFINED
Parameters:
iNumber of (constraints') bound.

References n, ST_UNDEFINED, and status.

Referenced by SQProblemSchur::addBound(), QProblem::addBound(), SQProblemSchur::addConstraint(), QProblem::addConstraint(), SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints(), QProblem::determineStepDirection(), QProblemB::determineStepDirection(), SQProblemSchur::determineStepDirection2(), 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(), SQProblemSchur::removeBound(), QProblem::removeBound(), QProblemB::removeBound(), SQProblemSchur::removeConstraint(), QProblem::removeConstraint(), Constraints::rotate(), Bounds::rotate(), SQProblemSchur::setupAuxiliaryQP(), QProblem::setupAuxiliaryQP(), QProblemB::setupAuxiliaryQP(), QProblem::setupAuxiliaryQPbounds(), QProblemB::setupAuxiliaryQPbounds(), SQProblemSchur::setupAuxiliaryWorkingSet(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupAuxiliaryWorkingSet(), SQProblem::setupNewAuxiliaryQP(), QProblem::shallRefactorise(), QProblemB::shallRefactorise(), Constraints::shift(), Bounds::shift(), and QProblem::updateActivitiesForHotstart().

SubjectToType SubjectTo::getType ( int_t  i) const [inline]
BooleanType SubjectTo::hasNoLower ( ) const [inline]

Returns status of lower (constraints') bounds.

Returns:
BT_TRUE if there is no lower (constraints') bound on any variable.

References noLower.

Referenced by QProblem::performStep(), QProblemB::performStep(), QProblem::printProperties(), and QProblemB::printProperties().

BooleanType SubjectTo::hasNoUpper ( ) const [inline]

Returns status of upper bounds.

Returns:
BT_TRUE if there is no upper (constraints') bound on any variable.

References noUpper.

Referenced by QProblem::performStep(), QProblemB::performStep(), QProblem::printProperties(), and QProblemB::printProperties().

Initialises object with given number of constraints or bounds.

Returns:
SUCCESSFUL_RETURN
RET_INVALID_ARGUMENTS
Parameters:
_nNumber 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().

SubjectTo & SubjectTo::operator= ( const SubjectTo rhs)

Assignment operator (deep copy).

Parameters:
rhsRhs object.

References clear(), and copy().

returnValue SubjectTo::removeIndex ( Indexlist *const  indexlist,
int_t  removenumber 
) [protected]

Removes the index of a constraint or bound from index set.

Returns:
SUCCESSFUL_RETURN
RET_REMOVEINDEX_FAILED
RET_INVALID_ARGUMENTS
Parameters:
indexlistIndex list from which the new index shall be removed.
removenumberNumber 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_t  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}

Returns:
SUCCESSFUL_RETURN
RET_INDEX_OUT_OF_BOUNDS
RET_ROTATING_FAILED
Parameters:
offsetRotation offset within the range [0,n].

Implemented in Bounds, and Constraints.

void SubjectTo::setNoLower ( BooleanType  _status) [inline]

Sets status of lower (constraints') bounds.

Parameters:
_statusStatus 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.

Parameters:
_statusStatus of upper (constraints') bounds.

References noUpper.

Referenced by QProblemB::setupSubjectToType(), and QProblem::setupSubjectToType().

Sets status of (constraints') bound.

Returns:
SUCCESSFUL_RETURN
RET_INDEX_OUT_OF_BOUNDS
Parameters:
iNumber of (constraints') bound.
valueStatus of (constraints') bound.

References n, RET_INDEX_OUT_OF_BOUNDS, status, SUCCESSFUL_RETURN, and THROWERROR.

Referenced by QProblem::dropInfeasibles(), Constraints::rotate(), Bounds::rotate(), SQProblemSchur::setupAuxiliaryQP(), SQProblem::setupNewAuxiliaryQP(), Constraints::shift(), and Bounds::shift().

returnValue SubjectTo::setType ( int_t  i,
SubjectToType  value 
) [inline]

Sets type of (constraints') bound.

Returns:
SUCCESSFUL_RETURN
RET_INDEX_OUT_OF_BOUNDS
Parameters:
iNumber of (constraints') bound.
valueType of (constraints') bound.

References n, RET_INDEX_OUT_OF_BOUNDS, SUCCESSFUL_RETURN, THROWERROR, and type.

Referenced by SQProblemSchur::repairSingularWorkingSet(), Constraints::rotate(), Bounds::rotate(), QProblem::setA(), QProblem::setupAuxiliaryWorkingSet(), QProblemB::setupSubjectToType(), QProblem::setupSubjectToType(), Constraints::shift(), and Bounds::shift().

virtual returnValue SubjectTo::shift ( int_t  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}

Returns:
SUCCESSFUL_RETURN
RET_INDEX_OUT_OF_BOUNDS
RET_INVALID_ARGUMENTS
RET_SHIFTING_FAILED
Parameters:
offsetShift offset within the range [0,n/2] and integer divisor of n.

Implemented in Bounds, and Constraints.

returnValue SubjectTo::swapIndex ( Indexlist *const  indexlist,
int_t  number1,
int_t  number2 
) [protected]

Swaps the indices of two constraints or bounds within the index set.

Returns:
SUCCESSFUL_RETURN
RET_SWAPINDEX_FAILED
RET_INVALID_ARGUMENTS
Parameters:
indexlistIndex list in which the indices shold be swapped.
number1Number of first constraint or bound.
number2Number 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().


Member Data Documentation

int_t SubjectTo::n [protected]

This flag indicates if there is no lower bound on any variable.

Referenced by copy(), hasNoLower(), init(), and setNoLower().

This flag indicates if there is no upper bound on any variable.

Referenced by copy(), hasNoUpper(), init(), and setNoUpper().

Type of constraints/bounds.

Referenced by clear(), copy(), getNumberOfType(), getType(), init(), setType(), and SubjectTo().


The documentation for this class was generated from the following files: