Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

abacus::ColVar Class Reference

Some optimization problems, in particular column generation problems, are better described from a variable point of view instead of a constraint point of view. More...

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

+ Inheritance diagram for abacus::ColVar:

Public Member Functions

 ColVar (Master *master, const Sub *sub, bool dynamic, bool local, double lBound, double uBound, VarType::TYPE varType, double obj, int nnz, Array< int > &support, Array< double > &coeff)
 The constructor. More...
 
 ColVar (Master *master, const Sub *sub, bool dynamic, bool local, double lBound, double uBound, VarType::TYPE varType, double obj, SparVec &vector)
 Constructor using a sparse vector vector. More...
 
virtual ~ColVar ()
 
virtual double coeff (const Constraint *con) const
 Returns the coefficient of the constraint con. More...
 
double coeff (int i) const
 Computes the coefficient of a constraint with given index i. More...
 
Columncolumn ()
 Returns a pointer to the column representing the variable. More...
 
const Columncolumn () const
 Returns a const pointer to the column representing the variable. More...
 
virtual void print (std::ostream &out) const
 Writes the column representing the variable to output stream out. More...
 
- Public Member Functions inherited from abacus::Variable
 Variable (Master *master, const Sub *sub, bool dynamic, bool local, double obj, double lBound, double uBound, VarType::TYPE type)
 Initializes a variable. More...
 
virtual ~Variable ()
 
bool binary () const
 Returns true If the type of the variable is Binary, false otherwise. More...
 
bool discrete () const
 Returns true if the type of the variable is Integer or Binary, false otherwise. More...
 
FSVarStatfsVarStat ()
 
const FSVarStatfsVarStat () const
 
virtual int genColumn (Active< Constraint, Variable > *actCon, Column &col) const
 Computes the column col of the variable associated with the active constraints *actCon. More...
 
bool integer () const
 Returns true If the type of the variable is Integer, false otherwise. More...
 
double lBound () const
 Returns the lower bound of the variable. More...
 
void lBound (double newBound)
 Sets the lower bound of the variable to newBound. More...
 
virtual double obj () const
 Returns the objective function coefficient. More...
 
void printCol (std::ostream &out, Active< Constraint, Variable > *constraints) const
 Writes the column of the variable corresponding to the constraints to output stream out. More...
 
virtual double redCost (Active< Constraint, Variable > *actCon, double *y) const
 Computes the reduced cost of the variable corresponding the constraint set actCon and the dual variables y. More...
 
double uBound () const
 Returns the upper bound of the variable. More...
 
void uBound (double newBound)
 Sets the upper bound of the variable to newBound. More...
 
virtual bool useful (Active< Constraint, Variable > *actCon, double *y, double lpVal) const
 Returns whether an (inactive) discrete variable is useful. More...
 
virtual bool valid (const Sub *sub) const
 Returns true if the variable is valid, false otherwise. More...
 
VarType::TYPE varType () const
 Returns the type of the variable. More...
 
virtual bool violated (Active< Constraint, Variable > *constraints, double *y, double *slack=nullptr) const
 Checks, if a variable does not price out correctly. More...
 
virtual bool violated (double rc) const
 Checks, if a variable does not price out correctly. More...
 
- Public Member Functions inherited from abacus::ConVar
 ConVar (Master *master, const Sub *sub, bool dynamic, bool local)
 Creates an instance of type ConVar. More...
 
virtual ~ConVar ()
 
bool active () const
 Checks if the constraint/variable is active in at least one active subproblem. More...
 
virtual bool dynamic () const
 Return true if the constraint/variable is dynamic. More...
 
bool global () const
 Returns true if the constraint/variable is globally valid, false otherwise. More...
 
bool local () const
 Returns true if the constraint/variable is only locally valid, false otherwise. More...
 
bool expanded () const
 Returns true if the expanded format of a constraint/variable is available, false otherwise. More...
 
virtual void expand () const
 Expands a constraint/variable. More...
 
virtual void compress () const
 Compresses a constraint/variable. More...
 
virtual bool deletable () const
 Returns true if the constraint/variable can be destructed. More...
 
const Subsub () const
 Returns a const pointer to the subproblem associated with the constraint/variable. More...
 
void sub (Sub *sub)
 Associates a new subproblem with the constraint/variable. More...
 
virtual unsigned hashKey () const
 Should provide a key for the constraint/variable that can be used to insert it into a hash table. More...
 
virtual const char * name () const
 Should return the name of the constraint/variable. More...
 
virtual bool equal (const ConVar *cv) const
 Should compare if the constraint/variable is identical (in a mathematical sense) with the constraint/variable cv. More...
 
virtual double rank () const
 The function should return a rank associated with the constraint/variable. More...
 
- Public Member Functions inherited from abacus::AbacusRoot
virtual ~AbacusRoot ()
 The destructor. More...
 

Protected Attributes

Column column_
 
- Protected Attributes inherited from abacus::Variable
FSVarStat fsVarStat_
 The global status of fixing and setting of the variable. More...
 
double lBound_
 The lower bound of the variable. More...
 
double obj_
 The objective function coefficient of the variable. More...
 
