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 namespace abacus {
39 
40 
42 
46 class OGDF_EXPORT NumCon : public Constraint {
47 public:
48 
50 
67  NumCon(Master *master,
68  const Sub *sub,
69  CSense::SENSE sense,
70  bool dynamic,
71  bool local,
72  bool liftable,
73  int number,
74  double rhs)
75  : Constraint(master, sub, sense, rhs, dynamic, local, liftable), number_(number)
76  { }
77 
79  virtual ~NumCon() { }
80 
82 
88  friend std::ostream &operator<<(std::ostream &out, const NumCon &rhs) {
89  return out << "number = " << rhs.number_ << " rhs = " << rhs.rhs_ << std::endl;
90  }
91 
93 
97  virtual double coeff(const Variable *v) const;
98 
100 
105  virtual void print(std::ostream &out) const {
106  out << *this;
107  }
108 
110  int number() const { return number_; }
111 
112 
113 private:
114  int number_;
115 };
116 
117 }
118 
119 #include <ogdf/lib/abacus/colvar.h>
120 
121 namespace abacus {
122 
123 inline double NumCon::coeff(const Variable *v) const
124 {
125  const ColVar *colvar = (const ColVar *) v;
126  return colvar->coeff(number_);
127 }
128 
129 }
constraint.h
constraint.
abacus::Constraint::rhs_
double rhs_
The right hand side of the constraint.
Definition: constraint.h:267
abacus::NumCon
Constraints defined by a number.
Definition: numcon.h:46
abacus
Definition: ILPClusterPlanarity.h:50
abacus::ColVar
Some optimization problems, in particular column generation problems, are better described from a var...
Definition: colvar.h:56
abacus::ColVar::coeff
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition: colvar.h:152
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:88
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
abacus::NumCon::number_
int number_
The identification number of the constraint.
Definition: numcon.h:114
abacus::NumCon::print
virtual void print(std::ostream &out) const
Writes the row format of the constraint on an output stream.
Definition: numcon.h:105
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
abacus::Sub
The subproblem.
Definition: sub.h:68
abacus::Constraint
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:56
abacus::NumCon::~NumCon
virtual ~NumCon()
The destructor.
Definition: numcon.h:79
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:67
colvar.h
colvar.
abacus::NumCon::number
int number() const
Returns the identification number of the constraint.
Definition: numcon.h:110
abacus::NumCon::coeff
virtual double coeff(const Variable *v) const
Returns the coefficient of the variable v.
Definition: numcon.h:123
abacus::CSense::SENSE
SENSE
Definition: csense.h:51
abacus::Master
The master of the optimization.
Definition: master.h:69