28 #ifndef _LPCOLSETBASE_H_ 29 #define _LPCOLSETBASE_H_ 278 const int& pscaleExp = 0)
281 add(k, pobj, plower, pcolVector, pupper, pscaleExp);
286 const R& newupper,
const int& newscaleExp = 0)
298 low[
num() - 1] = newlower;
299 up[
num() - 1] = newupper;
300 object[
num() - 1] = obj;
301 scaleExp[
num() - 1] = newscaleExp;
306 void add(
const S* obj,
const S* lowerValue,
const S* colValues,
const int* colIndices,
int colSize,
310 add(k, obj, lowerValue, colValues, colIndices, colSize, upperValue);
316 void add(
DataKey& newkey,
const S* objValue,
const S* lowerValue,
const S* colValues,
317 const int* colIndices,
int colSize,
const S* upperValue)
328 low[
num() - 1] = *lowerValue;
329 up[
num() - 1] = *upperValue;
330 object[
num() - 1] = *objValue;
348 for(
int j = 0; i <
num(); ++i, ++j)
350 low[i] = newset.
lower(j);
351 up[i] = newset.
upper(j);
352 object[i] = newset.
maxObj(j);
364 for(
int j = 0; i <
num(); ++i, ++j)
381 void add2(
const DataKey& k,
int n,
const int idx[],
const R val[])
387 void add2(
int i,
int n,
const int idx[],
const R val[])
394 void add2(
int i,
int n,
const int idx[],
const S val[])
401 const int& pscaleExp = 0)
404 return create(k, pnonzeros, pobj, plw, pupp, pscaleExp);
409 const R& newup = 1,
const int& newscaleExp = 0)
415 object.reDim(
num() + 1);
422 scaleExp[
num()] = newscaleExp;
444 object[i] =
object[
num()];
445 scaleExp[i] = scaleExp[
num()];
459 void remove(
int perm[])
465 for(
int i = 0; i < n; ++i)
467 if(perm[i] >= 0 && perm[i] != i)
469 low[perm[i]] = low[i];
471 object[perm[i]] =
object[i];
472 scaleExp[perm[i]] = scaleExp[i];
483 void remove(
const int nums[],
int n)
486 remove(nums, n, perm.
get_ptr());
490 void remove(
const int nums[],
int n,
int* perm)
496 for(
int i = 0; i < j; ++i)
498 if(perm[i] >= 0 && perm[i] != i)
500 low[perm[i]] = low[i];
502 object[perm[i]] =
object[i];
503 scaleExp[perm[i]] = scaleExp[i];
537 object.reSize(
max());
574 #ifdef ENABLE_CONSISTENCY_CHECKS 576 if(low.
dim() !=
object.dim())
604 :
SVSetBase<R>(pmax, pmemmax), low(0), up(0), object(0), scaleExp(0)
650 , scaleExp(rs.scaleExp)
662 , scaleExp(rs.scaleExp)
675 #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.
#define SPX_MSG_INCONSISTENT(name)
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.
LPColSetBase(const LPColSetBase< R > &rs)
Copy constructor.
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.
LPColSetBase(int pmax=-1, int pmemmax=-1)
Default constructor.
virtual ~LPColSetBase()
Destructor.
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.
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...
LPColSetBase(const LPColSetBase< S > &rs)
Copy constructor.
void clear()
Removes all elements.