Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 #pragma GCC visibility push(default)
37 namespace abacus {
38 
39 
41 
50 class RowCon : public Constraint {
51 public:
52 
54 
73  RowCon(Master *master,
74  const Sub *sub,
76  int nnz,
77  const Array<int> &support,
78  const Array<double> &coeff,
79  double rhs,
80  bool dynamic,
81  bool local,
82  bool liftable)
83  :
85  row_(master, nnz, support, coeff, sense, rhs)
86  { }
87 
89 
108  RowCon(Master *master,
109  const Sub *sub,
111  int nnz,
112  int *support,
113  double *coeff,
114  double rhs,
115  bool dynamic,
116  bool local,
117  bool liftable)
118  :
119  Constraint(master, sub, sense, rhs, dynamic, local, liftable),
120  row_(master, nnz, support, coeff, sense, rhs)
121  { }
122 
124  virtual ~RowCon() { }
125 
127 
137  virtual double coeff(const Variable *v) const override {
138  const NumVar *numVar = static_cast<const NumVar *>(v);
139  return row_.origCoeff(numVar->number());
140  }
141 
143 
148  virtual void print(std::ostream &out) const override {
149  out << row_;
150  }
151 
153  Row *row() { return &row_; }
154 
156  const Row *row() const { return &row_; }
157 
158 protected:
159 
161 };
162 
163 }
164 #pragma GCC visibility pop
abacus::ConVar::local
bool local() const
Returns true if the constraint/variable is only locally valid, false otherwise.
Definition: convar.h:114
abacus::RowCon::row_
Row row_
The representation of the constraint.
Definition: rowcon.h:160
abacus::SparVec::origCoeff
double origCoeff(int i) const
abacus::RowCon::row
const Row * row() const
Returns a const pointer to the object of the class Row representing the constraint.
Definition: rowcon.h:156
abacus::RowCon::RowCon
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:108
abacus::ConVar::sub
const Sub * sub() const
Returns a const pointer to the subproblem associated with the constraint/variable.
Definition: convar.h:200
constraint.h
constraint.
abacus::Constraint::rhs
virtual double rhs() const
Returns the right hand side of the constraint.
Definition: constraint.h:131
numvar.h
variable identified by a number.
abacus::RowCon::print
virtual void print(std::ostream &out) const override
Writes the row format of the constraint on an output stream.
Definition: rowcon.h:148
abacus::NumVar::number
int number() const
Returns the number of the variable.
Definition: numvar.h:91
abacus
Definition: ILPClusterPlanarity.h:50
abacus::Constraint::liftable
bool liftable() const
Checks if the constraint is liftable.
Definition: constraint.h:141
abacus::RowCon::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.
Definition: rowcon.h:73
abacus::RowCon::coeff
virtual double coeff(const Variable *v) const override
Computes the coefficient of a variable which must be of type NumVar.
Definition: rowcon.h:137
abacus::ConVar::dynamic
virtual bool dynamic() const
Return true if the constraint/variable is dynamic.
Definition: convar.h:125
abacus::RowCon
Implements constraints stored in the class Row.
Definition: rowcon.h:50
abacus::RowCon::row
Row * row()
Returns a pointer to the object of the class Row representing the constraint.
Definition: rowcon.h:153
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::Row
Representation of constraints in the row format.
Definition: row.h:52
row.h
row.
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:60
abacus::Constraint::sense
CSense * sense()
Returns a pointer to the sense of the constraint.
Definition: constraint.h:116
abacus::NumVar
Variables identified by a number.
Definition: numvar.h:43
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::RowCon::~RowCon
virtual ~RowCon()
The destructor.
Definition: rowcon.h:124
abacus::CSense::SENSE
SENSE
Definition: csense.h:52
abacus::Master
The master of the optimization.
Definition: master.h:70