Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

abacus::Column Class Reference

Representation of variables in column format. More...

#include <ogdf/lib/abacus/column.h>

+ Inheritance diagram for abacus::Column:

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. More...
 
 Column (AbacusGlobal *glob, double obj, double lb, double ub, SparVec &vec)
 Creates a column initialized by a sparse vector vec. More...
 
 Column (AbacusGlobal *glob, int maxNnz)
 Creates an uninitialized column. More...
 
 ~Column ()
 
void copy (const Column &col)
 Copies column col. More...
 
double lBound () const
 Returns the lower bound of the column. More...
 
void lBound (double l)
 Sets the lower bound of the column to l. More...
 
double obj () const
 Returns the objective function coefficient of the column. More...
 
void obj (double c)
 Sets the objective function coefficient of the column to c. More...
 
double uBound () const
 Returns the upper bound of the column. More...
 
void uBound (double u)
 Sets the upper bound of the column to u. 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...
 
SparVecoperator= (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...
 

Private Attributes

double lBound_
 The lower bound of the column. More...
 
double obj_
 The objective function coefficient of the column. More...
 
double uBound_
 The upper bound of the column. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Column &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...
 
- Protected Attributes inherited from abacus::SparVec
double * coeff_
 The array storing the corresponding nonzero coefficients. More...
 
AbacusGlobalglob_
 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...
 

Detailed Description

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.

Definition at line 47 of file column.h.

Constructor & Destructor Documentation

◆ Column() [1/3]

abacus::Column::Column ( AbacusGlobal glob,
double  obj,
double  lb,
double  ub,
int  nnz,
Array< int > &  s,
Array< double > &  c 
)
inline

Creates and initializes a column.

Parameters
globA pointer to the corresponding global object.
objThe objective function coefficient.
lbThe lower bound.
ubThe upper bound.
nnzThe number of nonzero elements stored in the arrays s and c.
sAn array of the nonzero elements of the column.
cAn array of the nonzero coefficients associated with the elements of s.

Definition at line 60 of file column.h.

◆ Column() [2/3]

abacus::Column::Column ( AbacusGlobal glob,
int  maxNnz 
)
inline

Creates an uninitialized column.

Parameters
globA pointer to the corresponding global object.
maxNnzThe maximal number of nonzero elements that can be stored in the row.

Definition at line 74 of file column.h.

◆ Column() [3/3]

abacus::Column::Column ( AbacusGlobal glob,
double  obj,
double  lb,
double  ub,
SparVec vec 
)
inline

Creates a column initialized by a sparse vector vec.

Parameters
globA pointer to the corresponding global object.
objThe objective function coefficient.
lbThe lower bound.
ubThe upper bound.
vecA sparse vector storing the support and the coefficients of the column.

Definition at line 84 of file column.h.

◆ ~Column()

abacus::Column::~Column ( )
inline

Definition at line 91 of file column.h.

Member Function Documentation

◆ copy()

void abacus::Column::copy ( const Column col)

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.

Parameters
colThe column that is copied.

◆ lBound() [1/2]

double abacus::Column::lBound ( ) const
inline

Returns the lower bound of the column.

Definition at line 114 of file column.h.

◆ lBound() [2/2]

void abacus::Column::lBound ( double  l)
inline

Sets the lower bound of the column to l.

Parameters
lThe new value of the lower bound.

Definition at line 121 of file column.h.

◆ obj() [1/2]

double abacus::Column::obj ( ) const
inline

Returns the objective function coefficient of the column.

Definition at line 103 of file column.h.

◆ obj() [2/2]

void abacus::Column::obj ( double  c)
inline

Sets the objective function coefficient of the column to c.

Parameters
cThe new value of the objective function coefficient.

Definition at line 110 of file column.h.

◆ uBound() [1/2]

double abacus::Column::uBound ( ) const
inline

Returns the upper bound of the column.

Definition at line 125 of file column.h.

◆ uBound() [2/2]

void abacus::Column::uBound ( double  u)
inline

Sets the upper bound of the column to u.

Parameters
uThe new value of the upper bound.

Definition at line 132 of file column.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Column rhs 
)
friend

The output operator.

Parameters
outThe output stream.
rhsThe column being output.
Returns
A reference to the output stream.

Member Data Documentation

◆ lBound_

double abacus::Column::lBound_
private

The lower bound of the column.

Definition at line 147 of file column.h.

◆ obj_

double abacus::Column::obj_
private

The objective function coefficient of the column.

Definition at line 146 of file column.h.

◆ uBound_

double abacus::Column::uBound_
private

The upper bound of the column.

Definition at line 148 of file column.h.


The documentation for this class was generated from the following file: