Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

rowcon.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include <ogdf/lib/abacus/row.h>
34 #include <ogdf/lib/abacus/numvar.h>
35 
36 namespace abacus {
37 
38 
40 
49 class RowCon : public Constraint {
50 public:
51 
53 
72  RowCon(Master *master,
73  const Sub *sub,
75  int nnz,
76  const Array<int> &support,
77  const Array<double> &coeff,
78  double rhs,
79  bool dynamic,
80  bool local,
81  bool liftable)
82  :
83  Constraint(master, sub, sense, rhs, dynamic, local, liftable),
84  row_(master, nnz, support, coeff, sense, rhs)
85  { }
86 
88 
107  RowCon(Master *master,
108  const Sub *sub,
110  int nnz,
111  int *support,
112  double *coeff,
113  double rhs,
114  bool dynamic,
115  bool local,
116  bool liftable)
117  :
118  Constraint(master, sub, sense, rhs, dynamic, local, liftable),
119  row_(master, nnz, support, coeff, sense, rhs)
120  { }
121 
123  virtual ~RowCon() { }
124 
126 
136  virtual double coeff(const Variable *v) const override {
137  const NumVar *numVar = static_cast<const NumVar *>(v);
138  return row_.origCoeff(numVar->number());
139  }
140 
142 
147  virtual void print(std::ostream &out) const override {
148  out << row_;
149  }
150 
152  Row *row() { return &row_; }
153 
155  const Row *row() const { return &row_; }
156 
157 protected:
158 
160 };
161 
162 }
CSense * sense()
Returns a pointer to the sense of the constraint.
Definition: constraint.h:115
variable identified by a number.
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:200
Representation of constraints in the row format.
Definition: row.h:51
virtual void print(std::ostream &out) const override
Writes the row format of the constraint on an output stream.
Definition: rowcon.h:147
The master of the optimization.
Definition: master.h:69
virtual double rhs() const
Returns the right hand side of the constraint.
Definition: constraint.h:130
Variables identified by a number.
Definition: numvar.h:42
The subproblem.
Definition: sub.h:68
int number() const
Returns the number of the variable.
Definition: numvar.h:90
Row * row()
Returns a pointer to the object of the class Row representing the constraint.
Definition: rowcon.h:152
virtual double coeff(const Variable *v) const override
Computes the coefficient of a variable which must be of type NumVar.
Definition: rowcon.h:136
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:56
bool local() const
Returns true if the constraint/variable is only locally valid, false otherwise.
Definition: convar.h:113
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.
Definition: rowcon.h:107
virtual bool dynamic() const
Return true if the constraint/variable is dynamic.
Definition: convar.h:124
bool liftable() const
Checks if the constraint is liftable.
Definition: constraint.h:140
Implements constraints stored in the class Row.
Definition: rowcon.h:49
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
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.
Definition: rowcon.h:72
row.
virtual ~RowCon()
The destructor.
Definition: rowcon.h:123
Row row_
The representation of the constraint.
Definition: rowcon.h:159
const Row * row() const
Returns a const pointer to the object of the class Row representing the constraint.
Definition: rowcon.h:155
const Sub * sub() const
Returns a const pointer to the subproblem associated with the constraint/variable.
Definition: convar.h:199
double origCoeff(int i) const