Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
rowcon.h
Go to the documentation of this file.
1
30#pragma once
31
32#include <ogdf/lib/abacus/row.h>
35
36#pragma GCC visibility push(default)
37namespace abacus {
38
39
41
50class RowCon : public Constraint {
51public:
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 :
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
158protected:
159
161};
162
163}
164#pragma GCC visibility pop
const Sub * sub() const
Returns a const pointer to the subproblem associated with the constraint/variable.
Definition convar.h:200
bool local() const
Returns true if the constraint/variable is only locally valid, false otherwise.
Definition convar.h:114
virtual bool dynamic() const
Return true if the constraint/variable is dynamic.
Definition convar.h:125
Forms the virtual base class for all possible constraints given in pool format.
Definition constraint.h:57
bool liftable() const
Checks if the constraint is liftable.
Definition constraint.h:141
CSense * sense()
Returns a pointer to the sense of the constraint.
Definition constraint.h:116
virtual double rhs() const
Returns the right hand side of the constraint.
Definition constraint.h:131
The master of the optimization.
Definition master.h:70
Variables identified by a number.
Definition numvar.h:43
int number() const
Returns the number of the variable.
Definition numvar.h:91
Implements constraints stored in the class Row.
Definition rowcon.h:50
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
const Row * row() const
Returns a const pointer to the object of the class Row representing the constraint.
Definition rowcon.h:156
Row * row()
Returns a pointer to the object of the class Row representing the constraint.
Definition rowcon.h:153
virtual void print(std::ostream &out) const override
Writes the row format of the constraint on an output stream.
Definition rowcon.h:148
Row row_
The representation of the constraint.
Definition rowcon.h:160
virtual ~RowCon()
The destructor.
Definition rowcon.h:124
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
virtual double coeff(const Variable *v) const override
Computes the coefficient of a variable which must be of type NumVar.
Definition rowcon.h:137
Representation of constraints in the row format.
Definition row.h:52
double origCoeff(int i) const
The subproblem.
Definition sub.h:69
Forms the virtual base class for all possible variables given in pool format.
Definition variable.h:60
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
constraint.
variable identified by a number.
row.