qpOASES 3.2.1
An Implementation of the Online Active Set Strategy
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Indexlist Class Reference

Stores and manages index lists. More...

#include <Indexlist.hpp>

Public Member Functions

 Indexlist ()
 
 Indexlist (int_t n)
 
 Indexlist (const Indexlist &rhs)
 
 ~Indexlist ()
 
Indexlistoperator= (const Indexlist &rhs)
 
returnValue init (int_t n=0)
 
returnValue getNumberArray (int_t **const numberarray) const
 
returnValue getISortArray (int_t **const iSortArray) const
 
int_t getIndex (int_t givennumber) const
 
int_t getNumber (int_t physicalindex) const
 
int_t getLength () const
 
int_t getLastNumber () const
 
returnValue addNumber (int_t addnumber)
 
returnValue removeNumber (int_t removenumber)
 
returnValue swapNumbers (int_t number1, int_t number2)
 
BooleanType isMember (int_t _number) const
 

Protected Member Functions

returnValue clear ()
 
returnValue copy (const Indexlist &rhs)
 
int_t findInsert (int_t i) const
 

Protected Attributes

int_tnumber
 
int_tiSort
 
int_t length
 
int_t first
 
int_t last
 
int_t lastusedindex
 
int_t physicallength
 

Friends

class DenseMatrix
 
class SymDenseMat
 
class SparseMatrix
 
class SparseMatrixRow
 
class SymSparseMat
 

Detailed Description

This class manages index lists of active/inactive bounds/constraints.

Author
Hans Joachim Ferreau
Version
3.2
Date
2007-2017

Constructor & Destructor Documentation

◆ Indexlist() [1/3]

BEGIN_NAMESPACE_QPOASES Indexlist::Indexlist ( )

Default constructor.

References init(), iSort, and number.

◆ Indexlist() [2/3]

Indexlist::Indexlist ( int_t  n)

Constructor which takes the desired physical length of the index list.

Parameters
nPhysical length of index list.

References init(), iSort, and number.

◆ Indexlist() [3/3]

Indexlist::Indexlist ( const Indexlist rhs)

Copy constructor (deep copy).

Parameters
rhsRhs object.

References copy().

◆ ~Indexlist()

Indexlist::~Indexlist ( )

Destructor.

References clear().

Member Function Documentation

◆ addNumber()

returnValue Indexlist::addNumber ( int_t  addnumber)

Adds number to index list.

Returns
SUCCESSFUL_RETURN
RET_INDEXLIST_MUST_BE_REORDERD
RET_INDEXLIST_EXCEEDS_MAX_LENGTH
Parameters
addnumberNumber to be added.

References findInsert(), iSort, length, number, physicallength, RET_INDEXLIST_EXCEEDS_MAX_LENGTH, SUCCESSFUL_RETURN, and THROWERROR.

Referenced by SubjectTo::addIndex(), Bounds::rotate(), Constraints::rotate(), Bounds::shift(), and Constraints::shift().

◆ clear()

returnValue Indexlist::clear ( )
protected

Frees all allocated memory.

Returns
SUCCESSFUL_RETURN

References iSort, number, and SUCCESSFUL_RETURN.

Referenced by init(), operator=(), and ~Indexlist().

◆ copy()

returnValue Indexlist::copy ( const Indexlist rhs)
protected

Copies all members from given rhs object.

Returns
SUCCESSFUL_RETURN
Parameters
rhsRhs object.

References iSort, length, number, physicallength, and SUCCESSFUL_RETURN.

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

◆ findInsert()

int_t Indexlist::findInsert ( int_t  i) const
protected

Find first index j between -1 and length in sorted list of indices iSort such that numbers[iSort[j]] <= i < numbers[iSort[j+1]]. Uses bisection.

Returns
j.

References iSort, length, and number.

Referenced by addNumber(), getIndex(), removeNumber(), and swapNumbers().

◆ getIndex()

int_t Indexlist::getIndex ( int_t  givennumber) const

Determines the index within the index list at which a given number is stored.

Returns
>= 0: Index of given number.
-1: Number not found.
Parameters
givennumberNumber whose index shall be determined.

References findInsert(), iSort, and number.

Referenced by QProblemB::addBound(), isMember(), QProblem::removeConstraint(), and SQProblemSchur::removeConstraint().

◆ getISortArray()

returnValue Indexlist::getISortArray ( int_t **const  iSortArray) const

Creates an array of all numbers within the index set in correct order.

Returns
SUCCESSFUL_RETURN
RET_INDEXLIST_CORRUPTED
Parameters
iSortArrayOutput: iSort Array.

References iSort, and SUCCESSFUL_RETURN.

Referenced by SQProblemSchur::determineStepDirection2().

