Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
abacus::RowCon Class Reference

Implements constraints stored in the class Row. More...

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

+ Inheritance diagram for abacus::RowCon:

Public Member Functions

 RowCon (Master *master, const Sub *sub, CSense::SENSE sense, int nnz, const Array< int > &support, const Array< double > &coeff, double rhs, bool dynamic, bool local, bool liftable)
 Creates a row constraint.
 
 RowCon (Master *master, const Sub *sub, CSense::SENSE sense, int nnz, int *support, double *coeff, double rhs, bool dynamic, bool local, bool liftable)
 Creates a row constraint.
 
virtual ~RowCon ()
 The destructor.
 
virtual double coeff (const Variable *v) const override
 Computes the coefficient of a variable which must be of type NumVar.
 
virtual void print (std::ostream &out) const override
 Writes the row format of the constraint on an output stream.
 
Rowrow ()
 Returns a pointer to the object of the class Row representing the constraint.
 
const Rowrow () const
 Returns a const pointer to the object of the class Row representing the constraint.
 
- Public Member Functions inherited from abacus::Constraint
 Constraint (const Constraint &rhs)
 Copy constructor.
 
 Constraint (Master *master)
 Initializes an empty constraint.
 
 Constraint (Master *master, const Sub *sub, CSense::SENSE sense, double rhs, bool dynamic, bool local, bool liftable)
 Initializes a constraint.
 
virtual ~Constraint ()
 
ConClassclassification (Active< Variable, Constraint > *var=nullptr) const
 Returns a pointer to the classification of the constraint.
 
virtual double distance (double *x, Active< Variable, Constraint > *actVar) const
 Returns the Euclidean distance of x associated with variable set actVar to the hyperplane induced by the constraint.
 
virtual int genRow (Active< Variable, Constraint > *var, Row &row) const
 Generates the row format of the constraint associated with the variable set var.
 
bool liftable () const
 Checks if the constraint is liftable.
 
void printRow (std::ostream &out, Active< Variable, Constraint > *var) const
 Writes the row format of the constraint associated with the variable set var to output stream out.
 
virtual double rhs () const
 Returns the right hand side of the constraint.
 
CSensesense ()
 Returns a pointer to the sense of the constraint.
 
const CSensesense () const
 Returns a const pointer to the sense of the constraint.
 
virtual double slack (Active< Variable, Constraint > *variables, double *x) const
 Computes the slack of the vector x associated with the variable set variables.
 
virtual bool valid (Sub *sub) const
 Checks if the constraint is valid for the subproblem sub.
 
virtual bool violated (Active< Variable, Constraint > *variables, double *x, double *sl=nullptr) const
 Checks if a constraint is violated by a vector x associated with a variable set.
 
virtual bool violated (double slack) const
 Checks if a constraint is violated given the slack of a vector.
 
- Public Member Functions inherited from abacus::ConVar
 ConVar (Master *master, const Sub *sub, bool dynamic, bool local)
 Creates an instance of type ConVar.
 
virtual ~ConVar ()
 
bool active () const
 Checks if the constraint/variable is active in at least one active subproblem.
 
virtual bool dynamic () const
 Return true if the constraint/variable is dynamic.
 
virtual bool equal (const ConVar *cv) const
 Should compare if the constraint/variable is identical (in a mathematical sense) with the constraint/variable cv.
 
bool global () const
 Returns true if the constraint/variable is globally valid, false otherwise.
 
virtual unsigned hashKey () const
 Should provide a key for the constraint/variable that can be used to insert it into a hash table.
 
bool local () const
 Returns true if the constraint/variable is only locally valid, false otherwise.
 
virtual const charname () const
 Should return the name of the constraint/variable.
 
virtual double rank () const
 The function should return a rank associated with the constraint/variable.
 
const Subsub () const
 Returns a const pointer to the subproblem associated with the constraint/variable.
 
void sub (Sub *sub)
 Associates a new subproblem with the constraint/variable.
 
bool expanded () const
 Returns true if the expanded format of a constraint/variable is available, false otherwise.
 
virtual void expand () const
 Expands a constraint/variable.
 
virtual void compress () const
 Compresses a constraint/variable.
 
virtual bool deletable () const
 Returns true if the constraint/variable can be destructed.
 
- Public Member Functions inherited from abacus::AbacusRoot
virtual ~AbacusRoot ()
 The destructor.
 

Protected Attributes

Row row_
 The representation of the constraint.
 
- Protected Attributes inherited from abacus::Constraint
ConClassconClass_
 
bool liftable_
 This member is true if also coefficients of variables which have been inactive at generation time can be computed, false otherwise.
 
double rhs_
 The right hand side of the constraint.
 
CSense sense_
 The sense of the constraint.
 
- Protected Attributes inherited from abacus::ConVar
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.
 
bool expanded_
 true, if expanded version of constraint/variables available.
 
bool local_
 true if the constraint/variable is only locally valid
 
