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 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  :
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 }
abacus::ConVar::local
bool local() const
Returns true if the constraint/variable is only locally valid, false otherwise.
Definition: convar.h:113
abacus::RowCon::row_
Row row_
The representation of the constraint.
Definition: rowcon.h:159
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:155
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:107
abacus::ConVar::sub
const Sub * sub() const
Returns a const pointer to the subproblem associated with the constraint/variable.
Definition: convar.h:199
constraint.h
constraint.
abacus::Constraint::rhs
virtual double rhs() const
Returns the right hand side of the constraint.
Definition: constraint.h:130
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:147
abacus::NumVar::number
int number() const
Returns the number of the variable.
Definition: numvar.h:90
abacus
Definition: ILPClusterPlanarity.h:50
abacus::Constraint::liftable
bool liftable() const
Checks if the constraint is liftable.
Definition: constraint.h:140
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:72
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:136
abacus::ConVar::dynamic
virtual bool dynamic() const
Return true if the constraint/variable is dynamic.
Definition: convar.h:124
abacus::RowCon
Implements constraints stored in the class Row.
Definition: rowcon.h:49
abacus::RowCon::row
Row * row()
Returns a pointer to the object of the class Row representing the constraint.
Definition: rowcon.h:152
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:51
row.h
row.
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
abacus::Constraint::sense
CSense * sense()
Returns a pointer to the sense of the constraint.
Definition: constraint.h:115
abacus::NumVar
Variables identified by a number.
Definition: numvar.h:42
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::RowCon::~RowCon
virtual ~RowCon()
The destructor.
Definition: rowcon.h:123
abacus::CSense::SENSE
SENSE
Definition: csense.h:51
abacus::Master
The master of the optimization.
Definition: master.h:69