19 #ifndef _LPCOLSETBASE_H_ 20 #define _LPCOLSETBASE_H_ 269 const int& pscaleExp = 0)
272 add(k, pobj, plower, pcolVector, pupper, pscaleExp);
277 const R& newupper,
const int& newscaleExp = 0)
289 low[
num() - 1] = newlower;
290 up[
num() - 1] = newupper;
291 object[
num() - 1] = obj;
292 scaleExp[
num() - 1] = newscaleExp;
297 void add(
const S* obj,
const S* lowerValue,
const S* colValues,
const int* colIndices,
int colSize,
301 add(k, obj, lowerValue, colValues, colIndices, colSize, upperValue);
307 void add(
DataKey& newkey,
const S* objValue,
const S* lowerValue,
const S* colValues,
308 const int* colIndices,
int colSize,
const S* upperValue)
319 low[
num() - 1] = *lowerValue;
320 up[
num() - 1] = *upperValue;
321 object[
num() - 1] = *objValue;
339 for(
int j = 0; i <
num(); ++i, ++j)
341 low[i] = newset.
lower(j);
342 up[i] = newset.
upper(j);
343 object[i] = newset.
maxObj(j);
355 for(
int j = 0; i <
num(); ++i, ++j)
372 void add2(
const DataKey& k,
int n,
const int idx[],
const R val[])
378 void add2(
int i,
int n,
const int idx[],
const R val[])
385 void add2(
int i,
int n,
const int idx[],
const S val[])
392 const int& pscaleExp = 0)
395 return create(k, pnonzeros, pobj, plw, pupp, pscaleExp);
400 const R& newup = 1,
const int& newscaleExp = 0)
406 object.reDim(
num() + 1);
413 scaleExp[
num()] = newscaleExp;
435 object[i] =
object[
num()];
436 scaleExp[i] = scaleExp[
num()];
450 void remove(
int perm[])
456 for(
int i = 0; i < n; ++i)
458 if(perm[i] >= 0 && perm[i] != i)
460 low[perm[i]] = low[i];
462 object[perm[i]] =
object[i];
463 scaleExp[perm[i]] = scaleExp[i];
474 void remove(
const int nums[],
int n)
477 remove(nums, n, perm.
get_ptr());
481 void remove(
const int nums[],
int n,
int* perm)
487 for(
int i = 0; i < j; ++i)
489 if(perm[i] >= 0 && perm[i] != i)
491 low[perm[i]] = low[i];
493 object[perm[i]] =
object[i];
494 scaleExp[perm[i]] = scaleExp[i];
528 object.reSize(
max());
565 #ifdef ENABLE_CONSISTENCY_CHECKS 567 if(low.
dim() !=
object.dim())
666 #endif // _LPCOLSETBASE_H_ SVectorBase< R > & create(int pnonzeros=0, const R &pobj=1, const R &plw=0, const R &pupp=1, const int &pscaleExp=0)
VectorBase< R > low
vector of lower bounds.
void memRemax(int newmax)
Resets length of nonzero memory.
void add(const S *obj, const S *lowerValue, const S *colValues, const int *colIndices, int colSize, const S *upperValue)
Adds LPColBase consisting of left hand side lhs, column vector colVector, and right hand side rhs to ...
R & upper_w(const DataKey &k)
Returns upper bound of LPColBase with DataKey k in LPColSetBase.
R & maxObj_w(const DataKey &k)
Returns objective value (w.r.t. maximization) of LPColBase with DataKey k in LPColSetBase.
const VectorBase< R > & lower() const
SVSetBase< R > & operator=(const SVSetBase< R > &rhs)
Assignment operator.
Entry identifier class for items of a DataSet.
void reMax(int newmax=0)
Resets maximum number of SVectorBases.
Dense vector.Class VectorBase provides dense linear algebra vectors. Internally, VectorBase wraps std...
SVectorBase< R > & colVector_w(const DataKey &k)
Returns writeable colVector of LPColBase with DataKey k in LPColSetBase.
T * get_ptr()
get a C pointer to the data.
DataKey key(int i) const
Returns DataKey of i 'th LPColBase in LPColSetBase.
const R & lower(const DataKey &k) const
void memPack()
Garbage collection in nonzero memory.
int memSize() const
Returns used nonzero memory.
int number(const DataKey &k) const
Gets vector number of DataKey.
void add(const LPColBase< R > &pcol)
R obj() const
Gets objective value.
void clear()
remove all elements.
int memSize() const
Used nonzero memory.
SVectorBase< R > * create(int idxmax=0)
Creates new SVectorBase in set.
VectorBase< R > & maxObj_w()
Returns vector of objective values w.r.t. maximization.
VectorBase< R > & lower_w()
Returns vector of lower bound values.
VectorBase< R > up
vector of upper bounds.
const VectorBase< R > & maxObj() const
VectorBase< R > & upper_w()
Returns vector of upper bound values.
DataArray< int > scaleExp
column scaling factors (stored as bitshift)
Entry identifier class for items of a DataSet.Every item in a DataSet is assigned a DataKey by which ...
DataKey key(int n) const
Gets DataKey of vector number.
bool isConsistent() const
Checks consistency.
R lower() const
Gets lower bound.
int number(const DataKey &k) const
Returns number of LPColBase with DataKey k in LPColSetBase.
const SVectorBase< R > & colVector() const
Gets constraint column vector.
void add2(int i, int n, const int idx[], const S val[])
Adds n nonzero (idx, val)-pairs to i 'th colVector.
const R & maxObj(int i) const
void add(const SVectorBase< R > &svec)
Adds svec to the set.
bool has(const DataKey &k) const
Does DataKey k belong to LPColSetBase ?
SVectorBase< R > & colVector_w(int i)
VectorBase< R > object
vector of objective coefficients.
int memMax() const
Length of nonzero memory.
SVectorBase< R > & operator[](int n)
Gets SVectorBase by number, writeable.
R & maxObj_w(int i)
Returns objective value (w.r.t. maximization) of i 'th LPColBase in LPColSetBase. ...
bool has(const DataKey &k) const
True iff SVSetBase contains a SVectorBase for DataKey k.
bool isConsistent() const
Consistency check.
const SVectorBase< R > & colVector(const DataKey &k) const
Returns colVector of LPColBase with DataKey k in LPColSetBase.
void add(DataKey &pkey, const LPColBase< R > &pcol)
Adds p pcol to LPColSetBase.
void reSize(int newsize)
Resets VectorBase's memory size to newsize.
bool isConsistent() const
Consistency check.
void add(DataKey &newkey, const S *objValue, const S *lowerValue, const S *colValues, const int *colIndices, int colSize, const S *upperValue)
Adds LPColBase consisting of left hand side lhs, column vector colVector, and right hand side rhs to ...
LPColSetBase< R > & operator=(const LPColSetBase< R > &rs)
Assignment operator.
int max() const
Returns maximum number of LPColBases currently fitting into LPColSetBase.
void memRemax(int newmax)
Reset length of nonzero memory.
void memPack()
Garbage collection in nonzero memory.
const R & upper(int i) const
Debugging, floating point type and parameter definitions.
void add(DataKey keys[], const LPColSetBase< R > &newset)
Adds all LPColBases of set to LPColSetBase.
const R & maxObj(const DataKey &k) const
Collection of dense, sparse, and semi-sparse vectors.
int dim() const
Dimension of vector.
Everything should be within this namespace.
void add(const LPColSetBase< R > &newset)
const R & upper(const DataKey &k) const
Set of LP columns.Class LPColSetBase implements a set of LPColBase%s. Unless for memory limitations...
SVectorBase< R > & create(DataKey &newkey, int nonzeros=0, const R &obj=1, const R &newlow=0, const R &newup=1, const int &newscaleExp=0)
Creates new LPColBase with specified arguments and returns a reference to its column vector...
R upper() const
Gets upper bound.
const R & lower(int i) const
void reDim(int newdim, const bool setZero=true)
Resets VectorBase's dimension to newdim.
int memMax() const
Returns length of nonzero memory.
R & lower_w(const DataKey &k)
Returns lower bound of LPColBase with DataKey k in LPColSetBase.
LPColSetBase< R > & operator=(const LPColSetBase< S > &rs)
Assignment operator.
void xtend(const DataKey &pkey, int pnewmax)
Extends column with DataKey key to fit newmax nonzeros.
void add2(SVectorBase< R > &svec, int idx, R val)
Adds nonzero (idx, val) to svec of this SVSetBase.
void xtend(int n, int newmax)
Extends column n to fit newmax nonzeros.
const VectorBase< R > & upper() const
R & lower_w(int i)
Returns lower bound of i 'th LPColBase in LPColSetBase.
void add(DataKey &newkey, const R &obj, const R &newlower, const SVectorBase< R > &newcolVector, const R &newupper, const int &newscaleExp=0)
Adds LPColBase consisting of objective value obj, lower bound lower, column vector colVector and uppe...
void xtend(SVectorBase< R > &svec, int newmax)
Extends svec to fit newmax nonzeros.
void add(const R &pobj, const R &plower, const SVectorBase< R > &pcolVector, const R &pupper, const int &pscaleExp=0)
R & upper_w(int i)
Returns upper bound of i 'th LPColBase in LPColSetBase.
void remove(const DataKey &removekey)
Removes the vector with key removekey from the set.
Sparse vectors.Class SVectorBase provides packed sparse vectors. Such are a sparse vectors...
void add2(int i, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to i 'th colVector.
void add2(const DataKey &k, int n, const int idx[], const R val[])
const SVSetBase< R > * colSet() const
Returns the complete SVSetBase.
#define MSGinconsistent(name)
const SVectorBase< R > & colVector(int i) const
Returns colVector of i 'th LPColBase in LPColSetBase.
void clear()
Removes all LPColBases from the set.
int max() const
Current maximum number of SVectorBases.
void reMax(int newmax=0)
Reallocates memory to be able to store newmax LPColBases.
void reSize(int newsize)
reset size to newsize.
int num() const
Current number of SVectorBases.
int num() const
Returns the number of LPColBases currently in LPColSetBase.
LP column.Class LPColBase provides a datatype for storing the column of an LP a the form similar to ...
Sparse vector set.Class SVSetBase provides a set of sparse vectors SVectorBase. All SVectorBases in a...
void clear()
Removes all elements.