Mastermaster_
 A pointer to the corresponding master of the optimization.
 
int nActive_
 The number of active subproblems of which the constraint/variable belongs to the set of active constraints/variables.
 
int nLocks_
 The number of locks which have been set on the constraint/variable.
 
int nReferences_
 The number of references to the pool slot the constraint is stored in.
 
const Subsub_
 A pointer to the subproblem associated with the constraint/variable.
 

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::Constraint
virtual ConClassclassify (Active< Variable, Constraint > *var) const
 The default implementation returns a 0 pointer.
 
virtual InfeasCon::INFEAS voidLhsViolated (double newRhs) const
 Can be called if after variable elimination the left hand side of the constraint has become void and the right hand side has been adapted to newRhs.
 

Detailed Description

Implements constraints stored in the class Row.

Earlier we explained that we distinguish between the constraint and the row format. We have seen already that a constraint is transformed to the row format when it is added to the linear program. However, for some constraints of certain optimization problems the row format itself is the most suitable representation. Therefore the class RowCon implements constraints stored in the class Row.

Definition at line 49 of file rowcon.h.

Constructor & Destructor Documentation

◆ RowCon() [1/2]

abacus::RowCon::RowCon ( Master master,
const Sub sub,
CSense::SENSE  sense,
int  nnz,
const Array< int > &  support,
const Array< double > &  coeff,
double  rhs,
bool  dynamic,
bool  local,
bool  liftable 
)
inline

Creates a row constraint.

Parameters
masterA pointer to the corresponding master of the optimization.
subA pointer to the subproblem associated with the constraint. This can also be the 0-pointer.
senseThe sense of the constraint.
nnzThe number of nonzero elements of the constraint.
supportThe array storing the variables with nonzero coefficients.
coeffThe nonzero coefficients of the variables stored in support.
rhsThe right hand side of the constraint.
dynamicIf this argument is true, then the constraint can be removed from the active constraint set during the cutting plane phase of the subproblem optimization.
localIf this argument is true, then the constraint is considered to be only locally valid. As a locally valid constraint is associated with a subproblem, sub must not be 0 if local is true.
liftableIf this argument is true, then a lifting procedure must be available, i.e., that the coefficients of variables which have not been active at generation time of the constraint can be computed.

Definition at line 72 of file rowcon.h.

◆ RowCon() [2/2]

abacus::RowCon::RowCon ( Master master,
const Sub sub,
CSense::SENSE  sense,
int  nnz,
int support,
double coeff,
double  rhs,
bool  dynamic,
bool  local,
bool  liftable 
)
inline

Creates a row constraint.

Parameters
masterA pointer to the corresponding master of the optimization.
subA pointer to the subproblem associated with the constraint. This can also be the 0-pointer.
senseThe sense of the constraint.
nnzThe number of nonzero elements of the constraint.
supportThe array storing the variables with nonzero coefficients.
coeffThe nonzero coefficients of the variables stored in support.
rhsThe right hand side of the constraint.
dynamicIf this argument is true, then the constraint can be removed from the active constraint set during the cutting plane phase of the subproblem optimization.
localIf this argument is true, then the constraint is considered to be only locally valid. As a locally valid constraint is associated with a subproblem, sub must not be 0 if local is true.
liftableIf this argument is true, then a lifting procedure must be available, i.e., that the coefficients of variables which have not been active at generation time of the constraint can be computed.

Definition at line 107 of file rowcon.h.

◆ ~RowCon()

virtual abacus::RowCon::~RowCon ( )
inlinevirtual

The destructor.

Definition at line 123 of file rowcon.h.

Member Function Documentation

◆ coeff()

virtual double abacus::RowCon::coeff ( const Variable v) const
inlineoverridevirtual

Computes the coefficient of a variable which must be of type NumVar.

It redefines the virtual function coeff() of the base class Constraint.

Warning
The worst case complexity of the call of this function is the number of nonzero elements of the constraint.
Parameters
vThe variable of which the coefficient is determined.
Returns
The coefficient of the variable v.

Implements abacus::Constraint.

Definition at line 136 of file rowcon.h.

◆ print()

virtual void abacus::RowCon::print ( std::ostream &  out) const
inlineoverridevirtual

Writes the row format of the constraint on an output stream.

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

Parameters
outThe output stream.

Reimplemented from abacus::ConVar.

Definition at line 147 of file rowcon.h.

◆ row() [1/2]

Row * abacus::RowCon::row ( )
inline

Returns a pointer to the object of the class Row representing the constraint.

Definition at line 152 of file rowcon.h.

◆ row() [2/2]

const Row * abacus::RowCon::row ( ) const
inline

Returns a const pointer to the object of the class Row representing the constraint.

Definition at line 155 of file rowcon.h.

Member Data Documentation

◆ row_

Row abacus::RowCon::row_
protected

The representation of the constraint.

Definition at line 159 of file rowcon.h.


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