Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
colvar.h
Go to the documentation of this file.
1
30// must be included first here
32
33#pragma once
34
39
40namespace abacus {
41
42class SparVec;
43
44
56class OGDF_EXPORT ColVar : public Variable {
57public:
58
60
77 ColVar(Master *master,
78 const Sub *sub,
79 bool dynamic,
80 bool local,
81 double lBound,
82 double uBound,
83 VarType::TYPE varType,
84 double obj,
85 int nnz,
86 Array<int> &support,
87 Array<double> &coeff)
88 :
89 Variable(master, sub, dynamic, local, obj, lBound, uBound, varType),
90 column_(master, obj, lBound, uBound, nnz, support, coeff)
91 { }
92
94
109 ColVar(Master *master,
110 const Sub *sub,
111 bool dynamic,
112 bool local,
113 double lBound,
114 double uBound,
115 VarType::TYPE varType,
116 double obj, SparVec &vector)
117 :
118 Variable(master, sub, dynamic, local, obj, lBound, uBound, varType),
119 column_(master, obj, lBound, uBound, vector)
120 { }
121
122
123 virtual ~ColVar() { }
124
126
134 friend std::ostream &operator<<(std::ostream &out, const ColVar &rhs);
135
136
138
143 virtual void print(std::ostream &out) const {
144 out << *this;
145 }
146
148
152 virtual double coeff(const Constraint *con) const {
153 return column_.origCoeff(((const NumCon*) con)->number());
154 }
155
157
162 double coeff(int i) const { return column_.origCoeff(i); }
163
164
166 Column *column() { return &column_; }
167
169 const Column *column() const { return &column_; }
170
171protected:
172
174};
175
176
177inline std::ostream &operator<<(std::ostream &out, const ColVar &rhs)
178{
179 return out << rhs.column_;
180}
181
182}
Some optimization problems, in particular column generation problems, are better described from a var...
Definition colvar.h:56
double coeff(int i) const
Computes the coefficient of a constraint with given index i.
Definition colvar.h:162
ColVar(Master *master, const Sub *sub, bool dynamic, bool local, double lBound, double uBound, VarType::TYPE varType, double obj, SparVec &vector)
Constructor using a sparse vector vector.
Definition colvar.h:109
Column * column()
Returns a pointer to the column representing the variable.
Definition colvar.h:166
virtual ~ColVar()
Definition colvar.h:123
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition colvar.h:152
Column column_
Definition colvar.h:173
virtual void print(std::ostream &out) const
Writes the column representing the variable to output stream out.
Definition colvar.h:143
ColVar(Master *master, const Sub *sub, bool dynamic, bool local, double lBound, double uBound, VarType::TYPE varType, double obj, int nnz, Array< int > &support, Array< double > &coeff)
The constructor.
Definition colvar.h:77
const Column * column() const
Returns a const pointer to the column representing the variable.
Definition colvar.h:169
Representation of variables in column format.
Definition column.h:47
Forms the virtual base class for all possible constraints given in pool format.
Definition constraint.h:56
The master of the optimization.
Definition master.h:69
Constraints defined by a number.
Definition numcon.h:46
Sparse vectors.
Definition sparvec.h:47
The subproblem.
Definition sub.h:68
TYPE
The enumeration with the different variable types.
Definition vartype.h:47
Forms the virtual base class for all possible variables given in pool format.
Definition variable.h:59
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
column.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
constraint defined by a number.
variable.
vartype.