|
Loading...
Searching...
No Matches
Sparse vector set.
More...
#include <svsetbase.h>
|
|
void | add (const SVectorBase< R > &svec) |
| Adds svec to the set.
|
|
void | add (DataKey &nkey, const SVectorBase< R > &svec) |
| Adds svec to SVSetBase.
|
|
template<class S > |
void | add (DataKey &nkey, const S *rowValues, const int *rowIndices, int rowSize) |
| Adds svec to SVSetBase.
|
|
void | add (const SVectorBase< R > svec[], int n) |
| Adds all n SVectorBases in the array svec to the set.
|
|
void | add (DataKey nkey[], const SVectorBase< R > svec[], int n) |
| Adds n SVectorBases to SVSetBase.
|
|
template<class S > |
void | add (const SVSetBase< S > &pset) |
| Adds all SVectorBases in pset to SVSetBase.
|
|
template<class S > |
void | add (DataKey nkey[], const SVSetBase< S > &pset) |
| Adds all SVectorBases of pset to SVSetBase.
|
|
SVectorBase< R > * | create (int idxmax=0) |
| Creates new SVectorBase in set.
|
|
SVectorBase< R > * | create (DataKey &nkey, int idxmax=-1) |
| Creates new SVectorBase in set.
|
|
void | xtend (SVectorBase< R > &svec, int newmax) |
| Extends svec to fit newmax nonzeros.
|
|
void | add2 (SVectorBase< R > &svec, int idx, R val) |
| Adds nonzero (idx , val ) to svec of this SVSetBase.
|
|
void | add2 (SVectorBase< R > &svec, int n, const int idx[], const R val[]) |
| Adds n nonzeros to svec of this SVSetBase.
|
|
template<class S > |
void | add2 (SVectorBase< R > &svec, int n, const int idx[], const S val[]) |
| Adds n nonzeros to svec of this SVSetBase.
|
|
|
void | remove (const DataKey &removekey) |
| Removes the vector with key removekey from the set.
|
|
void | remove (int removenum) |
| Removes the vector with number removenum from the set.
|
|
void | remove (const SVectorBase< R > *svec) |
| Removes one SVectorBase from set.
|
|
void | remove (int perm[]) |
| Removes multiple elements.
|
|
void | remove (const DataKey keys[], int n) |
| Removes n SVectorBases from set.
|
|
void | remove (const int nums[], int n) |
| Removes n SVectorBases from set.
|
|
void | remove (const DataKey keys[], int n, int *perm) |
|
void | remove (const int nums[], int n, int *perm) |
|
void | clear (int minNewSize=-1) |
| Removes all SVectorBases from set.
|
|
|
SVectorBase< R > & | operator[] (int n) |
| Gets SVectorBase by number, writeable.
|
|
const SVectorBase< R > & | operator[] (int n) const |
| Gets SVectorBase by number.
|
|
SVectorBase< R > & | operator[] (const DataKey &k) |
| Gets SVectorBase by DataKey, writeable.
|
|
const SVectorBase< R > & | operator[] (const DataKey &k) const |
| Gets SVectorBase by DataKey.
|
|
|
int | num () const |
| Current number of SVectorBases.
|
|
int | max () const |
| Current maximum number of SVectorBases.
|
|
DataKey | key (int n) const |
| Gets DataKey of vector number.
|
|
DataKey | key (const SVectorBase< R > *svec) const |
| Gets DataKey of SVectorBase.
|
|
int | number (const DataKey &k) const |
| Gets vector number of DataKey.
|
|
int | number (const SVectorBase< R > *svec) const |
| Gets vector number of SVectorBase.
|
|
bool | has (const DataKey &k) const |
| True iff SVSetBase contains a SVectorBase for DataKey k .
|
|
bool | has (int n) const |
| True iff SVSetBase contains a SVectorBase for vector number n.
|
|
bool | has (const SVectorBase< R > *svec) const |
| Is an SVectorBase in the set?
|
|
|
int | memSize () const |
| Used nonzero memory.
|
|
int | memMax () const |
| Length of nonzero memory.
|
|
void | memRemax (int newmax) |
| Reset length of nonzero memory.
|
|
void | memPack () |
| Garbage collection in nonzero memory.
|
|
|
void | reMax (int newmax=0) |
| Resets maximum number of SVectorBases.
|
|
bool | isConsistent () const |
| Consistency check.
|
|
|
| SVSetBase (int pmax=-1, int pmemmax=-1, double pfac=1.1, double pmemFac=1.2) |
| Default constructor.
|
|
virtual | ~SVSetBase () |
| Destructor.
|
|
SVSetBase< R > & | operator= (const SVSetBase< R > &rhs) |
| Assignment operator.
|
|
template<class S > |
SVSetBase< R > & | operator= (const SVSetBase< S > &rhs) |
| Assignment operator.
|
|
| SVSetBase (const SVSetBase< R > &old) |
| Copy constructor.
|
|
template<class S > |
| SVSetBase (const SVSetBase< S > &old) |
| Copy constructor.
|
|
|
Nonzero< R > & | operator[] (int n) |
| Reference to n 'th element.
|
|
const Nonzero< R > & | operator[] (int n) const |
| Reference to n 'th const element.
|
|
Nonzero< R > & | last () |
| Reference to last element.
|
|
const Nonzero< R > & | last () const |
| Reference to last const element.
|
|
Nonzero< R > * | get_ptr () |
| Gets a C pointer to the data.
|
|
const Nonzero< R > * | get_const_ptr () const |
| Gets a const C pointer to the data.
|
|
void | append (const Nonzero< R > &t) |
| Appends element t .
|
|
void | append (int n, const Nonzero< R > t[]) |
| Appends n elements from t .
|
|
void | append (const ClassArray< Nonzero< R > > &t) |
| Appends all elements from t .
|
|
void | insert (int i, int n) |
| Inserts n uninitialized elements before i 'th element.
|
|
void | insert (int i, int n, const Nonzero< R > t[]) |
| Inserts n elements from t before i 'the element.
|
|
void | insert (int i, const ClassArray< Nonzero< R > > &t) |
| Inserts all elements from t before i 'th element.
|
|
void | remove (int n=0, int m=1) |
| Removes m elements starting at n .
|
|
void | removeLast (int m=1) |
| Removes m last elements.
|
|
void | clear () |
| Removes all elements.
|
|
int | size () const |
| Returns number of elements.
|
|
void | reSize (int newsize) |
| Resets size to newsize .
|
|
int | max () const |
| Returns maximum number of elements.
|
|
ptrdiff_t | reMax (int newMax=1, int newSize=-1) |
| Resets maximum number of elements.
|
|
ClassArray & | operator= (const ClassArray &rhs) |
| Assignment operator.
|
|
bool | isConsistent () const |
| Consistency check.
|
|
| ClassArray (const ClassArray &old) |
| Copy constructor.
|
|
| ClassArray (int p_size=0, int p_max=0, double p_fac=1.2) |
| Default constructor.
|
|
virtual | ~ClassArray () |
| Destructor.
|
|
int | thesize |
| number of used elements in array data
|
|
int | themax |
| the length of array data and
|
|
Nonzero< R > * | data |
| the array of elements
|
|
double | memFactor |
| memory extension factor.
|
|
template< class R>
class soplex::SVSetBase< R > Sparse vector set.
Class SVSetBase provides a set of sparse vectors SVectorBase. All SVectorBases in an SVSetBase share one big memory block for their nonzeros. This memory is referred to as the nonzero memory. The SVectorBases themselves are saved in another memory block referred to as the vector memory. Both memory blocks will grow automatically if required, when adding more SVectorBases to the set or enlarging SVectorBases within the set. For controlling memory consumption, methods are provided to inquire and reset the size of the memory blocks used for vectors and nonzeros.
SVectorBases in an SVSetBase are numbered from 0 thru num()-1. They can be accessed using the index operator[](). When removing SVectorBases of a SVSetBase the remaining ones will be renumbered. However, all SVectorBase with a smaller number than the lowest number of the removed SVectorBases will remain unchanged.
For providing a uniform access to SVectorBases in a set even if others are removed or added, SVSetBase assigns a DataKey to each SVectorBase in the set. Such a DataKey remains unchanged as long as the corresponding SVectorBase is in the SVSetBase, no matter what other SVectorBases are added to or removed from the SVSetBase. Methods are provided for getting the DataKey to a SVectorBase or its number and vice versa. Further, each add() method for enlarging an SVSetBase is provided with two signatures. One of them returns the DataKeys assigned to the SVectorBases added to the SVSetBase.
Definition at line 72 of file svsetbase.h.
◆ SVSetBaseArray
◆ SVSetBase() [1/3]
◆ ~SVSetBase()
◆ SVSetBase() [2/3]
◆ SVSetBase() [3/3]
◆ add() [1/7]
Adds svec to the set.
This includes copying its nonzeros to the sets nonzero memory and creating an additional SVectorBase entry in vector memory. If neccessary, the memory blocks are enlarged appropriately.
Definition at line 352 of file svsetbase.h.
References SVSetBase< R >::create(), SVSetBase< R >::ensurePSVec(), and SVSetBase< R >::number().
Referenced by LPColSetBase< R >::add(), LPRowSetBase< R >::add(), LPRowSetBase< R >::add(), LPColSetBase< R >::add(), LPRowSetBase< R >::add(), LPColSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), and SVSetBase< R >::operator=().
◆ add() [2/7]
◆ add() [3/7]
◆ add() [4/7]
◆ add() [5/7]
◆ add() [6/7]
◆ add() [7/7]
◆ add2() [1/3]
◆ add2() [2/3]
◆ add2() [3/3]
◆ clear()
◆ countUnusedMem()
◆ create() [1/2]
◆ create() [2/2]
Creates new SVectorBase in set.
The new SVectorBase will be ready to fit at least idxmax nonzeros.
Definition at line 476 of file svsetbase.h.
References ClassArray< Nonzero< R > >::data, SVSetBase< R >::ensureMem(), SVSetBase< R >::ensurePSVec(), ClassArray< Nonzero< R > >::last(), SVSetBase< R >::list, SVSetBase< R >::memSize(), SVSetBase< R >::number(), ClassArray< Nonzero< R > >::reSize(), and SVSetBase< R >::set.
Referenced by SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), LPRowSetBase< R >::create(), LPColSetBase< R >::create(), and SVSetBase< R >::create().
◆ deleteVec()
Deleting a vector from the data array and the list.
Definition at line 292 of file svsetbase.h.
References SPxOut::debug(), SVSetBase< R >::list, SVectorBase< R >::max(), SVectorBase< R >::mem(), SVSetBase< R >::number(), ClassArray< Nonzero< R > >::removeLast(), SVectorBase< R >::set_size(), SVectorBase< R >::setMem(), SVectorBase< R >::size(), and SVSetBase< R >::updateUnusedMemEstimation().
Referenced by SVSetBase< R >::remove(), and SVSetBase< R >::remove().
◆ ensureMem()
Provides enough nonzero memory for n more Nonzeros.
- Todo
- use an independent parameter "memwastefactor" here
Definition at line 247 of file svsetbase.h.
References SPxOut::debug(), SVSetBase< R >::list, SVectorBase< R >::max(), ClassArray< Nonzero< R > >::memFactor, SVSetBase< R >::memMax(), SVSetBase< R >::memPack(), SVSetBase< R >::memRemax(), SVSetBase< R >::memSize(), SVSetBase< R >::number(), ClassArray< Nonzero< R > >::removeLast(), SVSetBase< R >::unusedMem, and SVSetBase< R >::updateUnusedMemEstimation().
Referenced by SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::create(), and SVSetBase< R >::xtend().
◆ ensurePSVec()
◆ has() [1/3]
◆ has() [2/3]
◆ has() [3/3]
◆ isConsistent()
bool isConsistent |
( |
| ) |
const |
Consistency check.
Definition at line 981 of file svsetbase.h.
References ClassArray< Nonzero< R > >::isConsistent(), SVectorBase< R >::isConsistent(), ClassArray< Nonzero< R > >::last(), SVSetBase< R >::list, SVectorBase< R >::mem(), SVSetBase< R >::DLPSV::next(), SVSetBase< R >::number(), SVSetBase< R >::set, and SPX_MSG_INCONSISTENT.
Referenced by LPColSetBase< R >::isConsistent(), LPRowSetBase< R >::isConsistent(), SVSetBase< R >::operator=(), SVSetBase< R >::operator=(), SVSetBase< R >::SVSetBase(), SVSetBase< R >::SVSetBase(), and SVSetBase< R >::SVSetBase().
◆ key() [1/2]
◆ key() [2/2]
◆ max()
◆ memMax()
◆ memPack()
Garbage collection in nonzero memory.
Pack the svectors together as tightly as possible. This removes all additional unused memory, i.e., size = max for every svector after the call.
Note: do not call isConsistent() here, because the following might happen: In SPxLP::doAddRows(const LPRowSet&
p_set), when adding rows, the sizes of the vectors for the columns of the LP are increased (without yet filling in the data) to recieve the additional entries. This is done by calling xtend() above. xtend() in turn might call this method, which checks the yet unfilled positions, i.e., isConsistent() is likely to fail. In general, isConsistent() should not be called within this class, but in classes further up in the hierarchy.
Definition at line 923 of file svsetbase.h.
References ClassArray< Nonzero< R > >::data, SPxOut::debug(), SVSetBase< R >::list, SVSetBase< R >::memMax(), SVSetBase< R >::memSize(), SVSetBase< R >::number(), SVSetBase< R >::numUnusedMemUpdates, ClassArray< Nonzero< R > >::operator[](), ClassArray< Nonzero< R > >::reSize(), SVectorBase< R >::size(), and SVSetBase< R >::unusedMem.
Referenced by SVSetBase< R >::ensureMem(), LPColSetBase< R >::memPack(), and LPRowSetBase< R >::memPack().
◆ memRemax()
◆ memSize()
◆ num()
Current number of SVectorBases.
Definition at line 798 of file svsetbase.h.
References SVSetBase< R >::set.
Referenced by SVSetBase< R >::add(), SVSetBase< R >::add(), SSVectorBase< R >::assign2product(), SSVectorBase< R >::assign2product4setup(), SVSetBase< R >::create(), SVSetBase< R >::ensurePSVec(), LPColSetBase< R >::num(), LPRowSetBase< R >::num(), soplex::operator<<(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), and SVSetBase< R >::remove().
◆ number() [1/2]
template<class R >
int number |
( |
const DataKey & | k | ) |
const |
Gets vector number of DataKey.
Definition at line 822 of file svsetbase.h.
References SVSetBase< R >::number(), and SVSetBase< R >::set.
Referenced by SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add(), SVSetBase< R >::add2(), SVSetBase< R >::add2(), SVSetBase< R >::add2(), SVSetBase< R >::clear(), SVSetBase< R >::countUnusedMem(), SVSetBase< R >::create(), SVSetBase< R >::create(), SVSetBase< R >::deleteVec(), SVSetBase< R >::ensureMem(), SVSetBase< R >::ensurePSVec(), SVSetBase< R >::has(), SVSetBase< R >::has(), SVSetBase< R >::has(), SVSetBase< R >::isConsistent(), SVSetBase< R >::key(), SVSetBase< R >::key(), SVSetBase< R >::memPack(), SVSetBase< R >::memRemax(), LPColSetBase< R >::number(), LPRowSetBase< R >::number(), SVSetBase< R >::number(), SVSetBase< R >::number(), SVSetBase< R >::operator=(), SVSetBase< R >::operator=(), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::reMax(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::SVSetBase(), SVSetBase< R >::SVSetBase(), SVSetBase< R >::SVSetBase(), SVSetBase< R >::updateUnusedMemEstimation(), and SVSetBase< R >::xtend().
◆ number() [2/2]
◆ operator=() [1/2]
Assignment operator.
Definition at line 1030 of file svsetbase.h.
References ClassArray< Nonzero< R > >::clear(), SVSetBase< R >::isConsistent(), SVSetBase< R >::list, SVSetBase< R >::number(), ClassArray< Nonzero< R > >::operator=(), SVSetBase< R >::set, SVectorBase< R >::setMem(), and ClassArray< T >::size().
Referenced by LPColSetBase< R >::operator=(), LPColSetBase< R >::operator=(), LPRowSetBase< R >::operator=(), and LPRowSetBase< R >::operator=().
◆ operator=() [2/2]
◆ operator[]() [1/4]
◆ operator[]() [2/4]
◆ operator[]() [3/4]
◆ operator[]() [4/4]
◆ reMax()
◆ remove() [1/8]
Removes the vector with key removekey from the set.
- Precondition
removekey must be a key from SVSetBase
Definition at line 645 of file svsetbase.h.
References SVSetBase< R >::deleteVec(), SVSetBase< R >::number(), and SVSetBase< R >::set.
Referenced by SVSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), LPColSetBase< R >::remove(), LPRowSetBase< R >::remove(), SVSetBase< R >::remove(), SVSetBase< R >::remove(), LPColSetBase< R >::remove(), LPRowSetBase< R >::remove(), LPColSetBase< R >::remove(), LPRowSetBase< R >::remove(), and SVSetBase< R >::remove().
◆ remove() [2/8]
◆ remove() [3/8]
◆ remove() [4/8]
◆ remove() [5/8]
◆ remove() [6/8]
◆ remove() [7/8]
◆ remove() [8/8]
◆ updateUnusedMemEstimation()
void updateUnusedMemEstimation |
( |
int | change | ) |
|
|
private |
◆ xtend()
Extends svec to fit newmax nonzeros.
- Precondition
svec must be an SVectorBase of the SVSetBase.
Definition at line 523 of file svsetbase.h.
References ClassArray< Nonzero< R > >::data, SPxOut::debug(), SVSetBase< R >::ensureMem(), ClassArray< Nonzero< R > >::get_ptr(), SVSetBase< R >::has(), ClassArray< Nonzero< R > >::insert(), ClassArray< Nonzero< R > >::last(), SVSetBase< R >::list, SVectorBase< R >::max(), SVectorBase< R >::mem(), SVSetBase< R >::memSize(), SVSetBase< R >::number(), SVectorBase< R >::set_size(), SVectorBase< R >::setMem(), ClassArray< Nonzero< R > >::size(), SVectorBase< R >::size(), and SVSetBase< R >::updateUnusedMemEstimation().
Referenced by SVSetBase< R >::add2(), SVSetBase< R >::add2(), SVSetBase< R >::add2(), LPColSetBase< R >::xtend(), LPRowSetBase< R >::xtend(), LPColSetBase< R >::xtend(), and LPRowSetBase< R >::xtend().
◆ SVSetBase
◆ factor
◆ list
doubly linked list for non-zero management
Definition at line 186 of file svsetbase.h.
Referenced by SVSetBase< R >::clear(), SVSetBase< R >::countUnusedMem(), SVSetBase< R >::create(), SVSetBase< R >::deleteVec(), SVSetBase< R >::ensureMem(), SVSetBase< R >::isConsistent(), SVSetBase< R >::memPack(), SVSetBase< R >::memRemax(), SVSetBase< R >::operator=(), SVSetBase< R >::reMax(), and SVSetBase< R >::xtend().
◆ numUnusedMemUpdates
◆ set
set of SVectorBases
Definition at line 185 of file svsetbase.h.
Referenced by LPRowSetBase< R >::add(), SPxLPBase< R >::addCols(), SPxLPBase< R >::added2Set(), SPxLPBase< R >::addRows(), SVSetBase< R >::clear(), SVSetBase< R >::create(), SPxLPBase< R >::doAddCols(), SPxLPBase< R >::doAddRows(), SPxLPBase< R >::getCols(), SPxLPBase< R >::getRows(), SVSetBase< R >::has(), SVSetBase< R >::has(), SVSetBase< R >::has(), SVSetBase< R >::isConsistent(), SVSetBase< R >::key(), SVSetBase< R >::key(), SVSetBase< R >::max(), SVSetBase< R >::num(), SVSetBase< R >::number(), SVSetBase< R >::number(), SVSetBase< R >::operator=(), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::operator[](), SVSetBase< R >::reMax(), SVSetBase< R >::remove(), and SVSetBase< R >::remove().
◆ unusedMem
|