49 #define initial_value 10000000 50 #pragma GCC diagnostic push 51 #pragma GCC diagnostic error "-Weffc++" 54 : network_flow_graph(0),
70 debug_level(_debug_level)
76 network_flow_graph_type::vertex_iterator vi, vi_end;
77 network_flow_graph_type::edge_iterator ei, ei_end;
129 ++inserted_edges_iterator)
131 network_flow_graph_type::edge_descriptor
original, reverse;
133 vertices = *inserted_edges_iterator;
135 reverse = (boost::add_edge(vertices.first, vertices.second,
network_flow_graph)).first;
149 std::vector<network_flow_graph_type::edge_descriptor>
P;
150 std::vector<network_flow_graph_type::edge_descriptor>::iterator P_iterator;
153 network_flow_graph_type::vertex_descriptor
k, I;
156 for(EDi = E.begin(); EDi != E.end(); ++EDi)
165 for(EDi = D.begin(); EDi != D.end(); ++EDi)
186 "network_flow: shortest path distances computed and shortest path identificated");
213 for(P_iterator = P.begin(); P_iterator != P.end(); ++P_iterator)
234 for(P_iterator = P.begin(); P_iterator != P.end(); ++P_iterator)
236 network_flow_graph_type::vertex_descriptor source,
target;
237 network_flow_graph_type::out_edge_iterator oei, oei_end;
244 network_flow_graph_type::edge_descriptor ed;
271 "network_flow: updated path P, updated flows, residual capacity and imbalance");
293 std::string file_name;
294 file_name =
"network_flow_graph_" +
I2S(i) +
".dot";
320 network_flow_graph_type::vertex_descriptor
target,
321 std::vector<network_flow_graph_type::edge_descriptor>*
P)
325 std::map<network_flow_graph_type::vertex_descriptor, network_flow_graph_type::vertex_descriptor> predecessors;
326 network_flow_graph_type::vertex_iterator vi, vi_end;
330 predecessors[*vi] = n;
333 predecessors[source] = source;
337 network_flow_graph_type::edge_iterator ei, ei_end;
338 bool condition_satisfied =
true;
339 while(condition_satisfied)
341 condition_satisfied =
false;
344 network_flow_graph_type::vertex_descriptor source_, target_;
353 predecessors[target_] = source_;
354 network_flow_graph_type::vertex_descriptor pred;
356 while(pred != source)
363 pred = predecessors[pred];
365 condition_satisfied =
true;
373 network_flow_graph_type::vertex_descriptor current_vertex, dest;
377 while(current_vertex != source)
380 dest = current_vertex;
381 current_vertex = predecessors[current_vertex];
382 if(current_vertex == n)
387 network_flow_graph_type::edge_descriptor ed;
396 network_flow_graph_type::out_edge_iterator oei, oei_end;
397 network_flow_graph_type::in_edge_iterator iei, iei_end;
399 double outflow, inflow;
405 for(boost::tie(oei, oei_end) = boost::out_edges(vd,
network_flow_graph); oei != oei_end; oei++)
411 for(boost::tie(iei, iei_end) = boost::in_edges(vd,
network_flow_graph); iei != iei_end; iei++)
432 network_flow_graph_type::vertex_iterator vi, vi_end;
443 network_flow_graph_type::edge_iterator ei, ei_end;
457 network_flow_graph_type::vertex_iterator vi, vi_end;
458 network_flow_graph_type::edge_iterator ei, ei_end;
470 std::ofstream dot_file(file_name);
483 std::string description;
494 std::string description;
503 #pragma GCC diagnostic pop
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
pmap_nf_index_t p_nf_index
File containing functions and utilities to support the printing of debug messagges.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
This algorithm is to find coloring of a graph Algorithm: Let G = (V,E) be a graph with vertices v_1...
pmap_nf_imbalance_t p_nf_imbalance
pmap_nf_edge_description_t p_nf_edge_description
Edge maps variables.
std::string get_vertex_description(network_flow_graph_type::vertex_descriptor vd)
Generates the description string of the vertex vd.
std::string get_edge_description(network_flow_graph_type::edge_descriptor ed)
Generates the description string of the edge ed.
bool successive_shortest_path_algorithm()
Computes the solution for the min cost flow problem with successive shortest path algorithm...
network_flow_graph_type network_flow_graph
Network flow graph pointer.
network_flow(int _debug_level)
Constructor of the class.
pmap_nf_potential_t p_nf_potential
pmap_nf_pseudo_flow_t p_nf_pseudo_flow
void update_vertex_imbalance(network_flow_graph_type::vertex_descriptor vd)
Updates the vertex imbalance.
std::set< Key, Compare, Alloc > OrderedSetStd
static const uint32_t k[]
void generic_label_correcting_algorithm(network_flow_graph_type::vertex_descriptor source, network_flow_graph_type::vertex_descriptor target, std::vector< network_flow_graph_type::edge_descriptor > *P)
Implements the generic label correcting algorithm for vertex distances labelling. ...
pmap_nf_residual_capacity_t p_nf_residual_capacity
pmap_nf_vertex_description_t p_nf_vertex_description
Vertex maps variables.
int original[DIMENSION_Y][DIMENSION_X]
this class is used to manage the command-line or XML options.
pmap_nf_reduced_cost_t p_nf_reduced_cost
bool print_graph(const char *file_name="network_flow.dot")
Prints a textual description of the graph in a .dot file format.
pmap_nf_balance_t p_nf_balance
This class contains a network flow graph representation and min cost flow algorithm.
void clear_results()
Clears results of a previous computation.
pmap_nf_capacity_t p_nf_capacity
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
pmap_nf_distance_t p_nf_distance
std::pair< network_flow_graph_type::vertex_descriptor, network_flow_graph_type::vertex_descriptor > vertex_pair
#define DEBUG_LEVEL_MINIMUM
minimum debugging print is performed.
CustomOrderedSet< vertex_pair > inserted_edges