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 namespace abacus {
41 
42 class SparVec;
43 
44 
56 class OGDF_EXPORT ColVar : public Variable {
57 public:
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 
171 protected:
172 
174 };
175 
176 
177 inline std::ostream &operator<<(std::ostream &out, const ColVar &rhs)
178 {
179  return out << rhs.column_;
180 }
181 
182 }
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:109
abacus::ColVar::column
const Column * column() const
Returns a const pointer to the column representing the variable.
Definition: colvar.h:169
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:166
abacus::ColVar::coeff
double coeff(int i) const
Computes the coefficient of a constraint with given index i.
Definition: colvar.h:162
abacus::NumCon
Constraints defined by a number.
Definition: numcon.h:46
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:77
abacus::ColVar
Some optimization problems, in particular column generation problems, are better described from a var...
Definition: colvar.h:56
abacus::ColVar::coeff
virtual double coeff(const Constraint *con) const
Returns the coefficient of the constraint con.
Definition: colvar.h:152
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:47
abacus::ColVar::print
virtual void print(std::ostream &out) const
Writes the column representing the variable to output stream out.
Definition: colvar.h:143
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
variable.h
variable.
abacus::Column
Representation of variables in column format.
Definition: column.h:47
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
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
ogdf::AlgorithmFailureCode::SparVec
@ SparVec
numcon.h
constraint defined by a number.
abacus::ColVar::~ColVar
virtual ~ColVar()
Definition: colvar.h:123
vartype.h
vartype.
abacus::VarType::TYPE
TYPE
The enumeration with the different variable types.
Definition: vartype.h:47
abacus::ColVar::column_
Column column_
Definition: colvar.h:173
abacus::Master
The master of the optimization.
Definition: master.h:69