Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

colvar.h
Go to the documentation of this file.
1 
30 // must be included first here
31 #include <ogdf/lib/abacus/numcon.h>
32 
33 #pragma once
34 
37 #include <ogdf/lib/abacus/column.h>
38 #include <ogdf/lib/abacus/bheap.h>
39 
40 #pragma GCC visibility push(default)
41 namespace abacus {
42 
43 class SparVec;
44 
45 
57 class OGDF_EXPORT ColVar : public Variable {
58 public:
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 
172 protected:
173 
175 };
176 
177 
178 inline std::ostream &operator<<(std::ostream &out, const ColVar &rhs)
179 {
180  return out << rhs.column_;
181 }
182 
183 }
184 #pragma GCC visibility pop
abacus::ColVar::ColVar
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
abacus::ColVar::column
const Column * column() const
Returns a const pointer to the column representing the variable.
Definition: colvar.h:170
abacus::operator<<
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
column.h
column.
abacus::ColVar::column
Column * column()
Returns a pointer to the column representing the variable.
Definition: colvar.h:167
abacus::ColVar::coeff
double coeff(int i) const
Computes the coefficient of a constraint with given index i.
Definition: colvar.h:163
abacus::NumCon
Constraints defined by a number.
Definition: numcon.h:47
abacus
Definition: ILPClusterPlanarity.h:50
abacus::ColVar::ColVar
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
abacus::ColVar
Some optimization problems, in particular column generation problems, are better described from a var...
Definition: colvar.h:57
abacus::ColVar::coeff
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition: colvar.h:153
bheap.h
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::SparVec
Sparse vectors.
Definition: sparvec.h:48
abacus::ColVar::print
virtual void print(std::ostream &out) const
Writes the column representing the variable to output stream out.
Definition: colvar.h:144
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:60
variable.h
variable.
abacus::Column
Representation of variables in column format.
Definition: column.h:48
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition: config.h:117
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
ogdf::AlgorithmFailureCode::SparVec
@ SparVec
numcon.h
constraint defined by a number.
abacus::ColVar::~ColVar
virtual ~ColVar()
Definition: colvar.h:124
vartype.h
vartype.
abacus::VarType::TYPE
TYPE
The enumeration with the different variable types.
Definition: vartype.h:48
abacus::ColVar::column_
Column column_
Definition: colvar.h:174
abacus::Master
The master of the optimization.
Definition: master.h:70