VarType type_
 The type of the variable. More...
 
double uBound_
 The upper bound of the variable. More...
 
- Protected Attributes inherited from abacus::ConVar
Mastermaster_
 A pointer to the corresponding master of the optimization. More...
 
const Subsub_
 A pointer to the subproblem associated with the constraint/variable. More...
 
bool expanded_
 true, if expanded version of constraint/variables available. More...
 
int nReferences_
 The number of references to the pool slot the constraint is stored in. More...
 
bool dynamic_
 If this member is true then the constraint/variable can be also removed from the active formulation after it is added the first time. More...
 
int nActive_
 The number of active subproblems of which the constraint/variable belongs to the set of active constraints/variables. More...
 
int nLocks_
 The number of locks which have been set on the constraint/variable. More...
 
bool local_
 true if the constraint/variable is only locally valid More...
 

Friends

std::ostream & operator<< (std::ostream &out, const ColVar &rhs)
 Output operator for column variables. 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...
 

Detailed Description

Some optimization problems, in particular column generation problems, are better described from a variable point of view instead of a constraint point of view.

For such context we provide the class ColVar which similar to the class RowCon stores the nonzero coefficient explicitly in an object of the class Column.

The constraint class which is associated with this variables class is the class NumCon which identifies constraints only by a unique integer number. NumCon is an abstract class.

Definition at line 56 of file colvar.h.

Constructor & Destructor Documentation

◆ ColVar() [1/2]

abacus::ColVar::ColVar ( Master master,
const Sub sub,
bool  dynamic,
bool  local,
double  lBound,
double  uBound,
VarType::TYPE  varType,
double  obj,
int  nnz,
Array< int > &  support,
Array< double > &  coeff 
)
inline

The constructor.

Parameters
masterA pointer to the corresponding master of the optimization.
subA pointer to the subproblem associated with the variable. This can be also the 0-pointer.
dynamicIf this argument is true, then the variable can be removed from the active variable set during the subproblem optimization.
localIf this argument is true, then the constraint is considered to be only locally valid. As a local variable is associated with a subproblem, sub must not be 0 if local is true.
lBoundThe lower bound of the variable.
uBoundThe upper bound of the variable.
varTypeThe type of the variable.
objThe objective function coefficient of the variable.
nnzThe number of nonzero elements of the variable.
supportThe array storing the constraints with the nonzero coefficients.
coeffThe nonzero coefficients of the constraints stored in support.

Definition at line 77 of file colvar.h.

◆ ColVar() [2/2]

abacus::ColVar::ColVar ( Master master,
const Sub sub,
bool  dynamic,
bool  local,
double  lBound,
double  uBound,
VarType::TYPE  varType,
double  obj,
SparVec vector 
)
inline

Constructor using a sparse vector vector.

Parameters
masterA pointer to the corresponding master of the optimization.
subA pointer to the subproblem associated with the variable. This can be also the 0-pointer.
dynamicIf this argument is true, then the variable can be removed from the active variable set during the subproblem optimization.
localIf this argument is true, then the constraint is considered to be only locally valid. As a local variable is associated with a subproblem, sub must not be 0 if local is true.
lBoundThe lower bound of the variable.
uBoundThe upper bound of the variable.
varTypeThe type of the variable.
objThe objective function coefficient of the variable.
vectorThe constraints.

Definition at line 109 of file colvar.h.

◆ ~ColVar()

virtual abacus::ColVar::~ColVar ( )
inlinevirtual

Definition at line 123 of file colvar.h.

Member Function Documentation

◆ coeff() [1/2]

virtual double abacus::ColVar::coeff ( const Constraint con) const
inlinevirtual

Returns the coefficient of the constraint con.

Parameters
conThe constraint of which the coefficient is computed. This must be a pointer to the class NumCon.

Reimplemented from abacus::Variable.

Definition at line 152 of file colvar.h.

◆ coeff() [2/2]

double abacus::ColVar::coeff ( int  i) const
inline

Computes the coefficient of a constraint with given index i.

Parameters
iThe number of the constraint.
Returns
The coefficient of constraint i.

Definition at line 162 of file colvar.h.

◆ column() [1/2]

Column* abacus::ColVar::column ( )
inline

Returns a pointer to the column representing the variable.

Definition at line 166 of file colvar.h.

◆ column() [2/2]

const Column* abacus::ColVar::column ( ) const
inline

Returns a const pointer to the column representing the variable.

Definition at line 169 of file colvar.h.

◆ print()

virtual void abacus::ColVar::print ( std::ostream &  out) const
inlinevirtual

Writes the column representing the variable to output stream out.

It redefines the virtual function print() of the base class ConVar.

Parameters
outThe output stream.

Reimplemented from abacus::ConVar.

Definition at line 143 of file colvar.h.

Friends And Related Function Documentation

◆ operator<<

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

Output operator for column variables.

The output operator writes the column representing the variable to an output stream.

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

Definition at line 177 of file colvar.h.

Member Data Documentation

◆ column_

Column abacus::ColVar::column_
protected

Definition at line 173 of file colvar.h.


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