28#ifndef _LPROWSETBASE_H_
29#define _LPROWSETBASE_H_
278 SPX_MSG_ERROR(std::cerr <<
"EROWST01 RANGE not supported in LPRowSet::setType()" << std::endl);
351 const int& pscaleExp = 0)
354 add(k, plhs, prowVector, prhs, pobj, pscaleExp);
359 void add(
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
360 const S* rhsValue,
const S* objValue = 0)
362 assert(lhsValue !=
nullptr);
363 assert(rowSize <= 0 || rowValues !=
nullptr);
364 assert(rowSize <= 0 || rowIndices !=
nullptr);
365 assert(rhsValue !=
nullptr);
368 add(k, lhsValue, rowValues, rowIndices, rowSize, rhsValue, objValue);
374 void add(
DataKey& newkey,
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
375 const S* rhsValue,
const S* objValue =
nullptr)
377 assert(lhsValue !=
nullptr);
378 assert(rowSize <= 0 || rowValues !=
nullptr);
379 assert(rowSize <= 0 || rowIndices !=
nullptr);
380 assert(rhsValue !=
nullptr);
394 if(objValue !=
nullptr)
395 object[
num() - 1] = *objValue;
397 object[
num() - 1] = 0;
403 const R& newobj = 0,
const int& newscaleExp = 0)
417 object[
num() - 1] = newobj;
436 for(
int j = 0; i <
num(); ++i, ++j)
440 object[i] = newset.
obj(j);
452 for(
int j = 0; i <
num(); ++i, ++j)
469 void add2(
const DataKey& k,
int n,
const int idx[],
const R val[])
475 void add2(
int i,
int n,
const int idx[],
const R val[])
482 void add2(
int i,
int n,
const int idx[],
const S val[])
489 const int& pscaleExp = 0)
492 return create(k, pnonzeros, plhs, prhs, pobj, pscaleExp);
497 const R& newobj = 0,
const int& newscaleExp = 0)
503 object.reDim(
num() + 1);
509 object[
num()] = newobj;
531 object[i] =
object[
num()];
552 for(
int i = 0; i < j; ++i)
554 if(perm[i] >= 0 && perm[i] != i)
558 object[perm[i]] =
object[i];
578 void remove(
const int nums[],
int n,
int* perm)
584 for(
int i = 0; i < j; ++i)
586 if(perm[i] >= 0 && perm[i] != i)
590 object[perm[i]] =
object[i];
627 object.reSize(
max());
664#ifdef ENABLE_CONSISTENCY_CHECKS
665 const int ldim =
left.dim();
667 if(ldim !=
right.dim())
670 if(ldim !=
object.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.
const SVectorBase< R > & rowVector() const
Constraint row vector.
Type
(In)Equality type of an LP row.
R rhs() const
Right-hand side value.
R lhs() const
Left-hand side value.
R obj() const
Objective coefficient value.
const VectorBase< R > & rhs() const
Returns the vector of rhs values.
const VectorBase< R > & lhs() const
Returns the vector of lhs values.
void remove(const DataKey &k)
Removes LPRowBase with DataKey k.
void remove(int i)
Removes i 'th LPRowBase.
void add(const R &plhs, const SVectorBase< R > &prowVector, const R &prhs, const R &pobj=0, const int &pscaleExp=0)
Adds LPRowBase consisting of left hand side lhs, row vector rowVector, and right hand side rhs to LPR...
const R & value(int i) const
Returns the value of the i'th LPRowBase.
void add(DataKey &pkey, const LPRowBase< R > &prow)
Adds row to LPRowSetBase.
R & obj_w(int i)
Returns the objective coefficient of the i 'th LPRowBase (writeable).
SVectorBase< R > & create(DataKey &newkey, int nonzeros=0, const R &newlhs=0, const R &newrhs=1, const R &newobj=0, const int &newscaleExp=0)
Creates new LPRowBase with specified parameters and returns a reference to its row vector.
bool isConsistent() const
Checks consistency.
R & lhs_w(int i)
Returns the lhs of the i 'th LPRowBase.
void add2(int i, int n, const int idx[], const S val[])
Adds n nonzero (idx, val)-pairs to i 'th rowVector.
VectorBase< R > left
vector of left hand sides (lower bounds) of LPRowBases.
virtual ~LPRowSetBase()
Destructor.
SVectorBase< R > & create(int pnonzeros=0, const R &plhs=0, const R &prhs=1, const R &pobj=0, const int &pscaleExp=0)
Creates new LPRowBase with specified parameters and returns a reference to its row vector.
void add(const LPRowSetBase< R > &newset)
const R & rhs(int i) const
Returns the rhs of the i 'th LPRowBase.
const R & obj(const DataKey &k) const
Returns the objective coefficient of the LPRowBase with DataKey k in LPRowSetBase.
DataKey key(int i) const
Returns the DataKey of the i 'th LPRowBase in LPRowSetBase.
void add(DataKey &newkey, const R &newlhs, const SVectorBase< R > &newrowVector, const R &newrhs, const R &newobj=0, const int &newscaleExp=0)
Adds LPRowBase consisting of left hand side lhs, row vector rowVector, and right hand side rhs to LPR...
void add2(const DataKey &k, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to rowVector with DataKey k.
const R & lhs(const DataKey &k) const
Returns the lhs of the LPRowBase with DataKey k in LPRowSetBase.
void add(const LPRowBase< R > &row)
const R & value(const DataKey &k) const
Returns the value of the LPRowBase with DataKey k.
int memSize() const
Returns number of used nonzero entries.
void remove(int perm[])
Removes multiple LPRowBases.
void add(DataKey &newkey, const S *lhsValue, const S *rowValues, const int *rowIndices, int rowSize, const S *rhsValue, const S *objValue=nullptr)
Adds LPRowBase consisting of left hand side lhs, row vector rowVector, and right hand side rhs to LPR...
int number(const DataKey &k) const
Returns the number of the LPRowBase with DataKey k in LPRowSetBase.
SVectorBase< R > & rowVector_w(int i)
Returns a writable rowVector of the i 'th LPRowBase.
int max() const
Returns the maximum number of LPRowBases that fit.
LPRowSetBase< R > & operator=(const LPRowSetBase< R > &rs)
Assignment operator.
R & rhs_w(const DataKey &k)
Returns the rhs of the LPRowBase with DataKey k in LPRowSetBase (writeable).
DataArray< int > scaleExp
row scaling factors (stored as bitshift)
const R & obj(int i) const
Returns the objective coefficient of the i 'th LPRowBase.
void remove(const int nums[], int n, int *perm)
Removes n LPRowBases with row numbers given by nums, Stores permutation of row indices in perm.
const R & rhs(const DataKey &k) const
Returns the rhs of the LPRowBase with DataKey k in LPRowSetBase.
VectorBase< R > object
vector of objective coefficients.
R & obj_w(const DataKey &k)
Returns the objective coefficient of the LPRowBase with DataKey k in LPRowSetBase (writeable).
int memMax() const
Returns length of nonzero memory.
void memRemax(int newmax)
Reallocates memory to be able to store newmax nonzeros.
const SVectorBase< R > & rowVector(const DataKey &k) const
Returns the rowVector of the LPRowBase with DataKey k.
VectorBase< R > & rhs_w()
Returns the vector of rhs values (writeable).
int num() const
Returns the number of LPRowBases in LPRowSetBase.
SVectorBase< R > & rowVector_w(const DataKey &k)
Returns a writable rowVector of the LPRowBase with DataKey k.
const SVectorBase< R > & rowVector(int i) const
Returns the rowVector of the i 'th LPRowBase.
void xtend(int n, int newmax)
Extends row n to fit newmax nonzeros.
VectorBase< R > & obj_w()
Returns the vector of objective coefficients (writeable).
const R & lhs(int i) const
Returns the lhs of the i 'th LPRowBase.
const VectorBase< R > & obj() const
Returns the vector of objective coefficients.
bool has(const DataKey &k) const
does DataKey k belong to LPRowSetBase ?
void add2(int i, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to i 'th rowVector.
VectorBase< R > right
vector of right hand sides (upper bounds) of LPRowBases.
VectorBase< R > & lhs_w()
Returns the vector of lhs values.
LPRowBase< R >::Type type(const DataKey &k) const
Returns the inequality type of the LPRowBase with DataKey k.
void reMax(int newmax=0)
Reallocates memory to be able to store newmax LPRowBases.
void clear()
Removes all LPRowBases.
void setType(int i, typename LPRowBase< R >::Type t)
Changes the inequality type of row i to type.
LPRowSetBase(const LPRowSetBase< R > &rs)
Copy constructor.
void remove(const int nums[], int n)
Removes n LPRowBases with row numbers given by nums.
const SVSetBase< R > * rowSet() const
Returns the complete SVSet.
void memPack()
Garbage collection in nonzero memory.
R & rhs_w(int i)
Returns the rhs of the i 'th LPRowBase (writeable).
LPRowSetBase(int pmax=-1, int pmemmax=-1)
Default constructor.
void add(const S *lhsValue, const S *rowValues, const int *rowIndices, int rowSize, const S *rhsValue, const S *objValue=0)
Adds LPRowBase consisting of left hand side lhs, row vector rowVector, and right hand side rhs to LPR...
LPRowSetBase(const LPRowSetBase< S > &rs)
Copy constructor.
R & lhs_w(const DataKey &k)
Returns the lhs of the LPRowBase with DataKey k in LPRowSetBase.
void xtend(const DataKey &pkey, int pnewmax)
Extends row with DataKey key to fit newmax nonzeros.
LPRowBase< R >::Type type(int i) const
Returns the inequalitiy type of the i 'th LPRowBase.
LPRowSetBase< R > & operator=(const LPRowSetBase< S > &rs)
Assignment operator.
void add(DataKey keys[], const LPRowSetBase< R > &set)
Adds all LPRowBases of set to LPRowSetBase.
Exception class for things that should NEVER happen.
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.
ClassSet< DLPSV > set
set 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.
SOPLEX_THREADLOCAL const Real infinity
Debugging, floating point type and parameter definitions.
#define SPX_MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
#define SPX_MSG_INCONSISTENT(name)