Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

abacus::SRowCon Class Reference

Constraints using row with static variable set. More...

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

+ Inheritance diagram for abacus::SRowCon:

Public Member Functions

 SRowCon (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. More...
 
 SRowCon (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. More...
 
virtual ~SRowCon ()
 The destructor. More...
 
virtual int genRow (Active< Variable, Constraint > *var, Row &row) const override
 Generates the row format of the constraint associated with the variable set var. More...
 
virtual double slack (Active< Variable, Constraint > *variables, double *x) const override
 Computes the slack of a vector associated with the variable set variables. More...
 
- Public Member Functions inherited from 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)
 Creates a row constraint. More...
 
 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. More...
 
virtual ~RowCon ()
 The destructor. More...
 
virtual double coeff (const Variable *v) const override
 Computes the coefficient of a variable which must be of type NumVar. More...
 
virtual void print (std::ostream &out) const override
 Writes the row format of the constraint on an output stream. More...
 
Rowrow ()
 Returns a pointer to the object of the class Row representing the constraint. More...
 
const Rowrow () const
 Returns a const pointer to the object of the class Row representing the constraint. More...
 
- Public Member Functions inherited from abacus::Constraint
 Constraint (const Constraint &rhs)
 Copy constructor. More...
 
 Constraint (Master *master)
 Initializes an empty constraint. More...
 
 Constraint (Master *master, const Sub *sub, CSense::SENSE sense, double rhs, bool dynamic, bool local, bool liftable)
 Initializes a constraint. More...
 
virtual ~Constraint ()
 
ConClassclassification (Active< Variable, Constraint > *var=nullptr) const
 Returns a pointer to the classification of the constraint. More...
 
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. More...
 
bool liftable () const
 Checks if the constraint is liftable. More...
 
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. More...
 
virtual double rhs () const
 Returns the right hand side of the constraint. More...
 
CSensesense ()
 Returns a pointer to the sense of the constraint. More...
 
const CSensesense () const
 Returns a const pointer to the sense of the constraint. More...
 
virtual bool valid (Sub *sub) const
 Checks if the constraint is valid for the subproblem sub. More...
 
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. More...
 
virtual bool violated (double slack) const
 Checks if a constraint is violated given the slack of a vector. 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...
 
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...
 
bool global () const
 Returns true if the constraint/variable is globally valid, false otherwise. 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...
 
bool local () const
 Returns true if the constraint/variable is only locally valid, false otherwise. More...
 
virtual const char * name () const
 Should return the name of the constraint/variable. More...
 
virtual double rank () const
 The function should return a rank associated with the constraint/variable. 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...
 
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...
 
- Public Member Functions inherited from abacus::AbacusRoot
virtual ~AbacusRoot ()
 The destructor. 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::Constraint
virtual ConClassclassify (Active< Variable, Constraint > *var) const
 The default implementation returns a 0 pointer. More...
 
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. More...
 
- Protected Attributes inherited from abacus::RowCon
Row row_
 The representation of the constraint. More...
 
- 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. More...
 
double rhs_
 The right hand side of the constraint. More...
 
CSense sense_
 The sense of the constraint. More...
 
- 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. More...
 
bool expanded_
 true, if expanded version of constraint/variables available. More...
 
bool local_
 true if the constraint/variable is only locally valid More...
 
Mastermaster_
 A pointer to the corresponding master of the optimization. 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...
 
int nReferences_
 The number of references to the pool slot the constraint is stored in. More...
 
const Subsub_
 A pointer to the subproblem associated with the constraint/variable. More...
 

Detailed Description

Constraints using row with static variable set.

The member functions genRow() and slack() of the class RowCon can be significantly improved if the variable set is static, i.e., no variables are added or removed during the optimization. Therefore we implement the class SRowCon.

Definition at line 43 of file srowcon.h.

Constructor & Destructor Documentation

◆ SRowCon() [1/2]

abacus::SRowCon::SRowCon ( 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 be also 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 66 of file srowcon.h.

◆ SRowCon() [2/2]

abacus::SRowCon::SRowCon ( 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 be also 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 99 of file srowcon.h.

◆ ~SRowCon()

virtual abacus::SRowCon::~SRowCon ( )
inlinevirtual

The destructor.

Definition at line 113 of file srowcon.h.

Member Function Documentation

◆ genRow()

virtual int abacus::SRowCon::genRow ( Active< Variable, Constraint > *  var,
Row row 
) const
inlineoverridevirtual

Generates the row format of the constraint associated with the variable set var.

This function redefines a virtual function of the base class RowCon.

Returns
It returns the number of nonzero elements in the row format.
Parameters
varThe variable set for which the row format is generated is only a dummy since the the variable set is assumed to be fixed for this constraint class.
rowHolds the row format of the constraint after the execution of this function.

Reimplemented from abacus::Constraint.

Definition at line 126 of file srowcon.h.

◆ slack()

virtual double abacus::SRowCon::slack ( Active< Variable, Constraint > *  variables,
double *  x 
) const
overridevirtual

Computes the slack of a vector associated with the variable set variables.

This function redefines a virtual function of the base class RowCon.

Parameters
variablesThe variable set for which the row format is generated is only a dummy since the the variable set is assumed to be fixed for this constraint class.
xAn array of length equal to the number of variables.
Returns
The slack of the vector x.

Reimplemented from abacus::Constraint.


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