Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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.
 
 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.
 
- 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.
 
 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.
 
SparVecoperator= (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
 
- Public Member Functions inherited from abacus::AbacusRoot
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 Public Member Functions inherited from abacus::AbacusRoot
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 charonOff (bool value)
 Converts a boolean variable to the strings "on" and "off".
 
- Protected Member Functions inherited from abacus::SparVec
void rangeCheck (int i) const
 Checks whether i is a valid index.
 
- Protected Attributes inherited from abacus::SparVec
doublecoeff_
 The array storing the corresponding nonzero coefficients.
 
AbacusGlobalglob_
 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.
 
intsupport_
 The array storing the nonzero variables.
 

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 Symbol 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: