Changeset 372:e6a156fc186d in lemon0.x for src/work/jacint/preflow.cc
 Timestamp:
 04/22/04 16:11:28 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@502
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/jacint/preflow.cc
r220 r372 1 1 #include <iostream> 2 #include <fstream>3 2 4 3 #include <smart_graph.h> 5 4 #include <list_graph.h> 6 5 #include <dimacs.h> 7 #include <preflow .h>6 #include <preflowproba.h> 8 7 #include <time_measure.h> 9 8 10 9 using namespace hugo; 11 10 12 // Use a DIMACS max flow file as stdin.13 // read_dimacs_demo < dimacs_max_flow_file14 11 int main(int, char **) { 15 typedef SmartGraph::Node Node; 16 typedef SmartGraph::EdgeIt EdgeIt; 12 13 typedef SmartGraph Graph; 14 15 typedef Graph::Node Node; 16 typedef Graph::EdgeIt EdgeIt; 17 17 18 SmartGraph G;18 Graph G; 19 19 Node s, t; 20 SmartGraph::EdgeMap<int> cap(G);20 Graph::EdgeMap<int> cap(G); 21 21 readDimacsMaxFlow(std::cin, G, s, t, cap); 22 22 Timer ts; 23 23 24 std::cout << "preflow demo ..." << std::endl; 24 25 25 double mintime=1000000; 26 27 for ( int i=1; i!=11; ++i ) { 28 SmartGraph::EdgeMap<int> flow(G); 29 double pre_time=currTime(); 30 Preflow<SmartGraph, int> max_flow_test(G, s, t, cap, flow); 31 max_flow_test.run(); 32 double post_time=currTime(); 33 if ( mintime > post_timepre_time ) mintime = post_timepre_time; 34 } 35 36 SmartGraph::EdgeMap<int> flow(G); 37 Preflow<SmartGraph, int> max_flow_test(G, s, t, cap, flow); 26 Graph::EdgeMap<int> flow(G); 27 Preflow<Graph, int> max_flow_test(G, s, t, cap, flow, 1); 28 ts.reset(); 38 29 max_flow_test.run(); 30 std::cout << "elapsed time: " << ts << std::endl; 39 31 40 SmartGraph::NodeMap<bool> cut(G);32 Graph::NodeMap<bool> cut(G); 41 33 max_flow_test.minCut(cut); 42 34 int min_cut_value=0; … … 46 38 } 47 39 48 SmartGraph::NodeMap<bool> cut1(G);40 Graph::NodeMap<bool> cut1(G); 49 41 max_flow_test.minMinCut(cut1); 50 42 int min_min_cut_value=0; … … 54 46 } 55 47 56 SmartGraph::NodeMap<bool> cut2(G);48 Graph::NodeMap<bool> cut2(G); 57 49 max_flow_test.maxMinCut(cut2); 58 50 int max_min_cut_value=0; … … 62 54 } 63 55 64 std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl;65 56 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 66 57 std::cout << "min cut value: "<< min_cut_value << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.