19 #ifndef _LPROWSETBASE_H_ 20 #define _LPROWSETBASE_H_ 263 MSG_ERROR( std::cerr <<
"EROWST01 RANGE not supported in LPRowSet::setType()" << std::endl );
334 void add(
const R& plhs,
const SVectorBase<R>& prowVector,
const R& prhs,
const R& pobj = 0,
const int& pscaleExp = 0)
337 add(k, plhs, prowVector, prhs, pobj, pscaleExp);
342 void add(
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
const S* rhsValue,
const S* objValue = 0)
344 assert(lhsValue != 0);
345 assert(rowSize <= 0 || rowValues != 0);
346 assert(rowSize <= 0 || rowIndices != 0);
347 assert(rhsValue != 0);
350 add(k, lhsValue, rowValues, rowIndices, rowSize, rhsValue, objValue);
356 void add(
DataKey& newkey,
const S* lhsValue,
const S* rowValues,
const int* rowIndices,
int rowSize,
const S* rhsValue,
const S* objValue = 0)
358 assert(lhsValue != 0);
359 assert(rowSize <= 0 || rowValues != 0);
360 assert(rowSize <= 0 || rowIndices != 0);
361 assert(rhsValue != 0);
372 left[
num() - 1] = *lhsValue;
373 right[
num() - 1] = *rhsValue;
375 object[
num() - 1] = *objValue;
377 object[
num() - 1] = 0;
382 void add(
DataKey& newkey,
const R& newlhs,
const SVectorBase<R>& newrowVector,
const R& newrhs,
const R& newobj = 0,
const int& newscaleExp = 0)
394 left[
num() - 1] = newlhs;
395 right[
num() - 1] = newrhs;
396 object[
num() - 1] = newobj;
397 scaleExp[
num() - 1] = newscaleExp;
415 for(
int j = 0; i <
num(); ++i, ++j )
417 left[i] = newset.
lhs(j);
418 right[i] = newset.
rhs(j);
419 object[i] = newset.
obj(j);
431 for(
int j = 0; i <
num(); ++i, ++j )
448 void add2(
const DataKey& k,
int n,
const int idx[],
const R val[])
454 void add2(
int i,
int n,
const int idx[],
const R val[])
461 void add2(
int i,
int n,
const int idx[],
const S val[])
467 SVectorBase<R>&
create(
int pnonzeros = 0,
const R& plhs = 0,
const R& prhs = 1,
const R& pobj = 0,
const int& pscaleExp = 0)
470 return create(k, pnonzeros, plhs, prhs, pobj, pscaleExp);
474 SVectorBase<R>&
create(
DataKey& newkey,
int nonzeros = 0,
const R& newlhs = 0,
const R& newrhs = 1,
const R& newobj = 0,
const int& newscaleExp = 0)
476 if(
num() + 1 > left.
dim() )
480 object.reDim(
num() + 1);
484 left[
num()] = newlhs;
485 right[
num()] = newrhs;
486 object[
num()] = newobj;
487 scaleExp[
num()] = newscaleExp;
506 left[i] = left[
num()];
507 right[i] = right[
num()];
508 object[i] =
object[
num()];
509 scaleExp[i] = scaleExp[
num()];
523 void remove(
int perm[])
529 for(
int i = 0; i < j; ++i )
531 if( perm[i] >= 0 && perm[i] != i )
533 left[perm[i]] = left[i];
534 right[perm[i]] = right[i];
535 object[perm[i]] =
object[i];
536 scaleExp[perm[i]] = scaleExp[i];
547 void remove(
const int nums[],
int n)
550 remove(nums, n, perm.
get_ptr());
555 void remove(
const int nums[],
int n,
int* perm)
561 for(
int i = 0; i < j; ++i )
563 if( perm[i] >= 0 && perm[i] != i )
565 left[perm[i]] = left[i];
566 right[perm[i]] = right[i];
567 object[perm[i]] =
object[i];
568 scaleExp[perm[i]] = scaleExp[i];
604 object.reSize(
max());
640 #ifdef ENABLE_CONSISTENCY_CHECKS 641 const int ldim = left.
dim();
643 if( ldim != right.
dim() )
645 if( ldim !=
object.dim() )
739 #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.