Loading...
Searching...
No Matches
svsetbase.h
Go to the documentation of this file.
32/* undefine SOPLEX_DEBUG flag from including files; if SOPLEX_DEBUG should be defined in this file, do so below */
53 * Class SVSetBase provides a set of sparse vectors SVectorBase. All SVectorBase%s in an SVSetBase share one big
54 * memory block for their nonzeros. This memory is referred to as the \em nonzero \em memory. The SVectorBase%s
55 * themselves are saved in another memory block referred to as the \em vector \em memory. Both memory blocks will grow
56 * automatically if required, when adding more SVectorBase%s to the set or enlarging SVectorBase%s within the set. For
57 * controlling memory consumption, methods are provided to inquire and reset the size of the memory blocks used for
60 * SVectorBase%s in an SVSetBase are numbered from 0 thru num()-1. They can be accessed using the index
61 * operator[](). When removing SVectorBase%s of a SVSetBase the remaining ones will be renumbered. However, all
62 * SVectorBase with a smaller number than the lowest number of the removed SVectorBase%s will remain unchanged.
64 * For providing a uniform access to SVectorBase%s in a %set even if others are removed or added, SVSetBase assigns a
65 * DataKey to each SVectorBase in the %set. Such a DataKey remains unchanged as long as the corresponding SVectorBase
66 * is in the SVSetBase, no matter what other SVectorBase%s are added to or removed from the SVSetBase. Methods are
67 * provided for getting the DataKey to a SVectorBase or its number and vice versa. Further, each add() method for
68 * enlarging an SVSetBase is provided with two signatures. One of them returns the DataKey%s assigned to the
84 * The management of the SVectorBase%s is implemented by a DataSet<DLPSV>, the keys used externally are DataKey%s.
86 * The management of nonzeros is done by a Real linked list IdList<DLPSV>, where the SVectorBase%s are kept in the
87 * order in which their indices occurr in the Array. The SVectorBase%s are kept without holes: If one is removed or
88 * moved to the end, the SVectorBase preceeding it obtains the space for all the nonzeros that previously belonged
95 // ---------------------------------------------------------------------------------------------------------------
106 // ---------------------------------------------------------------------------------------------------------------
181 // ------------------------------------------------------------------------------------------------------------------
187 int unusedMem; ///< an estimate of the unused memory (the difference of max() and size() summed up over all vectors) due to deleteVec() and xtend()
188 int numUnusedMemUpdates; ///< counter for how often unusedMem has been updated since last exact value
192 // ------------------------------------------------------------------------------------------------------------------
200 // ------------------------------------------------------------------------------------------------------------------
301 SPxOut::debug(this, "deleteVec (1), this = {} : updateUnusedMemEstimation -= {}\n", (void*)this,
306 /* merge space of predecessor with position which will be deleted, therefore we do not need to delete any memory
319 SPxOut::debug(this, "deleteVec (2), this = {} : updateUnusedMemEstimation += {}\n", (void*)this,
324 /* simply remove the front entries; we do not shift the second vector to the front, because we count the unused
331 SPxOut::debug(this, "deleteVec (3), this = {} : updateUnusedMemEstimation += {}\n", (void*)this,
344 // ------------------------------------------------------------------------------------------------------------------
349 /** This includes copying its nonzeros to the sets nonzero memory and creating an additional SVectorBase entry in
363 /** Adds SVectorBase \p svec to the %set. This includes copying its nonzeros to the sets nonzero memory and creating
364 * an additional SVectorBase entry in vector memory. If neccessary, the memory blocks are enlarged appropriately.
366 * At return, \p nkey contains the DataKey, that the SVSetBase has assosicated to the new SVectorBase.
379 /** Adds SVectorBase \p svec to the %set. This includes copying its nonzeros to the sets nonzero memory and creating
380 * an additional SVectorBase entry in vector memory. If neccessary, the memory blocks are enlarged appropriately.
382 * At return, \p nkey contains the DataKey, that the SVSetBase has assosicated to the new SVectorBase.
422 * At return, nkey contains the DataKey%s, that the SVSetBase has assosicated to the new SVectorBase%s.
457 * At return, \p nkey contains the DataKey%s, that the SVSetBase has assosicated to the new SVectorBase%s.
600 /** Adds one nonzero (\p idx, \p val) to SVectorBase \p svec in the SVSetBase. If \p svec is not large enough to
612 /** Adds \p n nonzeros to SVectorBase \p svec in the SVSetBase. If \p svec is not large enough to hold the additional
624 /** Adds \p n nonzeros to SVectorBase \p svec in the SVSetBase. If \p svec is not large enough to hold the additional
638 // ------------------------------------------------------------------------------------------------------------------
668 /** Removes all SVectorBase%s for the SVSetBase with an index \c i such that \p perm[i] < 0. Upon completion, \p
669 * perm[i] >= 0 indicates the new index where the \c i 'th SVectorBase has been moved to due to this removal.
763 // ------------------------------------------------------------------------------------------------------------------
793 // ------------------------------------------------------------------------------------------------------------------
853 // ------------------------------------------------------------------------------------------------------------------
914 /** Pack the svectors together as tightly as possible. This removes all additional unused memory, i.e., size = max
917 * Note: do *not* call isConsistent() here, because the following might happen: In SPxLP::doAddRows(const LPRowSet&
918 * p_set), when adding rows, the sizes of the vectors for the columns of the LP are increased (without yet filling
919 * in the data) to recieve the additional entries. This is done by calling xtend() above. xtend() in turn might call
920 * this method, which checks the yet unfilled positions, i.e., isConsistent() is likely to fail. In general,
921 * isConsistent() should not be called within this class, but in classes further up in the hierarchy.
970 // ------------------------------------------------------------------------------------------------------------------
1009 // ------------------------------------------------------------------------------------------------------------------
Save arrays of data objects. Set of class objects. bool isConsistent() const Definition classarray.h:324 ClassArray & operator=(const ClassArray &rhs) Definition classarray.h:308 ClassArray(const ClassArray &old) Definition classarray.h:340 ptrdiff_t reMax(int newMax=1, int newSize=-1) Definition classarray.h:257 void add2(SVectorBase< R > &svec, int n, const int idx[], const S val[]) Adds n nonzeros to svec of this SVSetBase. Definition svsetbase.h:630 void remove(int removenum) Removes the vector with number removenum from the set. Definition svsetbase.h:654 bool has(int n) const True iff SVSetBase contains a SVectorBase for vector number n. Definition svsetbase.h:840 void updateUnusedMemEstimation(int change) update estimation of unused memory Definition svsetbase.h:226 void remove(const DataKey keys[], int n, int *perm) Definition svsetbase.h:710 void add(const SVectorBase< R > svec[], int n) Adds all n SVectorBases in the array svec to the set. Definition svsetbase.h:402 void add(const SVSetBase< S > &pset) Adds all SVectorBases in pset to SVSetBase. Definition svsetbase.h:436 int numUnusedMemUpdates counter for how often unusedMem has been updated since last exact value Definition svsetbase.h:188 SVectorBase< R > * create(DataKey &nkey, int idxmax=-1) Creates new SVectorBase in set. Definition svsetbase.h:511 void remove(const DataKey &removekey) Removes the vector with key removekey from the set. Definition svsetbase.h:645 void xtend(SVectorBase< R > &svec, int newmax) Extends svec to fit newmax nonzeros. Definition svsetbase.h:523 void ensureMem(int n, bool shortenLast=true) Provides enough nonzero memory for n more Nonzeros. Definition svsetbase.h:247 void add2(SVectorBase< R > &svec, int idx, R val) Adds nonzero (idx, val) to svec of this SVSetBase. Definition svsetbase.h:605 void ensurePSVec(int n) Provides enough vector memory for n more SVectorBases. Definition svsetbase.h:236 const SVectorBase< R > & operator[](int n) const Gets SVectorBase by number. Definition svsetbase.h:774 SVectorBase< R > & operator[](int n) Gets SVectorBase by number, writeable. Definition svsetbase.h:768 int unusedMem an estimate of the unused memory (the difference of max() and size() summed up over all vectors) due ... Definition svsetbase.h:187 void deleteVec(DLPSV *ps) Deleting a vector from the data array and the list. Definition svsetbase.h:292 SVectorBase< R > & operator[](const DataKey &k) Gets SVectorBase by DataKey, writeable. Definition svsetbase.h:780 int number(const SVectorBase< R > *svec) const Gets vector number of SVectorBase. Definition svsetbase.h:828 void add(DataKey &nkey, const S *rowValues, const int *rowIndices, int rowSize) Adds svec to SVSetBase. Definition svsetbase.h:385 void add2(SVectorBase< R > &svec, int n, const int idx[], const R val[]) Adds n nonzeros to svec of this SVSetBase. Definition svsetbase.h:617 SVSetBase< R > & operator=(const SVSetBase< R > &rhs) Assignment operator. Definition svsetbase.h:1030 SVSetBase(int pmax=-1, int pmemmax=-1, double pfac=1.1, double pmemFac=1.2) Default constructor. Definition svsetbase.h:1015 SVSetBase< R > & operator=(const SVSetBase< S > &rhs) Assignment operator. Definition svsetbase.h:1066 bool has(const DataKey &k) const True iff SVSetBase contains a SVectorBase for DataKey k. Definition svsetbase.h:834 void add(DataKey nkey[], const SVectorBase< R > svec[], int n) Adds n SVectorBases to SVSetBase. Definition svsetbase.h:426 DataKey key(const SVectorBase< R > *svec) const Gets DataKey of SVectorBase. Definition svsetbase.h:816 void add(DataKey nkey[], const SVSetBase< S > &pset) Adds all SVectorBases of pset to SVSetBase. Definition svsetbase.h:462 void remove(const SVectorBase< R > *svec) Removes one SVectorBase from set. Definition svsetbase.h:662 void add(DataKey &nkey, const SVectorBase< R > &svec) Adds svec to SVSetBase. Definition svsetbase.h:368 const SVectorBase< R > & operator[](const DataKey &k) const Gets SVectorBase by DataKey. Definition svsetbase.h:786 void setMem(int n, Nonzero< R > *elmem) Set the memory area where the nonzeros will be stored. Definition svectorbase.h:813 SVectorBase< R > & assignArray(const S *rowValues, const int *rowIndices, int rowSize) Assignment operator. Definition svectorbase.h:765 SVectorBase< R > & operator=(const VectorBase< S > &vec) Assignment operator. Definition basevectors.h:951 Entry identifier class for items of a DataSet. Set of data objects. Generic Real linked list. Everything should be within this namespace. Debugging, floating point type and parameter definitions. Sparse vectors.
|