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