Representation of variables in column format. More...
#include <ogdf/lib/abacus/column.h>
Public Member Functions | |
Column (AbacusGlobal *glob, double obj, double lb, double ub, int nnz, Array< int > &s, Array< double > &c) | |
Creates and initializes a column. | |
Column (AbacusGlobal *glob, double obj, double lb, double ub, SparVec &vec) | |
Creates a column initialized by a sparse vector vec. | |
Column (AbacusGlobal *glob, int maxNnz) | |
Creates an uninitialized column. | |
~Column () | |
void | copy (const Column &col) |
Copies column col. | |
double | lBound () const |
Returns the lower bound of the column. | |
void | lBound (double l) |
Sets the lower bound of the column to l. | |
double | obj () const |
Returns the objective function coefficient of the column. | |
void | obj (double c) |
Sets the objective function coefficient of the column to c . | |
double | uBound () const |
Returns the upper bound of the column. | |
void | uBound (double u) |
Sets the upper bound of the column to u. | |
![]() | |
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. | |
SparVec (AbacusGlobal *glob, int size, double reallocFac=10.0) | |
Creates an empty sparse vector. | |
SparVec (AbacusGlobal *glob, int size, int *s, double *c, double reallocFac=10.0) | |
Creates a sparse vector and initializes support and coefficients. | |
SparVec (const SparVec &rhs) | |
Copy constructor. | |
~SparVec () | |
The destructor. | |
void | clear () |
Removes all nonzeros from the sparse vector. | |
double | coeff (int i) const |
void | copy (const SparVec &vec) |
Copies vector vec. | |
void | insert (int s, double c) |
Adds a new support/coefficient pair to the vector. | |
void | leftShift (ArrayBuffer< int > &del) |
Deletes the elements listed in a buffer from the sparse vector. | |
int | nnz () const |
Returns the number of nonzero elements. | |
double | norm () |
Returns the Euclidean norm of the sparse vector. | |
SparVec & | operator= (const SparVec &rhs) |
The assignment operator. | |
double | origCoeff (int i) const |
void | realloc () |
Increases the size of the sparse vector by reallocFac_ percent of the original size. | |
void | realloc (int newSize) |
Reallocates the sparse vector to a given length. | |
void | rename (Array< int > &newName) |
Replaces the index of the support by new names. | |
int | size () const |
Returns the maximal length of the sparse vector. | |
int | support (int i) const |
![]() | |
virtual | ~AbacusRoot () |
The destructor. | |
Private Attributes | |
double | lBound_ |
The lower bound of the column. | |
double | obj_ |
The objective function coefficient of the column. | |
double | uBound_ |
The upper bound of the column. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Column &rhs) |
The output operator. | |
Additional Inherited Members | |
![]() | |
static bool | ascii2bool (const string &str) |
Converts the string str to a boolean value. | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". | |
![]() | |
void | rangeCheck (int i) const |
Checks whether i is a valid index. | |
![]() | |
double * | coeff_ |
The array storing the corresponding nonzero coefficients. | |
AbacusGlobal * | glob_ |
A pointer to the corresponding global object. | |
int | nnz_ |
The number of stored elements ("nonzeros"). | |
double | reallocFac_ |
If a new element is inserted but the sparse vector is full, then its size is increased by reallocFac_ percent. | |
int | size_ |
The maximal number of nonzero coefficients which can be stored without reallocation. | |
int * | support_ |
The array storing the nonzero variables. | |
Representation of variables in column format.
The class Column refines SparVec for the representation of variables in column format. In the same way as the class Row refines the class SparVec for the representation of constraints in row format, the class Column refines SparVec for the representation of variables in column format. This class should not be confused with the class Variable for the abstract representation of variables within the framework. Again, there is a class ColVar derived from Variable having a member of type Column, but there are also other classes derived from Variable.
|
inline |
Creates and initializes a column.
glob | A pointer to the corresponding global object. |
obj | The objective function coefficient. |
lb | The lower bound. |
ub | The upper bound. |
nnz | The number of nonzero elements stored in the arrays s and c. |
s | An array of the nonzero elements of the column. |
c | An array of the nonzero coefficients associated with the elements of s. |
|
inline |
|
inline |
Creates a column initialized by a sparse vector vec.
glob | A pointer to the corresponding global object. |
obj | The objective function coefficient. |
lb | The lower bound. |
ub | The upper bound. |
vec | A sparse vector storing the support and the coefficients of the column. |
Copies column col.
Is very similar to the assignment operator, yet the columns do not have to be of equal size. A reallocation is performed if required.
col | The column that is copied. |
|
inline |
|
inline |
|
inline |
The output operator.
out | The output stream. |
rhs | The column being output. |
|
private |
|
private |
|
private |