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;
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)
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);
444 object[i] =
object[
num()];
465 for(
int i = 0; i < n; ++i)
467 if(perm[i] >= 0 && perm[i] != i)
471 object[perm[i]] =
object[i];
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)
502 object[perm[i]] =
object[i];
537 object.reSize(
max());
574#ifdef ENABLE_CONSISTENCY_CHECKS
576 if(
low.dim() !=
object.dim())
579 if(
low.dim() !=
up.dim())
Collection of dense, sparse, and semi-sparse vectors.
void clear()
Removes all elements.
T * get_ptr()
get a C pointer to the data.
void reSize(int newsize)
reset size to newsize.
void clear()
remove all elements.
Entry identifier class for items of a DataSet.
R upper() const
Gets upper bound.
const SVectorBase< R > & colVector() const
Gets constraint column vector.
R lower() const
Gets lower bound.
R obj() const
Gets objective value.
void remove(const DataKey &k)
Removes LPColBase with DataKey k.
void remove(int i)
Removes i 'th LPColBase.
SVectorBase< R > & colVector_w(const DataKey &k)
Returns writeable colVector of LPColBase with DataKey k in LPColSetBase.
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 ...
VectorBase< R > & lower_w()
Returns vector of lower bound values.
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...
LPColSetBase< R > & operator=(const LPColSetBase< R > &rs)
Assignment operator.
R & upper_w(const DataKey &k)
Returns upper bound of LPColBase with DataKey k in LPColSetBase.
const R & maxObj(int i) const
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.
VectorBase< R > & maxObj_w()
Returns vector of objective values w.r.t. maximization.
const VectorBase< R > & maxObj() const
const VectorBase< R > & lower() const
bool isConsistent() const
Checks consistency.
LPColSetBase(const LPColSetBase< S > &rs)
Copy constructor.
LPColSetBase(int pmax=-1, int pmemmax=-1)
Default constructor.
void add2(int i, int n, const int idx[], const S val[])
Adds n nonzero (idx, val)-pairs to i 'th colVector.
void add(DataKey keys[], const LPColSetBase< R > &newset)
Adds all LPColBases of set to LPColSetBase.
R & maxObj_w(const DataKey &k)
Returns objective value (w.r.t. maximization) of LPColBase with DataKey k in LPColSetBase.
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 ...
VectorBase< R > low
vector of lower bounds.
DataKey key(int i) const
Returns DataKey of i 'th LPColBase in LPColSetBase.
void add2(const DataKey &k, int n, const int idx[], const R val[])
void add(DataKey &pkey, const LPColBase< R > &pcol)
Adds p pcol to LPColSetBase.
int memSize() const
Returns used nonzero memory.
void remove(int perm[])
Removes multiple elements.
int number(const DataKey &k) const
Returns number of LPColBase with DataKey k in LPColSetBase.
int max() const
Returns maximum number of LPColBases currently fitting into LPColSetBase.
const R & upper(const DataKey &k) const
R & lower_w(int i)
Returns lower bound of i 'th LPColBase in LPColSetBase.
const R & upper(int i) const
R & upper_w(int i)
Returns upper bound of i 'th LPColBase in LPColSetBase.
DataArray< int > scaleExp
column scaling factors (stored as bitshift)
const SVSetBase< R > * colSet() const
Returns the complete SVSetBase.
void remove(const int nums[], int n, int *perm)
Removes LPColBases with numbers nums, where n is the length of the array nums, and stores the index p...
VectorBase< R > object
vector of objective coefficients.
const R & lower(const DataKey &k) const
SVectorBase< R > & colVector_w(int i)
VectorBase< R > up
vector of upper bounds.
int memMax() const
Returns length of nonzero memory.
void memRemax(int newmax)
Resets length of nonzero memory.
const R & lower(int i) const
int num() const
Returns the number of LPColBases currently in LPColSetBase.
void xtend(int n, int newmax)
Extends column n to fit newmax nonzeros.
SVectorBase< R > & create(int pnonzeros=0, const R &pobj=1, const R &plw=0, const R &pupp=1, const int &pscaleExp=0)
bool has(const DataKey &k) const
Does DataKey k belong to LPColSetBase ?
void add2(int i, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to i 'th colVector.
VectorBase< R > & upper_w()
Returns vector of upper bound values.
void add(const R &pobj, const R &plower, const SVectorBase< R > &pcolVector, const R &pupper, const int &pscaleExp=0)
R & lower_w(const DataKey &k)
Returns lower bound of LPColBase with DataKey k in LPColSetBase.
LPColSetBase(const LPColSetBase< R > &rs)
Copy constructor.
void add(const LPColBase< R > &pcol)
void reMax(int newmax=0)
Reallocates memory to be able to store newmax LPColBases.
void clear()
Removes all LPColBases from the set.
R & maxObj_w(int i)
Returns objective value (w.r.t. maximization) of i 'th LPColBase in LPColSetBase.
void remove(const int nums[], int n)
Removes LPColBases with numbers nums, where n is the length of the array nums.
void memPack()
Garbage collection in nonzero memory.
const SVectorBase< R > & colVector(const DataKey &k) const
Returns colVector of LPColBase with DataKey k in LPColSetBase.
const VectorBase< R > & upper() const
virtual ~LPColSetBase()
Destructor.
void xtend(const DataKey &pkey, int pnewmax)
Extends column with DataKey key to fit newmax nonzeros.
const R & maxObj(const DataKey &k) const
void add(const LPColSetBase< R > &newset)
LPColSetBase< R > & operator=(const LPColSetBase< S > &rs)
Assignment operator.
const SVectorBase< R > & colVector(int i) const
Returns colVector of i 'th LPColBase in LPColSetBase.
void remove(const DataKey &removekey)
Removes the vector with key removekey from the set.
void xtend(SVectorBase< R > &svec, int newmax)
Extends svec to fit newmax nonzeros.
bool isConsistent() const
Consistency check.
void add2(SVectorBase< R > &svec, int idx, R val)
Adds nonzero (idx, val) to svec of this SVSetBase.
int memSize() const
Used nonzero memory.
SVectorBase< R > & operator[](int n)
Gets SVectorBase by number, writeable.
int number(const DataKey &k) const
Gets vector number of DataKey.
int max() const
Current maximum number of SVectorBases.
int memMax() const
Length of nonzero memory.
void memRemax(int newmax)
Reset length of nonzero memory.
int num() const
Current number of SVectorBases.
SVSetBase< R > & operator=(const SVSetBase< R > &rhs)
Assignment operator.
bool has(const DataKey &k) const
True iff SVSetBase contains a SVectorBase for DataKey k.
void reMax(int newmax=0)
Resets maximum number of SVectorBases.
void memPack()
Garbage collection in nonzero memory.
DataKey key(int n) const
Gets DataKey of vector number.
SVectorBase< R > * create(int idxmax=0)
Creates new SVectorBase in set.
void add(const SVectorBase< R > &svec)
Adds svec to the set.
Entry identifier class for items of a DataSet.
Everything should be within this namespace.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)