Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 ostream &operator<<(ostream &out, const NumCon &rhs) {
89  return out << "number = " << rhs.number_ << " rhs = " << rhs.rhs_ << endl;
90  }
91 
93 
97  virtual double coeff(const Variable *v) const;
98 
100 
105  virtual void print(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 } //namespace abacus
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition: colvar.h:152
The master of the optimization.
Definition: master.h:69
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
colvar.
The subproblem.
Definition: sub.h:68
int number_
The identification number of the constraint.
Definition: numcon.h:114
int number() const
Returns the identification number of the constraint.
Definition: numcon.h:110
virtual ~NumCon()
The destructor.
Definition: numcon.h:79
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:56
virtual double coeff(const Variable *v) const
Returns the coefficient of the variable v.
Definition: numcon.h:123
constraint.
double rhs_
The right hand side of the constraint.
Definition: constraint.h:267
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
Constraints defined by a number.
Definition: numcon.h:46
virtual void print(ostream &out) const
Writes the row format of the constraint on an output stream.
Definition: numcon.h:105
Some optimization problems, in particular column generation problems, are better described from a var...
Definition: colvar.h:56
friend ostream & operator<<(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
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