Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

numcon.h
Go to the documentation of this file.
1 
33 #pragma once
34 
36 
37 
38 #pragma GCC visibility push(default)
39 namespace abacus {
40 
41 
43 
47 class OGDF_EXPORT NumCon : public Constraint {
48 public:
49 
51 
68  NumCon(Master *master,
69  const Sub *sub,
70  CSense::SENSE sense,
71  bool dynamic,
72  bool local,
73  bool liftable,
74  int number,
75  double rhs)
76  : Constraint(master, sub, sense, rhs, dynamic, local, liftable), number_(number)
77  { }
78 
80  virtual ~NumCon() { }
81 
83 
89  friend std::ostream &operator<<(std::ostream &out, const NumCon &rhs) {
90  return out << "number = " << rhs.number_ << " rhs = " << rhs.rhs_ << std::endl;
91  }
92 
94 
98  virtual double coeff(const Variable *v) const;
99 
101 
106  virtual void print(std::ostream &out) const {
107  out << *this;
108  }
109 
111  int number() const { return number_; }
112 
113 
114 private:
115  int number_;
116 };
117 
118 }
119 #pragma GCC visibility pop
120 
121 #include <ogdf/lib/abacus/colvar.h>
122 
123 #pragma GCC visibility push(default)
124 namespace abacus {
125 
126 inline double NumCon::coeff(const Variable *v) const
127 {
128  const ColVar *colvar = (const ColVar *) v;
129  return colvar->coeff(number_);
130 }
131 
132 }
133 #pragma GCC visibility pop
constraint.h
constraint.
abacus::Constraint::rhs_
double rhs_
The right hand side of the constraint.
Definition: constraint.h:268
abacus::NumCon
Constraints defined by a number.
Definition: numcon.h:47
abacus
Definition: ILPClusterPlanarity.h:50
abacus::ColVar
Some optimization problems, in particular column generation problems, are better described from a var...
Definition: colvar.h:57
abacus::ColVar::coeff
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition: colvar.h:153
abacus::NumCon::operator<<
friend std::ostream & operator<<(std::ostream &out, const NumCon &rhs)
The output operator writes the identification number and the right hand side to an output stream.
Definition: numcon.h:89
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:60
abacus::NumCon::number_
int number_
The identification number of the constraint.
Definition: numcon.h:115
abacus::NumCon::print
virtual void print(std::ostream &out) const
Writes the row format of the constraint on an output stream.
Definition: numcon.h:106
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition: config.h:117
abacus::Sub
The subproblem.
Definition: sub.h:69
abacus::Constraint
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:57
abacus::NumCon::~NumCon
virtual ~NumCon()
The destructor.
Definition: numcon.h:80
abacus::NumCon::NumCon
NumCon(Master *master, const Sub *sub, CSense::SENSE sense, bool dynamic, bool local, bool liftable, int number, double rhs)
Creates a constraint defined by number.
Definition: numcon.h:68
colvar.h
colvar.
abacus::NumCon::number
int number() const
Returns the identification number of the constraint.
Definition: numcon.h:111
abacus::NumCon::coeff
virtual double coeff(const Variable *v) const
Returns the coefficient of the variable v.
Definition: numcon.h:126
abacus::CSense::SENSE
SENSE
Definition: csense.h:52
abacus::Master
The master of the optimization.
Definition: master.h:70