Scippy

SoPlex

Sequential object-oriented simPlex

DIdxSet Class Reference

Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed on the use of methods add(). However, method indexMem() has been moved to the private members. This is because DIdxSet adds its own memory management to class IdxSet and the user must not interfere with it. More...

#include <didxset.h>

Public Member Functions

Adding
void add (int n)
 adds n uninitialized indices. More...
 
void add (const IdxSet &sv)
 adds all indices from sv. More...
 
void add (int n, const int *i)
 adds n indices from i. More...
 
void addIdx (int i)
 adds index i to the index set More...
 
void setMax (int newmax=1)
 sets the maximum number of indices. More...
 
Construction / destruction
 DIdxSet (int n=8)
 default constructor. n gives the initial size of the index space. More...
 
 DIdxSet (const IdxSet &old)
 copy constructor from IdxSet. More...
 
 DIdxSet (const DIdxSet &old)
 copy constructor from DIdxSet. More...
 
DIdxSetoperator= (const IdxSet &sv)
 assignment operator from IdxSet More...
 
DIdxSetoperator= (const DIdxSet &sv)
 assignment operator from DIdxSet More...
 
virtual ~DIdxSet ()
 destructor. More...
 
- Public Member Functions inherited from IdxSet
 IdxSet (int n, int imem[], int l=0)
 constructor. More...
 
 IdxSet ()
 default constructor. More...
 
virtual ~IdxSet ()
 destructor. More...
 
IdxSetoperator= (const IdxSet &set)
 assignment operator. More...
 
 IdxSet (const IdxSet &)
 copy constructor. More...
 
int index (int n) const
 access n 'th index. More...
 
int size () const
 returns the number of used indices. More...
 
int max () const
 returns the maximal number of indices which can be stored in IdxSet. More...
 
int dim () const
 returns the maximal index. More...
 
int pos (int i) const
 returns the position of index i. More...
 
void add (int n)
 appends n uninitialized indices. More...
 
void add (const IdxSet &set)
 appends all indices of set. More...
 
void add (int n, const int i[])
 appends n indices in i. More...
 
void addIdx (int i)
 appends index i. More...
 
void remove (int n, int m)
 removes indices at position numbers n through m. More...
 
void remove (int n)
 removes n 'th index. More...
 
void clear ()
 removes all indices. More...
 
bool isConsistent () const
 consistency check. More...
 

Additional Inherited Members

- Protected Attributes inherited from IdxSet
int num
 number of used indices More...
 
int len
 length of array idx More...
 
int * idx
 array of indices More...
 
bool freeArray
 true iff idx should be freed inside of this object More...
 

Detailed Description

Dynamic index set.

Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed on the use of methods add(). However, method indexMem() has been moved to the private members. This is because DIdxSet adds its own memory management to class IdxSet and the user must not interfere with it.

Upon construction of an DIdxSet, memory is allocated automatically. The memory consumption can be controlled with methods max() and setMax(). Finally, the destructor will release all allocated memory.

Definition at line 42 of file didxset.h.

Constructor & Destructor Documentation

◆ DIdxSet() [1/3]

DIdxSet ( int  n = 8)
explicit

default constructor. n gives the initial size of the index space.

Definition at line 55 of file didxset.cpp.

References IdxSet::idx, IdxSet::len, and soplex::spx_alloc().

Referenced by DIdxSet::addIdx().

◆ DIdxSet() [2/3]

DIdxSet ( const IdxSet old)
explicit

copy constructor from IdxSet.

Definition at line 35 of file didxset.cpp.

References IdxSet::idx, IdxSet::len, IdxSet::operator=(), IdxSet::size(), and soplex::spx_alloc().

◆ DIdxSet() [3/3]

DIdxSet ( const DIdxSet old)

copy constructor from DIdxSet.

Definition at line 45 of file didxset.cpp.

References IdxSet::idx, IdxSet::len, IdxSet::operator=(), IdxSet::size(), and soplex::spx_alloc().

◆ ~DIdxSet()

~DIdxSet ( )
virtual

destructor.

Definition at line 62 of file didxset.cpp.

References IdxSet::idx, and soplex::spx_free().

Referenced by DIdxSet::operator=().

Member Function Documentation

◆ add() [1/3]

void add ( int  n)

adds n uninitialized indices.

Definition at line 50 of file didxset.h.

References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().

◆ add() [2/3]

void add ( const IdxSet sv)

adds all indices from sv.

Definition at line 59 of file didxset.h.

References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().

◆ add() [3/3]

void add ( int  n,
const int *  i 
)

adds n indices from i.

Definition at line 70 of file didxset.h.

References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().

◆ addIdx()

◆ operator=() [1/2]

DIdxSet& operator= ( const IdxSet sv)

assignment operator from IdxSet

Definition at line 108 of file didxset.h.

References IdxSet::operator=(), DIdxSet::setMax(), and IdxSet::size().

◆ operator=() [2/2]

DIdxSet& operator= ( const DIdxSet sv)

assignment operator from DIdxSet

Definition at line 119 of file didxset.h.

References IdxSet::operator=(), DIdxSet::setMax(), IdxSet::size(), and DIdxSet::~DIdxSet().

◆ setMax()

void setMax ( int  newmax = 1)

sets the maximum number of indices.

This methods resets the memory consumption of the DIdxSet to newmax. However, if newmax < size(), it is reset to size() only.

Definition at line 22 of file didxset.cpp.

References IdxSet::idx, IdxSet::len, IdxSet::max(), IdxSet::size(), and soplex::spx_realloc().

Referenced by DIdxSet::add(), DIdxSet::addIdx(), SPxSolver::hyperPricing(), SPxSolver::init(), DIdxSet::operator=(), SPxDevexPR::setType(), and SPxSteepPR::setType().