Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00045 #ifndef OGDF_MAX_CPLANAR_SUB_H
00046 #define OGDF_MAX_CPLANAR_SUB_H
00047
00048 #include <ogdf/internal/cluster/MaxCPlanar_Master.h>
00049 #include <ogdf/basic/ArrayBuffer.h>
00050 #include <ogdf/planarity/BoyerMyrvold.h>
00051
00052 #include <abacus/sub.h>
00053
00054 namespace ogdf {
00055
00056 class Sub : public ABA_SUB {
00057
00058 public:
00059
00060 Sub(ABA_MASTER *master);
00061 Sub(ABA_MASTER *master, ABA_SUB *father, ABA_BRANCHRULE *branchRule, List<ABA_CONSTRAINT*>& criticalConstraints);
00062
00063 virtual ~Sub();
00064
00065
00066
00067 virtual ABA_SUB *generateSon(ABA_BRANCHRULE *rule);
00068
00069
00070 protected:
00071
00072
00073
00074
00075 virtual bool feasible();
00076
00077 virtual int makeFeasible() { return 0; }
00078
00079 int repair();
00080
00081 virtual int optimize() {
00082 Logger::slout() << "OPTIMIZE BEGIN\tNode=" << this->id() << "\n";
00083 int ret = ABA_SUB::optimize();
00084 Logger::slout() << "OPTIMIZE END\tNode=" << this->id() << " db=" << dualBound() << "\tReturn=" << (ret?"(error)":"(ok)") << "\n";
00085 return ret;
00086 }
00087
00088
00089
00092 bool checkCConnectivity(const GraphCopy& support);
00093 bool checkCConnectivityOld(const GraphCopy& support);
00094
00097 inline node getRepresentative(node v, NodeArray<node> &parent)
00098 {
00099 while (v != parent[v])
00100 v = parent[v];
00101 return v;
00102 }
00103
00104
00105
00106 int clusterBags(ClusterGraph &CG, cluster c);
00107
00108
00109
00110
00111
00112
00113
00114
00115
00121 int separateReal(double minViolate);
00122 int pricingReal(double minViolate);
00123
00124 inline int separateRealO(double minViolate) {
00125 Logger::slout() << "\tSeparate (minViolate=" << minViolate << ")..";
00126 int r = separateReal(minViolate);
00127 Logger::slout() << "..done: " << r << "\n";
00128 return r;
00129 }
00130 inline int pricingRealO(double minViolate) {
00131 Logger::slout() << "\tPricing (minViolate=" << minViolate << ")..";
00132 int r = pricingReal(minViolate);
00133 master()->m_varsPrice += r;
00134 Logger::slout() << "..done: " << r << "\n";
00135 return r;
00136 }
00137
00138 virtual int separate() {
00139 Logger::slout() << "\tReporting Separation: "<<((m_reportCreation>0)?m_reportCreation:0)<<"\n";
00140 return (m_reportCreation>0)?m_reportCreation:0;
00141 }
00142 virtual int pricing() {
00143 if(inOrigSolveLp) return 1;
00144 Logger::slout() << "\tReporting Prizing: "<<((m_reportCreation<0)?-m_reportCreation:0)<<"\n";
00145 return (m_reportCreation<0)?-m_reportCreation:0;
00146 }
00147
00148 virtual int solveLp();
00149
00150
00151
00152
00153
00154
00155
00156
00157 virtual int improve(double &primalValue);
00158
00159
00160 virtual int selectBranchingVariableCandidates(ABA_BUFFER<int> &candidates);
00161 virtual int selectBranchingVariable(int &variable);
00162
00164 inline int addPoolCons(ABA_BUFFER<ABA_CONSTRAINT *> &cons, ABA_STANDARDPOOL<ABA_CONSTRAINT, ABA_VARIABLE> *pool)
00165 {
00166 return (master()->useDefaultCutPool()) ? addCons(cons) : addCons(cons, pool);
00167 }
00168 inline int separateCutPool(ABA_STANDARDPOOL<ABA_CONSTRAINT, ABA_VARIABLE> *pool, double minViolation)
00169 {
00170 return (master()->useDefaultCutPool()) ? 0 : constraintPoolSeparation(0, pool, minViolation);
00171 }
00172
00173 private:
00174
00175 Master* master() { return (Master*)master_; }
00176
00177
00178
00179 bool m_constraintsFound;
00180 bool detectedInfeasibility;
00181 bool inOrigSolveLp;
00182 double realDualBound;
00183
00184
00185 int m_reportCreation;
00186 bool m_sepFirst;
00187 List< ABA_CONSTRAINT* > criticalSinceBranching;
00188 ArrayBuffer<ABA_CONSTRAINT* > bufferedForCreation;
00189 int createVariablesForBufferedConstraints();
00190
00191 void myAddVars(ABA_BUFFER<ABA_VARIABLE*>& b) {
00192 int num = b.number();
00193 ABA_BUFFER<bool> keep(master(),num);
00194 for(int i=num; i-->0;)
00195 keep.push(true);
00196 int r = addVars(b,0,&keep);
00197 OGDF_ASSERT( r==num )
00198 }
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 void kuratowskiSupportGraph(
00209 GraphCopy &support,
00210 double low,
00211 double high);
00212
00213
00214 void connectivitySupportGraph(
00215 GraphCopy &support,
00216 EdgeArray<double> &weight);
00217
00218
00219 void intSolutionInducedGraph(GraphCopy &support);
00220
00221
00222
00223 double subdivisionLefthandSide(
00224 SListConstIterator<KuratowskiWrapper> it,
00225 GraphCopy *gc);
00226
00227
00228 void updateSolution();
00229
00230
00231
00232
00233 int getArrayIndex(double lpValue);
00234
00235 void childClusterSpanningTree(
00236 GraphCopy &GC,
00237 List<edgeValue> &clusterEdges,
00238 List<nodePair> &MSTEdges);
00239
00240 void clusterSpanningTree(
00241 ClusterGraph &C,
00242 cluster c,
00243 ClusterArray<List<nodePair> > &treeEdges,
00244 ClusterArray<List<edgeValue> > &clusterEdges);
00245
00246
00247 double heuristicImprovePrimalBound(
00248 List<nodePair> &originalEdges,
00249 List<nodePair> &connectionEdges,
00250 List<edge> &deletedEdges);
00251
00253 inline int addCutCons(ABA_BUFFER<ABA_CONSTRAINT *> cons)
00254 {
00255 return addPoolCons(cons, ((Master*)master_)->getCutConnPool());
00256 }
00258 inline int addKuraCons(ABA_BUFFER<ABA_CONSTRAINT *> cons)
00259 {
00260 return addPoolCons(cons, ((Master*)master_)->getCutKuraPool());
00261 }
00262
00263
00264 inline int separateConnPool(double minViolation)
00265 {
00266 return separateCutPool(((Master*)master_)->getCutConnPool(),minViolation);
00267 }
00268
00269 inline int separateKuraPool(double minViolation)
00270 {
00271 return separateCutPool(((Master*)master_)->getCutKuraPool(),minViolation);
00272 }
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292 };
00293
00294 }
00295
00296 #endif