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
40#pragma GCC visibility push(default)
41namespace abacus {
42
43class SparVec;
44
45
57class OGDF_EXPORT ColVar : public Variable {
58public:
59
61
78 ColVar(Master *master,
79 const Sub *sub,
80 bool dynamic,
81 bool local,
82 double lBound,
83 double uBound,
84 VarType::TYPE varType,
85 double obj,
86 int nnz,
87 Array<int> &support,
88 Array<double> &coeff)
89 :
90 Variable(master, sub, dynamic, local, obj, lBound, uBound, varType),
91 column_(master, obj, lBound, uBound, nnz, support, coeff)
92 { }
93
95
110 ColVar(Master *master,
111 const Sub *sub,
112 bool dynamic,
113 bool local,
114 double lBound,
115 double uBound,
116 VarType::TYPE varType,
117 double obj, SparVec &vector)
118 :
119 Variable(master, sub, dynamic, local, obj, lBound, uBound, varType),
120 column_(master, obj, lBound, uBound, vector)
121 { }
122
123
124 virtual ~ColVar() { }
125
127
135 friend std::ostream &operator<<(std::ostream &out, const ColVar &rhs);
136
137
139
144 virtual void print(std::ostream &out) const {
145 out << *this;
146 }
147
149
153 virtual double coeff(const Constraint *con) const {
154 return column_.origCoeff(((const NumCon*) con)->number());
155 }
156
158
163 double coeff(int i) const { return column_.origCoeff(i); }
164
165
167 Column *column() { return &column_; }
168
170 const Column *column() const { return &column_; }
171
172protected:
173
175};
176
177
178inline std::ostream &operator<<(std::ostream &out, const ColVar &rhs)
179{
180 return out << rhs.column_;
181}
182
183}
184#pragma GCC visibility pop
Some optimization problems, in particular column generation problems, are better described from a var...
Definition colvar.h:57
double coeff(int i) const
Computes the coefficient of a constraint with given index i.
Definition colvar.h:163
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:110
Column * column()
Returns a pointer to the column representing the variable.
Definition colvar.h:167
virtual ~ColVar()
Definition colvar.h:124
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition colvar.h:153
Column column_
Definition colvar.h:174
virtual void print(std::ostream &out) const
Writes the column representing the variable to output stream out.
Definition colvar.h:144
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:78
const Column * column() const
Returns a const pointer to the column representing the variable.
Definition colvar.h:170
Representation of variables in column format.
Definition column.h:48
Forms the virtual base class for all possible constraints given in pool format.
Definition constraint.h:57
The master of the optimization.
Definition master.h:70
Constraints defined by a number.
Definition numcon.h:47
Sparse vectors.
Definition sparvec.h:48
The subproblem.
Definition sub.h:69
TYPE
The enumeration with the different variable types.
Definition vartype.h:48
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
column.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
constraint defined by a number.
variable.
vartype.