◆ getLastNumber()

int_t Indexlist::getLastNumber ( ) const
inline

Returns last number within the index list.

Returns
Last number within the index list.

References length, and number.

Referenced by QProblem::addBound().

◆ getLength()

int_t Indexlist::getLength ( ) const
inline

◆ getNumber()

BEGIN_NAMESPACE_QPOASES int_t Indexlist::getNumber ( int_t  physicalindex) const
inline

Returns the number stored at a given physical index.

Returns
>= 0: Number stored at given physical index.
-RET_INDEXLIST_OUTOFBOUNDS
Parameters
physicalindexPhysical index of the number to be returned.

References length, number, and RET_INDEXLIST_OUTOFBOUNDS.

Referenced by SQProblemSchur::repairSingularWorkingSet().

◆ getNumberArray()

returnValue Indexlist::getNumberArray ( int_t **const  numberarray) const

Creates an array of all numbers within the index set in correct order.

Returns
SUCCESSFUL_RETURN
RET_INDEXLIST_CORRUPTED
Parameters
numberarrayOutput: Array of numbers (NULL on error).

References number, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and THROWERROR.

Referenced by QProblem::addBound(), SQProblemSchur::addBound(), SQProblemSchur::addBound_checkLISchur(), QProblem::addBound_ensureLI(), SQProblemSchur::addBound_ensureLI(), QProblem::addConstraint(), SQProblemSchur::addConstraint(), QProblem::addConstraint_checkLI(), SQProblemSchur::addConstraint_checkLISchur(), QProblem::addConstraint_ensureLI(), SQProblemSchur::addConstraint_ensureLI(), SolutionAnalysis::checkCurvatureOnStronglyActiveConstraints(), QProblemB::computeCholesky(), QProblem::computeProjectedCholesky(), SQProblemSchur::correctInertia(), QProblemB::determineDataShift(), QProblem::determineDataShift(), QProblemB::determineStepDirection(), QProblem::determineStepDirection(), SQProblemSchur::determineStepDirection2(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), QProblem::getFreeVariablesFlags(), Matrix::getSparseSubmatrix(), SolutionAnalysis::getVarianceCovariance(), QProblemB::performStep(), QProblem::performStep(), Bounds::print(), Constraints::print(), QProblemB::removeBound(), QProblem::removeBound(), SQProblemSchur::removeBound(), QProblem::removeConstraint(), SQProblemSchur::removeConstraint(), QProblem::setupTQfactorisation(), QProblem::solveCurrentEQP(), and QProblem::writeQpWorkspaceIntoMatFile().

◆ init()

returnValue Indexlist::init ( int_t  n = 0)

Initialises index list of desired physical length.

Returns
SUCCESSFUL_RETURN
RET_INVALID_ARGUMENTS
Parameters
nPhysical length of index list.

References clear(), iSort, length, number, physicallength, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and THROWERROR.

Referenced by Indexlist(), Bounds::init(), and Constraints::init().

◆ isMember()

BooleanType Indexlist::isMember ( int_t  _number) const
inline

Determines if a given number is contained in the index set.

Returns
BT_TRUE iff number is contain in the index set
Parameters
_numberNumber to be tested for membership.

References BT_FALSE, BT_TRUE, and getIndex().

◆ operator=()

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

Assingment operator (deep copy).

Parameters
rhsRhs object.

References clear(), and copy().

◆ removeNumber()

returnValue Indexlist::removeNumber ( int_t  removenumber)

Removes number from index list.

Returns
SUCCESSFUL_RETURN
Parameters
removenumberNumber to be removed.

References findInsert(), iSort, length, number, and SUCCESSFUL_RETURN.

Referenced by SubjectTo::removeIndex().

◆ swapNumbers()

returnValue Indexlist::swapNumbers ( int_t  number1,
int_t  number2 
)

Swaps two numbers within index list.

Returns
SUCCESSFUL_RETURN
Parameters
number1First number for swapping.
number2Second number for swapping.

References findInsert(), iSort, number, RET_INDEXLIST_CORRUPTED, SUCCESSFUL_RETURN, and THROWERROR.

Referenced by SubjectTo::swapIndex().

Member Data Documentation

◆ first

int_t Indexlist::first
protected

Physical index of first element.

◆ iSort

int_t* Indexlist::iSort
protected

◆ last

int_t Indexlist::last
protected

Physical index of last element.

◆ lastusedindex

int_t Indexlist::lastusedindex
protected

Physical index of last entry in index list.

◆ length

int_t Indexlist::length
protected

◆ number

int_t* Indexlist::number
protected

◆ physicallength

int_t Indexlist::physicallength
protected

Physical length of index list.

Referenced by addNumber(), copy(), and init().


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