Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047
00048 #ifndef OGDF_MIN_COST_FLOW_REINELT_H
00049 #define OGDF_MIN_COST_FLOW_REINELT_H
00050
00051
00052 #include <ogdf/module/MinCostFlowModule.h>
00053 #include <limits.h>
00054
00055
00056 namespace ogdf {
00057
00058
00059 class OGDF_EXPORT MinCostFlowReinelt : public MinCostFlowModule
00060 {
00061 public:
00062 MinCostFlowReinelt() { }
00063
00064
00065
00066
00067
00068 bool call(
00069 const Graph &G,
00070 const EdgeArray<int> &lowerBound,
00071 const EdgeArray<int> &upperBound,
00072 const EdgeArray<int> &cost,
00073 const NodeArray<int> &supply,
00074 EdgeArray<int> &flow);
00075
00076 bool call(
00077 const Graph &G,
00078 const EdgeArray<int> &lowerBound,
00079 const EdgeArray<int> &upperBound,
00080 const EdgeArray<int> &cost,
00081 const NodeArray<int> &supply,
00082 EdgeArray<int> &flow,
00083 NodeArray<int> &dual);
00084
00085 int infinity() const { return INT_MAX; }
00086
00087 private:
00088
00089 struct arctype;
00090
00091 struct nodetype {
00092 nodetype *father;
00093 nodetype *successor;
00094 arctype *arc_id;
00095 bool orientation;
00096 int dual;
00097 int flow;
00098 int name;
00099 nodetype *last;
00100 int nr_of_nodes;
00101 };
00102
00103 struct arctype {
00104 arctype *next_arc;
00105 nodetype *tail;
00106 nodetype *head;
00107 int cost;
00108 int upper_bound;
00109 int arcnum;
00110
00111 OGDF_NEW_DELETE
00112 };
00113
00114
00115 int mcf(
00116 int mcfNrNodes,
00117 int mcfNrArcs,
00118 Array<int> &mcfSupply,
00119 Array<int> &mcfTail,
00120 Array<int> &mcfHead,
00121 Array<int> &mcfLb,
00122 Array<int> &mcfUb,
00123 Array<int> &mcfCost,
00124 Array<int> &mcfFlow,
00125 Array<int> &mcfDual,
00126 int *mcfObj
00127 );
00128
00129 void start(Array<int> &supply);
00130
00131 void beacircle(arctype **eplus, arctype **pre, bool *from_ub);
00132 void beadouble(arctype **eplus, arctype **pre, bool *from_ub);
00133
00134
00135 Array<nodetype> nodes;
00136 Array<arctype> arcs;
00137
00138
00139 nodetype *root;
00140 nodetype rootStruct;
00141
00142 arctype *last_n1;
00143 arctype *last_n2;
00144 arctype *start_arc;
00145 arctype *start_b;
00146 arctype *start_n1;
00147 arctype *start_n2;
00148 arctype *startsearch;
00149 arctype *searchend;
00150 arctype *searchend_n1;
00151 arctype *searchend_n2;
00152
00153
00154 int m_maxCost;
00155
00156 int nn;
00157 int mm;
00158
00159 };
00160
00161
00162 }
00163
00164
00165 #endif