Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of int where to store the indice and its length. The array will from then on be managed by the IdxSet. More...
#include <idxset.h>
Public Member Functions | |
Construction / destruction | |
IdxSet (int n, int imem[], int l=0) | |
constructor. More... | |
IdxSet () | |
default constructor. More... | |
virtual | ~IdxSet () |
destructor. More... | |
IdxSet & | operator= (const IdxSet &set) |
assignment operator. More... | |
IdxSet (const IdxSet &) | |
copy constructor. More... | |
Access | |
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... | |
Modification | |
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... | |
Consistency check | |
bool | isConsistent () const |
consistency check. More... | |
Protected Attributes | |
Data | |
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... | |
Set of indices.
Class IdxSet provides a set of indices. At construction it must be given an array of int where to store the indice and its length. The array will from then on be managed by the IdxSet.
Indices are implicitely numbered from 0 thru size()-1. They can be accessed (and altered) via method index() with the desired index number as argument. Range checking is performed in the debug version.
Indices may be added or removed from the set, by calling add() or remove() methods, respectively. However, no IdxSet can hold more then max() indices, i.e. the number given at the constructor.
When removing indices, the remaining ones are renumbered. However, all indices before the first removed index keep their number unchanged.
The internal structure of an IdxSet consists of an array idx storing the indices, its length len, and the actually used number of indices num. The class IdxSet doesn't allocate memory for the idx array. Instead, the user has to provide an adequate buffer to the constructor.
An IdxSet cannot be extended to fit more than max() elements. If necessary, the user must explicitely provide the IdxSet with a suitable memory. Alternatively, one can use DIdxSets which provide the required memory managemant.
IdxSet | ( | int | n, |
int | imem[], | ||
int | l = 0 |
||
) |
constructor.
The constructur receives the index memory imem
to use for saving its indices. This must be large enough to fit n
indices. l
can be given to construct an IdxSet initialized to the l
first indices in imem
.
Definition at line 80 of file idxset.h.
References IdxSet::isConsistent().
IdxSet | ( | ) |
default constructor.
The default constructor creates an index set with an empty index space. You cannot store any indices in an IdxSet created with the default constructor.
Definition at line 91 of file idxset.h.
References IdxSet::isConsistent().
Referenced by IdxSet::~IdxSet().
|
virtual |
destructor.
Definition at line 98 of file idxset.h.
References IdxSet::IdxSet(), IdxSet::operator=(), and soplex::spx_free().
copy constructor.
Definition at line 101 of file idxset.cpp.
References IdxSet::freeArray, IdxSet::idx, IdxSet::isConsistent(), IdxSet::len, IdxSet::max(), IdxSet::num, IdxSet::size(), and soplex::spx_alloc().
void add | ( | int | n | ) |
appends n
uninitialized indices.
Definition at line 149 of file idxset.h.
References IdxSet::max(), and IdxSet::size().
Referenced by DIdxSet::add(), IdxSet::add(), and SSVectorBase< Real >::setValue().
void add | ( | const IdxSet & | set | ) |
appends all indices of set
.
Definition at line 156 of file idxset.h.
References IdxSet::add(), and IdxSet::size().
void add | ( | int | n, |
const int | i[] | ||
) |
appends n
indices in i
.
Definition at line 41 of file idxset.cpp.
References IdxSet::add(), IdxSet::idx, IdxSet::max(), and IdxSet::size().
void addIdx | ( | int | i | ) |
appends index i
.
Definition at line 165 of file idxset.h.
References IdxSet::max(), and IdxSet::size().
Referenced by SSVectorBase< Real >::add(), DIdxSet::addIdx(), and SSVectorBase< Real >::assign2product().
void clear | ( | ) |
removes all indices.
Definition at line 184 of file idxset.h.
References IdxSet::isConsistent().
Referenced by SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxDevexPR::buildBestPriceVectorLeave(), SPxSteepPR::buildBestPriceVectorLeave(), SPxSolver::clear(), SSVectorBase< Real >::clear(), SPxSolver::computeCoTest(), SPxSolver::computeFtest(), SPxSolver::computeTest(), SPxDevexPR::setType(), SPxSteepPR::setType(), SSVectorBase< Real >::setup(), SPxSolver::solve(), SPxSolver::updateCoTest(), SPxSolver::updateFtest(), and SPxSolver::updateTest().
int dim | ( | ) | const |
returns the maximal index.
Definition at line 21 of file idxset.cpp.
References IdxSet::idx, and IdxSet::size().
Referenced by SSVectorBase< Real >::isConsistent(), and IdxSet::max().
int index | ( | int | n | ) | const |
access n
'th index.
Definition at line 118 of file idxset.h.
References IdxSet::size().
Referenced by SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxDevexPR::buildBestPriceVectorLeave(), SPxSteepPR::buildBestPriceVectorLeave(), SPxDevexPR::entered4(), SPxSteepPR::entered4(), SSVectorBase< Real >::index(), IdxSet::isConsistent(), SPxDevexPR::left4(), SPxSteepPR::left4(), SPxSolver::performSolutionPolishing(), SPxSolver::perturbMax(), SPxSolver::perturbMin(), soplex::reconstructVector(), SPxDefaultRT::selectEnter(), SPxDevexPR::selectEnterHyperCoDim(), SPxSteepPR::selectEnterHyperCoDim(), SPxDevexPR::selectEnterHyperDim(), SPxSteepPR::selectEnterHyperDim(), SPxDantzigPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxSteepPR::selectEnterSparseCoDim(), SPxDantzigPR::selectEnterSparseDim(), SPxDevexPR::selectEnterSparseDim(), SPxSteepPR::selectEnterSparseDim(), SPxDefaultRT::selectLeave(), SPxDevexPR::selectLeaveHyper(), SPxSteepPR::selectLeaveHyper(), SPxDantzigPR::selectLeaveSparse(), SPxDevexPR::selectLeaveSparse(), SPxSteepPR::selectLeaveSparse(), SPxSolver::updateCoTest(), SPxSolver::updateFtest(), and SPxSolver::updateTest().
bool isConsistent | ( | ) | const |
consistency check.
Definition at line 117 of file idxset.cpp.
References IdxSet::idx, IdxSet::index(), IdxSet::len, MSGinconsistent, and IdxSet::size().
Referenced by IdxSet::clear(), IdxSet::IdxSet(), SSVectorBase< Real >::isConsistent(), and IdxSet::operator=().
int max | ( | ) | const |
returns the maximal number of indices which can be stored in IdxSet.
Definition at line 129 of file idxset.h.
References IdxSet::dim(), IdxSet::len, and IdxSet::pos().
Referenced by DIdxSet::add(), IdxSet::add(), DIdxSet::addIdx(), IdxSet::addIdx(), SPxSolver::computeCoTest(), SPxSolver::computeTest(), IdxSet::IdxSet(), SSVectorBase< Real >::isConsistent(), IdxSet::operator=(), SSVectorBase< Real >::operator=(), DIdxSet::setMax(), SSVectorBase< Real >::setSize(), and SSVectorBase< Real >::setup_and_assign().
assignment operator.
The assignment operator copies all nonzeros of the right handside IdxSet to the left one. This implies, that the latter must have enough index memory.
Definition at line 71 of file idxset.cpp.
References IdxSet::freeArray, IdxSet::idx, IdxSet::isConsistent(), IdxSet::len, IdxSet::max(), IdxSet::num, IdxSet::size(), soplex::spx_alloc(), and soplex::spx_free().
Referenced by DIdxSet::DIdxSet(), DIdxSet::operator=(), SSVectorBase< Real >::operator=(), SSVectorBase< Real >::setup_and_assign(), SSVectorBase< Real >::SSVectorBase(), and IdxSet::~IdxSet().
int pos | ( | int | i | ) | const |
returns the position of index i
.
Finds the position of the first index i
in the IdxSet. If no index i
is available in the IdxSet, -1 is returned. Otherwise, index(pos(i
)) == i
holds.
Definition at line 32 of file idxset.cpp.
References IdxSet::idx, and IdxSet::size().
Referenced by soplex::LPFwriteGenerals(), IdxSet::max(), soplex::MPSreadBounds(), SSVectorBase< Real >::pos(), and SPxLPBase< Real >::writeMPS().
void remove | ( | int | n, |
int | m | ||
) |
removes indices at position numbers n
through m
.
Definition at line 51 of file idxset.cpp.
References IdxSet::idx, IdxSet::num, and IdxSet::size().
Referenced by SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxSolver::performSolutionPolishing(), SPxDevexPR::selectEnterHyperCoDim(), SPxSteepPR::selectEnterHyperCoDim(), SPxDevexPR::selectEnterHyperDim(), SPxSteepPR::selectEnterHyperDim(), SPxDantzigPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxSteepPR::selectEnterSparseCoDim(), SPxDantzigPR::selectEnterSparseDim(), SPxDevexPR::selectEnterSparseDim(), SPxSteepPR::selectEnterSparseDim(), SPxDevexPR::selectLeaveHyper(), SPxSteepPR::selectLeaveHyper(), SPxDantzigPR::selectLeaveSparse(), SPxDevexPR::selectLeaveSparse(), and SPxSteepPR::selectLeaveSparse().
void remove | ( | int | n | ) |
removes n
'th index.
Definition at line 174 of file idxset.h.
References IdxSet::num, and IdxSet::size().
int size | ( | ) | const |
returns the number of used indices.
Definition at line 124 of file idxset.h.
References IdxSet::num.
Referenced by DIdxSet::add(), IdxSet::add(), DIdxSet::addIdx(), IdxSet::addIdx(), SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxDevexPR::buildBestPriceVectorLeave(), SPxSteepPR::buildBestPriceVectorLeave(), SPxSolver::computeCoTest(), SPxSolver::computeTest(), DIdxSet::DIdxSet(), IdxSet::dim(), SPxDevexPR::entered4(), SPxSteepPR::entered4(), IdxSet::IdxSet(), IdxSet::index(), IdxSet::isConsistent(), SPxDevexPR::left4(), SPxSteepPR::left4(), soplex::LPFwriteGenerals(), DIdxSet::operator=(), IdxSet::operator=(), SPxSolver::performSolutionPolishing(), IdxSet::pos(), soplex::reconstructVector(), SSVectorBase< Real >::reDim(), IdxSet::remove(), SPxDefaultRT::selectEnter(), SPxDevexPR::selectEnterHyperCoDim(), SPxSteepPR::selectEnterHyperCoDim(), SPxDevexPR::selectEnterHyperDim(), SPxSteepPR::selectEnterHyperDim(), SPxDantzigPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxSteepPR::selectEnterSparseCoDim(), SPxDantzigPR::selectEnterSparseDim(), SPxDevexPR::selectEnterSparseDim(), SPxSteepPR::selectEnterSparseDim(), SPxDevexPR::selectEnterX(), SPxSteepPR::selectEnterX(), SPxDefaultRT::selectLeave(), SPxDevexPR::selectLeave(), SPxSteepPR::selectLeave(), SPxDevexPR::selectLeaveHyper(), SPxSteepPR::selectLeaveHyper(), SPxDantzigPR::selectLeaveSparse(), SPxDevexPR::selectLeaveSparse(), SPxSteepPR::selectLeaveSparse(), SSVectorBase< Real >::setMax(), DIdxSet::setMax(), SSVectorBase< Real >::size(), SPxSolver::updateCoTest(), SPxSolver::updateFtest(), SPxSolver::updateTest(), and SPxLPBase< Real >::writeMPS().
|
protected |
true iff idx should be freed inside of this object
Definition at line 66 of file idxset.h.
Referenced by IdxSet::IdxSet(), and IdxSet::operator=().
|
protected |
array of indices
Definition at line 65 of file idxset.h.
Referenced by IdxSet::add(), SSVectorBase< Real >::altIndexMem(), SSVectorBase< Real >::assign2product1(), SSVectorBase< Real >::assign2productAndSetup(), SSVectorBase< Real >::assign2productFull(), SSVectorBase< Real >::assign2productShort(), SSVectorBase< Real >::clear(), DIdxSet::DIdxSet(), IdxSet::dim(), IdxSet::IdxSet(), SSVectorBase< Real >::indexMem(), IdxSet::isConsistent(), SSVectorBase< Real >::length2(), SSVectorBase< Real >::maxAbs(), IdxSet::operator=(), SSVectorBase< Real >::operator=(), IdxSet::pos(), IdxSet::remove(), SSVectorBase< Real >::setMax(), DIdxSet::setMax(), SSVectorBase< Real >::setup(), SSVectorBase< Real >::setup_and_assign(), SSVectorBase< Real >::SSVectorBase(), SSVectorBase< Real >::value(), DIdxSet::~DIdxSet(), and SSVectorBase< Real >::~SSVectorBase().
|
protected |
length of array idx
Definition at line 64 of file idxset.h.
Referenced by DIdxSet::DIdxSet(), IdxSet::IdxSet(), IdxSet::isConsistent(), IdxSet::max(), IdxSet::operator=(), SSVectorBase< Real >::setMax(), DIdxSet::setMax(), and SSVectorBase< Real >::SSVectorBase().
|
protected |
number of used indices
Definition at line 63 of file idxset.h.
Referenced by SSVectorBase< Real >::assign2productAndSetup(), SSVectorBase< Real >::clear(), IdxSet::IdxSet(), SSVectorBase< Real >::length2(), SSVectorBase< Real >::maxAbs(), IdxSet::operator=(), SSVectorBase< Real >::operator=(), IdxSet::remove(), SSVectorBase< Real >::setSize(), SSVectorBase< Real >::setup(), SSVectorBase< Real >::setup_and_assign(), and IdxSet::size().