qpOASES  3.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
Indexlist Class Reference

Stores and manages index lists. More...

#include <Indexlist.hpp>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

int * number
int * iSort
int length
int first
int last
int lastusedindex
int 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.0
Date:
2007-2014

Constructor & Destructor Documentation

Default constructor.

References init(), iSort, and number.

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

Parameters:
nPhysical length of index list.

References init(), iSort, and number.

Indexlist::Indexlist ( const Indexlist rhs)

Copy constructor (deep copy).

Parameters:
rhsRhs object.

References copy().

Destructor.

References clear().


Member Function Documentation

returnValue Indexlist::addNumber ( int  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(), Constraints::rotate(), Bounds::rotate(), Constraints::shift(), and Bounds::shift().

returnValue Indexlist::clear ( ) [protected]

Frees all allocated memory.

Returns:
SUCCESSFUL_RETURN

References iSort, number, and SUCCESSFUL_RETURN.

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

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=().

int Indexlist::findInsert ( int  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().

int Indexlist::getIndex ( int  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(), and QProblem::removeConstraint().

returnValue Indexlist::getISortArray ( int **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.

int 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().

int Indexlist::getLength ( ) const [inline]

Returns the current length of the index list.

Returns:
Current length of the index list.

References length.

Referenced by Constraints::getNAC(), Bounds::getNFR(), Bounds::getNFX(), and Constraints::getNIAC().

BEGIN_NAMESPACE_QPOASES int Indexlist::getNumber ( int  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.

returnValue Indexlist::getNumberArray ( int **const  numberarray) const
returnValue Indexlist::init ( int  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().

BooleanType Indexlist::isMember ( int  _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().

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

Assingment operator (deep copy).

Parameters:
rhsRhs object.

References clear(), and copy().

returnValue Indexlist::removeNumber ( int  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().

returnValue Indexlist::swapNumbers ( int  number1,
int  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

int Indexlist::first [protected]

Physical index of first element.

int* Indexlist::iSort [protected]
int Indexlist::last [protected]

Physical index of last element.

int Indexlist::lastusedindex [protected]

Physical index of last entry in index list.

int Indexlist::length [protected]
int* Indexlist::number [protected]
int 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: