Representation of constraints in the row format. More...
#include <ogdf/lib/abacus/row.h>
Public Member Functions | |
Row (AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense &sense, double r) | |
Creates a row and initializes it. More... | |
Row (AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense::SENSE sense, double r) | |
Creates a row and initializes it. More... | |
Row (AbacusGlobal *glob, int nnz, int *s, double *c, CSense::SENSE sense, double r) | |
Creates a row and initializes it using C-style arrays. More... | |
Row (AbacusGlobal *glob, int size) | |
Creates a row without initialization of the nonzeros of the row. More... | |
~Row () | |
The destructor. More... | |
void | copy (const Row &row) |
Copies row . More... | |
void | delInd (ArrayBuffer< int > &buf, double rhsDelta) |
Removes the indices listed in buf from the support of the row and subtracts rhsDelta from its right hand side. More... | |
double | rhs () const |
Returns the right hand side stored in the row format. More... | |
void | rhs (double r) |
Sets the right hand side of the row to r. More... | |
CSense * | sense () |
Returns a pointer to the sense of the row. More... | |
const CSense * | sense () const |
Returns a const pointer to the sense of the row. More... | |
void | sense (CSense &s) |
Sets the sense of the row to s. More... | |
void | sense (CSense::SENSE s) |
Sets the sense of the row to s. More... | |
Public Member Functions inherited from abacus::SparVec | |
SparVec (AbacusGlobal *glob, int size, const Array< int > &s, const Array< double > &c, double reallocFac=10.0) | |
Creates a sparse vector and initializes support and coefficients. More... | |
SparVec (AbacusGlobal *glob, int size, double reallocFac=10.0) | |
Creates an empty sparse vector. More... | |
SparVec (AbacusGlobal *glob, int size, int *s, double *c, double reallocFac=10.0) | |
Creates a sparse vector and initializes support and coefficients. More... | |
SparVec (const SparVec &rhs) | |
Copy constructor. More... | |
~SparVec () | |
The destructor. More... | |
void | clear () |
Removes all nonzeros from the sparse vector. More... | |
double | coeff (int i) const |
void | copy (const SparVec &vec) |
Copies vector vec. More... | |
void | insert (int s, double c) |
Adds a new support/coefficient pair to the vector. More... | |
void | leftShift (ArrayBuffer< int > &del) |
Deletes the elements listed in a buffer from the sparse vector. More... | |
int | nnz () const |
Returns the number of nonzero elements. More... | |
double | norm () |
Returns the Euclidean norm of the sparse vector. More... | |
SparVec & | operator= (const SparVec &rhs) |
The assignment operator. More... | |
double | origCoeff (int i) const |
void | realloc () |
Increases the size of the sparse vector by reallocFac_ percent of the original size. More... | |
void | realloc (int newSize) |
Reallocates the sparse vector to a given length. More... | |
void | rename (Array< int > &newName) |
Replaces the index of the support by new names. More... | |
int | size () const |
Returns the maximal length of the sparse vector. More... | |
int | support (int i) const |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. More... | |
Protected Attributes | |
double | rhs_ |
The right hand side of the row. More... | |
CSense | sense_ |
The sense of the row. More... | |
Protected Attributes inherited from abacus::SparVec | |
double * | coeff_ |
The array storing the corresponding nonzero coefficients. More... | |
AbacusGlobal * | glob_ |
A pointer to the corresponding global object. More... | |
int | nnz_ |
The number of stored elements ("nonzeros"). More... | |
double | reallocFac_ |
If a new element is inserted but the sparse vector is full, then its size is increased by reallocFac_ percent. More... | |
int | size_ |
The maximal number of nonzero coefficients which can be stored without reallocation. More... | |
int * | support_ |
The array storing the nonzero variables. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Row &rhs) |
The output operator. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from abacus::AbacusRoot | |
static bool | ascii2bool (const string &str) |
Converts the string str to a boolean value. More... | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. More... | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. More... | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". More... | |
Protected Member Functions inherited from abacus::SparVec | |
void | rangeCheck (int i) const |
Checks whether i is a valid index. More... | |
Representation of constraints in the row format.
This class refines its base class SparVec for the representation of constraints in the row format. This class plays an essential role in the interface with the LP-solver.
This class should not be confused with the class Constraint, which is an abstract class for the representation of constraints within the framework. Moreover, the class RowCon derived from the class Constraint provides a constraint representation in row format, but there are also other representations of constraints.
|
inline |
Creates a row and initializes it.
glob | A pointer to the corresponding global object. |
nnz | The number of nonzero elements of the row. |
s | The array storing the nonzero elements. |
c | The array storing the nonzero coefficients of the elements of s. |
sense | The sense of the row. |
r | The right hand side of the row. |
|
inline |
Creates a row and initializes it.
glob | A pointer to the corresponding global object. |
nnz | The number of nonzero elements of the row. |
s | The array storing the nonzero elements. |
c | The array storing the nonzero coefficients of the elements of s. |
sense | The sense of the row. |
r | The right hand side of the row. |
|
inline |
Creates a row and initializes it using C-style arrays.
glob | A pointer to the corresponding global object. |
nnz | The number of nonzero elements of the row. |
s | The array storing the nonzero elements. |
c | The array storing the nonzero coefficients of the elements of s. |
sense | The sense of the row. |
r | The right hand side of the row. |
|
inline |
void abacus::Row::copy | ( | const Row & | row | ) |
Copies row
.
Behaves like an assignment operator, however, the maximal number of the elements of this row only has to be at least the number of nonzeros of row.
row | The row that is copied. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
The output operator.
Writes the row on an output stream in format like -2.5 x1 + 3 x3 <= 7
.
Only variables with nonzero coefficients are output. The output operator does neither output a '+' before the first coefficient of a row, if it is positive, nor outputs coefficients with absolute value 1.
out | The output stream. |
rhs | The row being output. |
|
protected |