19 #ifndef _LPROWSETBASE_H_ 20 #define _LPROWSETBASE_H_ 269 MSG_ERROR(std::cerr <<
"EROWST01 RANGE not supported in LPRowSet::setType()" << std::endl);
342 const int& pscaleExp = 0)
345 add(k, plhs, prowVector, prhs, pobj, pscaleExp);
350 void add(
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
351 const S* rhsValue,
const S* objValue = 0)
353 assert(lhsValue != 0);
354 assert(rowSize <= 0 || rowValues != 0);
355 assert(rowSize <= 0 || rowIndices != 0);
356 assert(rhsValue != 0);
359 add(k, lhsValue, rowValues, rowIndices, rowSize, rhsValue, objValue);
365 void add(
DataKey& newkey,
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
366 const S* rhsValue,
const S* objValue = 0)
368 assert(lhsValue != 0);
369 assert(rowSize <= 0 || rowValues != 0);
370 assert(rowSize <= 0 || rowIndices != 0);
371 assert(rhsValue != 0);
382 left[
num() - 1] = *lhsValue;
383 right[
num() - 1] = *rhsValue;
386 object[
num() - 1] = *objValue;
388 object[
num() - 1] = 0;
394 const R& newobj = 0,
const int& newscaleExp = 0)
406 left[
num() - 1] = newlhs;
407 right[
num() - 1] = newrhs;
408 object[
num() - 1] = newobj;
409 scaleExp[
num() - 1] = newscaleExp;
427 for(
int j = 0; i <
num(); ++i, ++j)
429 left[i] = newset.
lhs(j);
430 right[i] = newset.
rhs(j);
431 object[i] = newset.
obj(j);
443 for(
int j = 0; i <
num(); ++i, ++j)
460 void add2(
const DataKey& k,
int n,
const int idx[],
const R val[])
466 void add2(
int i,
int n,
const int idx[],
const R val[])
473 void add2(
int i,
int n,
const int idx[],
const S val[])
480 const int& pscaleExp = 0)
483 return create(k, pnonzeros, plhs, prhs, pobj, pscaleExp);
488 const R& newobj = 0,
const int& newscaleExp = 0)
490 if(
num() + 1 > left.
dim())
494 object.reDim(
num() + 1);
498 left[
num()] = newlhs;
499 right[
num()] = newrhs;
500 object[
num()] = newobj;
501 scaleExp[
num()] = newscaleExp;
520 left[i] = left[
num()];
521 right[i] = right[
num()];
522 object[i] =
object[
num()];
523 scaleExp[i] = scaleExp[
num()];
537 void remove(
int perm[])
543 for(
int i = 0; i < j; ++i)
545 if(perm[i] >= 0 && perm[i] != i)
547 left[perm[i]] = left[i];
548 right[perm[i]] = right[i];
549 object[perm[i]] =
object[i];
550 scaleExp[perm[i]] = scaleExp[i];
561 void remove(
const int nums[],
int n)
564 remove(nums, n, perm.
get_ptr());
569 void remove(
const int nums[],
int n,
int* perm)
575 for(
int i = 0; i < j; ++i)
577 if(perm[i] >= 0 && perm[i] != i)
579 left[perm[i]] = left[i];
580 right[perm[i]] = right[i];
581 object[perm[i]] =
object[i];
582 scaleExp[perm[i]] = scaleExp[i];
618 object.reSize(
max());
654 #ifdef ENABLE_CONSISTENCY_CHECKS 655 const int ldim = left.
dim();
657 if(ldim != right.
dim())
660 if(ldim !=
object.dim())
756 #endif // _LPROWSETBASE_H_ DataKey key(int i) const
Returns the DataKey of the i 'th LPRowBase in LPRowSetBase.
SVectorBase< R > & rowVector_w(const DataKey &k)
Returns a writable rowVector of the LPRowBase with DataKey k.
VectorBase< R > & obj_w()
Returns the vector of objective coefficients (writeable).
int max() const
Returns the maximum number of LPRowBases that fit.
int memMax() const
Returns length of nonzero memory.
int memSize() const
Returns number of used nonzero entries.
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
const R & value(const DataKey &k) const
Returns the value of the LPRowBase with DataKey k.
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...
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase's dimension to newdim.
const SVectorBase< R > & rowVector(const DataKey &k) const
Returns the rowVector of the LPRowBase with DataKey k.
void add2(int i, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to i 'th rowVector.
LPRowBase< R >::Type type(int i) const
Returns the inequalitiy type of the i 'th LPRowBase.
bool isConsistent() const
Consistency check.
SVSetBase< R > & operator=(const SVSetBase< R > &rhs)
Assignment operator.
THREADLOCAL const Real infinity
void add(DataKey keys[], const LPRowSetBase< R > &set)
Adds all LPRowBases of set to LPRowSetBase.
Entry identifier class for items of a DataSet.
R & rhs_w(int i)
Returns the rhs of the i 'th LPRowBase (writeable).
void reMax(int newmax=0)
Resets maximum number of SVectorBases.
Dynamic dense vectors.Class DVectorBase is a derived class of VectorBase adding automatic memory mana...
Dense vector.Class VectorBase provides dense linear algebra vectors. It does not provide memory manag...
T * get_ptr()
get a C pointer to the data.
const VectorBase< R > & lhs() const
Returns the vector of lhs values.
void xtend(int n, int newmax)
Extends row n to fit newmax nonzeros.
void clear()
Removes all LPRowBases.
const R & rhs(const DataKey &k) const
Returns the rhs of the LPRowBase with DataKey k in LPRowSetBase.
const SVectorBase< R > & rowVector() const
Constraint row vector.
R & lhs_w(const DataKey &k)
Returns the lhs of the LPRowBase with DataKey k in LPRowSetBase.
const R & lhs(const DataKey &k) const
Returns the lhs of the LPRowBase with DataKey k in LPRowSetBase.
R rhs() const
Right-hand side value.
const R & value(int i) const
Returns the value of the i'th LPRowBase.
int number(const DataKey &k) const
Gets vector number of DataKey.
void setType(int i, typename LPRowBase< R >::Type t)
Changes the inequality type of row i to type.
void clear()
remove all elements.
int memSize() const
Used nonzero memory.
SVectorBase< R > * create(int idxmax=0)
Creates new SVectorBase in set.
VectorBase< R > & lhs_w()
Returns the vector of lhs values.
void xtend(const DataKey &pkey, int pnewmax)
Extends row with DataKey key to fit newmax nonzeros.
void add(const LPRowBase< R > &row)
R & lhs_w(int i)
Returns the lhs of the i 'th LPRowBase.
DVectorBase< R > left
vector of left hand sides (lower bounds) of LPRowBases.
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.
void memRemax(int newmax)
Reallocates memory to be able to store newmax nonzeros.
void memPack()
Garbage collection in nonzero memory.
DVectorBase< R > object
vector of objective coefficients.
void add(DataKey &pkey, const LPRowBase< R > &prow)
Adds row to LPRowSetBase.
void reSize(int newsize)
Resets DVectorBase's memory size to newsize.
const R & obj(const DataKey &k) const
Returns the objective coefficient of the LPRowBase with DataKey k in LPRowSetBase.
const R & lhs(int i) const
Returns the lhs of the i 'th LPRowBase.
void add(const SVectorBase< R > &svec)
Adds svec to the set.
const VectorBase< R > & rhs() const
Returns the vector of rhs values.
R lhs() const
Left-hand side value.
void add2(int i, int n, const int idx[], const S val[])
Adds n nonzero (idx, val)-pairs to i 'th rowVector.
LPRowSetBase< R > & operator=(const LPRowSetBase< R > &rs)
Assignment operator.
#define MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
SVectorBase< R > & rowVector_w(int i)
Returns a writable rowVector of the i 'th LPRowBase.
int memMax() const
Length of nonzero memory.
SVectorBase< R > & operator[](int n)
Gets SVectorBase by number, writeable.
bool has(const DataKey &k) const
True iff SVSetBase contains a SVectorBase for DataKey k.
const R & obj(int i) const
Returns the objective coefficient of the i 'th LPRowBase.
bool isConsistent() const
Consistency check.
void add2(const DataKey &k, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to rowVector with DataKey k.
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...
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...
DataArray< int > scaleExp
row scaling factors (stored as bitshift)
LPRowSetBase< R > & operator=(const LPRowSetBase< S > &rs)
Assignment operator.
(In)equality for LPs.Class LPRowBase provides constraints for linear programs in the form where a is...
void memRemax(int newmax)
Reset length of nonzero memory.
void memPack()
Garbage collection in nonzero memory.
Debugging, floating point type and parameter definitions.
R & obj_w(int i)
Returns the objective coefficient of the i 'th LPRowBase (writeable).
Collection of dense, sparse, and semi-sparse vectors.
int dim() const
Dimension of vector.
LPRowBase< R >::Type type(const DataKey &k) const
Returns the inequality type of the LPRowBase with DataKey k.
Everything should be within this namespace.
void reMax(int newmax=0)
Reallocates memory to be able to store newmax LPRowBases.
void add(const LPRowSetBase< R > &newset)
R & obj_w(const DataKey &k)
Returns the objective coefficient of the LPRowBase with DataKey k in LPRowSetBase (writeable)...
const SVectorBase< R > & rowVector(int i) const
Returns the rowVector of the i 'th LPRowBase.
Type
(In)Equality type of an LP row.
void add(DataKey &newkey, 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...
R obj() const
Objective coefficient value.
bool has(const DataKey &k) const
does DataKey k belong to LPRowSetBase ?
Set of LP rows.Class LPRowSetBase implements a set of LPRowBase%s. Unless for memory limitations...
void add2(SVectorBase< R > &svec, int idx, R val)
Adds nonzero (idx, val) to svec of this SVSetBase.
bool isConsistent() const
Checks consistency.
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...
void xtend(SVectorBase< R > &svec, int newmax)
Extends svec to fit newmax nonzeros.
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...
const R & rhs(int i) const
Returns the rhs of the i 'th LPRowBase.
DVectorBase< R > right
vector of right hand sides (upper bounds) of LPRowBases.
#define MSGinconsistent(name)
int number(const DataKey &k) const
Returns the number of the LPRowBase with DataKey k in LPRowSetBase.
VectorBase< R > & rhs_w()
Returns the vector of rhs values (writeable).
const SVSetBase< R > * rowSet() const
Returns the complete SVSet.
R & rhs_w(const DataKey &k)
Returns the rhs of the LPRowBase with DataKey k in LPRowSetBase (writeable).
int max() const
Current maximum number of SVectorBases.
const VectorBase< R > & obj() const
Returns the vector of objective coefficients.
void reSize(int newsize)
reset size to newsize.
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...
int num() const
Current number of SVectorBases.
Sparse vector set.Class SVSetBase provides a set of sparse vectors SVectorBase. All SVectorBases in a...
void clear()
Removes all elements.
int num() const
Returns the number of LPRowBases in LPRowSetBase.