1.1 --- a/src/work/jacint/preflow_hl4.cc Mon Mar 01 17:24:34 2004 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,76 +0,0 @@
1.4 -#include <iostream>
1.5 -#include <fstream>
1.6 -
1.7 -#include <list_graph.hh>
1.8 -#include <dimacs.hh>
1.9 -#include <preflow_hl4.h>
1.10 -#include <time_measure.h>
1.11 -
1.12 -using namespace hugo;
1.13 -
1.14 -//Note, that preflow_hl4.h has a member NodeMap<bool> cut,
1.15 -//the construction of which slowing the running time by 1-10%.
1.16 -
1.17 -// Use a DIMACS max flow file as stdin.
1.18 -// read_dimacs_demo < dimacs_max_flow_file
1.19 -int main(int, char **) {
1.20 - typedef ListGraph::NodeIt NodeIt;
1.21 - typedef ListGraph::EachEdgeIt EachEdgeIt;
1.22 -
1.23 - ListGraph G;
1.24 - NodeIt s, t;
1.25 - ListGraph::EdgeMap<int> cap(G);
1.26 - readDimacsMaxFlow(std::cin, G, s, t, cap);
1.27 -
1.28 - std::cout << "preflow_hl4 demo ..." << std::endl;
1.29 -
1.30 - double mintime=1000000;
1.31 -
1.32 - for ( int i=1; i!=11; ++i ) {
1.33 - double pre_time=currTime();
1.34 - preflow_hl4<ListGraph, int> max_flow_test(G, s, t, cap);
1.35 - double post_time=currTime();
1.36 - if ( mintime > post_time-pre_time ) mintime = post_time-pre_time;
1.37 - }
1.38 -
1.39 - double pre_time=currTime();
1.40 - preflow_hl4<ListGraph, int> max_flow_test(G, s, t, cap);
1.41 - double post_time=currTime();
1.42 -
1.43 - ListGraph::NodeMap<bool> cut(G);
1.44 - max_flow_test.minCut(cut);
1.45 - int min_cut_value=0;
1.46 - for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.47 - if (cut.get(G.tail(e)) && !cut.get(G.head(e))) min_cut_value+=cap.get(e);
1.48 - }
1.49 -
1.50 - ListGraph::NodeMap<bool> cut1(G);
1.51 - max_flow_test.minMinCut(cut1);
1.52 - int min_min_cut_value=0;
1.53 - for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.54 - if (cut.get(G.tail(e)) && !cut.get(G.head(e)))
1.55 - min_min_cut_value+=cap.get(e);
1.56 - }
1.57 -
1.58 - ListGraph::NodeMap<bool> cut2(G);
1.59 - max_flow_test.maxMinCut(cut2);
1.60 - int max_min_cut_value=0;
1.61 - for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.62 - if (cut2.get(G.tail(e)) && !cut2.get(G.head(e)))
1.63 - max_min_cut_value+=cap.get(e);
1.64 - }
1.65 -
1.66 - std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl;
1.67 - std::cout << "phase 0: " << max_flow_test.time-pre_time
1.68 - << " sec"<< std::endl;
1.69 - std::cout << "phase 1: " << post_time-max_flow_test.time
1.70 - << " sec"<< std::endl;
1.71 - std::cout << "flow value: "<< max_flow_test.maxFlow() << std::endl;
1.72 - std::cout << "min cut value: "<< min_cut_value << std::endl;
1.73 - std::cout << "min min cut value: "<< min_min_cut_value << std::endl;
1.74 - std::cout << "max min cut value: "<< max_min_cut_value <<
1.75 - std::endl<< std::endl;
1.76 -
1.77 -
1.78 - return 0;
1.79 -}