Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ILPClusterPlanarity.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <ogdf/basic/Graph.h>
36#include <ogdf/basic/List.h>
38#include <ogdf/basic/basic.h>
43
45
46#include <cstdint>
47#include <iosfwd>
48#include <string>
49
50namespace abacus {
51template<class BaseType, class CoType>
52class StandardPool;
53} // namespace abacus
54
55namespace ogdf {
56
58
62public:
65
69 enum class solmeth { Fallback, New };
70
73 : m_heuristicLevel(1)
74 , m_heuristicRuns(1)
75 , m_heuristicOEdgeBound(0.4)
76 , m_heuristicNPermLists(5)
77 , m_kuratowskiIterations(10)
78 , m_subdivisions(10)
79 , m_kSupportGraphs(10)
80 , m_kuratowskiHigh(0.8)
81 , m_kuratowskiLow(0.8)
82 , m_perturbation(false)
83 , m_branchingGap(0.4)
84 , m_time("00:20:00")
85 , m_pricing(false)
86 , m_numAddVariables(15)
87 , m_strongConstraintViolation(0.3)
88 , m_strongVariableViolation(0.3)
89 , m_solmeth(solmeth::New)
90 , m_optStatus(abacus::Master::STATUS::Unprocessed)
91 , m_totalTime(-1.0)
92 , m_heurTime(-1.0)
93 , m_lpTime(-1.0)
94 , m_lpSolverTime(-1.0)
95 , m_sepTime(-1.0)
96 , m_totalWTime(-1.0)
97 , m_numCCons(-1)
98 , m_numKCons(-1)
99 , m_numLPs(-1)
100 , m_numBCs(-1)
101 , m_numSubSelected(-1)
102 , m_numVars(-1)
103 , m_portaOutput(false)
104 , m_defaultCutPool(true)
105#ifdef OGDF_DEBUG
106 , m_solByHeuristic(false)
107#endif
108 {
109 }
110
111 //destruction
113
116 bool isClusterPlanar(const ClusterGraph& CG, NodePairs& addedEdges);
117
119 bool isClusterPlanar(const ClusterGraph& CG) override;
120
122 return isClusterPlanar(CG);
123 }
124
126
127 //setter methods for the module parameters
128 void setHeuristicLevel(int i) { m_heuristicLevel = i; }
129
130 void setHeuristicRuns(int i) { m_heuristicRuns = i; }
131
132 void setHeuristicBound(double d) { m_heuristicOEdgeBound = d; }
133
134 void setNumberOfPermutations(int i) { m_heuristicNPermLists = i; }
135
136 void setNumberOfKuraIterations(int i) { m_kuratowskiIterations = i; }
137
138 void setNumberOfSubDivisions(int i) { m_subdivisions = i; }
139
140 void setNumberOfSupportGraphs(int i) { m_kSupportGraphs = i; }
141
142 void setUpperRounding(double d) { m_kuratowskiHigh = d; }
143
144 void setLowerRounding(double d) { m_kuratowskiLow = d; }
145
146 void setPerturbation(bool b) { m_perturbation = b; }
147
148 void setBranchingGap(double d) { m_branchingGap = d; }
149
150 void setTimeLimit(string s) { m_time = s.c_str(); }
151
152 void setPortaOutput(bool b) { m_portaOutput = b; }
153
154 void setPricing(bool b) { m_pricing = b; }
155
156 void setNumAddVariables(int n) { m_numAddVariables = n; }
157
158 void setStrongConstraintViolation(double d) { m_strongConstraintViolation = d; }
159
160 void setStrongVariableViolation(double d) { m_strongVariableViolation = d; }
161
164 bool& useDefaultCutPool() { return m_defaultCutPool; }
165
166 //getter methods for results
167 abacus::Master::STATUS getOptStatus() { return m_optStatus; }
168
169 double getTotalTime() { return m_totalTime; }
170
171 double getHeurTime() { return m_heurTime; }
172
173 double getLPTime() { return m_lpTime; }
174
175 double getLPSolverTime() { return m_lpSolverTime; }
176
177 double getSeparationTime() { return m_sepTime; }
178
179 double getTotalWTime() { return m_totalWTime; }
180
182 int getNumCCons() { return m_numCCons; }
183
185 int getNumKCons() { return m_numKCons; }
186
188 int getNumLPs() { return m_numLPs; }
189
191 int getNumBCs() { return m_numBCs; }
192
194 int getNumSubSelected() { return m_numSubSelected; }
195
197 int getNumVars() { return m_numVars; }
198
200 void writeFeasible(const char* filename, CP_MasterBase& master, abacus::Master::STATUS& status);
201#ifdef OGDF_DEBUG
202 bool getSolByHeuristic() { return m_solByHeuristic; }
203#endif
204
205 solmeth& solutionMethod() { return m_solmeth; }
206
207protected:
208 // Performs a c-planarity test on CG.
209 bool doTest(const ClusterGraph& CG);
210
211 //as above, on success also returns the set of edges that were
212 //added to construct a completely connected planar graph.
213 bool doTest(const ClusterGraph& G, NodePairs& addedEdges);
214
215 // Performs a c-planarity test using only a reduced set
216 // of allowed extension edges, returns c-planarity status
217#if 0
218 virtual bool doFastTest(const ClusterGraph &G);
219#endif
220
221 double getDoubleTime(const Stopwatch& act) {
222 int64_t tempo = act.centiSeconds() + 100 * act.seconds() + 6000 * act.minutes()
223 + 360000 * act.hours();
224 return ((double)tempo) / 100.0;
225 }
226
229
230private:
231 //Abacus Master class settings in order of appearance
232 int m_heuristicLevel, m_heuristicRuns;
234 int m_heuristicNPermLists, m_kuratowskiIterations;
235 int m_subdivisions, m_kSupportGraphs;
236 double m_kuratowskiHigh, m_kuratowskiLow;
239 string m_time;
240 bool m_pricing; //<! Decides if pricing is used
244
246
247 const char* getPortaFileName() { return "porta.poi"; }
248
249 const char* getIeqFileName() { return "porta.ieq"; }
250
251 int maxConLength() { return 1024; }
252
253 void outputCons(std::ofstream& os,
256
257 //results
258 abacus::Master::STATUS m_optStatus; //<! Status of optimization, returned from abacus
259 double m_totalTime; //<! Total computation time, returned from abacus
260 double m_heurTime; //<! Time spent in heuristic, returned from abacus
261 double m_lpTime; //<! Cpu time spent in members of the LP-interface, returned from abacus
262 double m_lpSolverTime; //<! Cpu time required by the LP solver, returned from abacus
263 double m_sepTime; //<! Cpu time spent in the separation of cutting planes, returned from abacus
264 double m_totalWTime; //<! Total wall clock time, returned from abacus
265 int m_numCCons; //<! Number of added connectivity constraints
266 int m_numKCons; //<! Number of added kuratowski constraints
267 int m_numLPs; //<! The number of optimized linear programs (LP-relax.).
268 int m_numBCs; //<! The number of generated subproblems.
269 int m_numSubSelected; //<! The number of subproblems selected by ABACUS.
270 int m_numVars; //<! The number of global variables.
271 bool m_portaOutput; //<! If set to true, output for PORTA in ieq format is generated.
272 bool m_defaultCutPool; //<! Passed through to master
273#ifdef OGDF_DEBUG
275#endif
276};
277
278}
Declaration of base class for master of Branch&Cut based algorithms for c-planarity testing via an ex...
Declaration of the CPlanarityMaster class for the Branch&Cut algorithm for c-planarity testing via an...
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declaration of ClusterPlanarityModule which implements a cluster-planarity test and,...
Includes declaration of graph class.
Declaration of doubly linked lists and iterators.
Declaration of stopwatch classes.
Includes Abacus.
Basic declarations, included by all source files.
STATUS
The various statuses of the optimization process.
Definition master.h:78
Standard pools.
Representation of clusters in a clustered graph.
Representation of clustered graphs.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
C-planarity testing via completely connected graph extension.
void writeFeasible(const char *filename, CP_MasterBase &master, abacus::Master::STATUS &status)
Writes feasible solutions as a file in PORTA format.
int getNumCCons()
Returns number of connectivity constraints added during computation.
bool & useDefaultCutPool()
Use default abacus master cut pool or dedicated connectivity and kuratowski cut pools.
solmeth
Solution method, fallback to old version (allowing all extension edges, based on c-planar subgraph co...
int getNumLPs()
Returns number of optimized LPs (only LP-relaxations)
void outputCons(std::ofstream &os, abacus::StandardPool< abacus::Constraint, abacus::Variable > *connCon, abacus::StandardPool< abacus::Variable, abacus::Constraint > *stdVar)
bool isClusterPlanar(const ClusterGraph &CG) override
Returns c-planarity status of CG.
int getNumKCons()
Returns number of Kuratowski constraints added during computation.
int getNumBCs()
Returns number of generated LPs.
int getNumSubSelected()
Returns number of subproblems selected by ABACUS.
bool isClusterPlanar(const ClusterGraph &CG, NodePairs &addedEdges)
Computes a set of edges that augments the subgraph to be completely connected and returns c-planarity...
bool isClusterPlanarDestructive(ClusterGraph &CG, Graph &G) override
Returns true, if CG is cluster-planar, false otherwise. In it is non-cluster-planar,...
void setStrongVariableViolation(double d)
bool clusterPlanarEmbedClusterPlanarGraph(ClusterGraph &CG, Graph &G) override
Constructs a cluster-planar embedding of CG. CG has to be cluster-planar!
abacus::Master::STATUS m_optStatus
abacus::Master::STATUS getOptStatus()
solmeth m_solmeth
Solution method, see description of solmeth.
int getNumVars()
Returns number of global variables. Todo: Real number from ABACUS.
bool doTest(const ClusterGraph &CG)
void getBottomUpClusterList(const cluster c, List< cluster > &theList)
Stores clusters in subtree at c in bottom up order in theList.
double getDoubleTime(const Stopwatch &act)
bool doTest(const ClusterGraph &G, NodePairs &addedEdges)
void setStrongConstraintViolation(double d)
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Realizes a stopwatch for measuring elapsed time.
Definition Stopwatch.h:45
int64_t hours() const
Returns the currently elapsed time in hours.
Definition Stopwatch.h:126
int64_t centiSeconds() const
Returns the currently elapsed time in 1/100-seconds.
Definition Stopwatch.h:105
int64_t seconds() const
Returns the currently elapsed time in seconds.
Definition Stopwatch.h:112
int64_t minutes() const
Returns the currently elapsed time in minutes.
Definition Stopwatch.h:119
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.