mostmar pontosabb erteket ad
authormarci
Tue, 17 Feb 2004 11:24:21 +0000
changeset 8746705346edd4
parent 86 cbd76005b9a7
child 88 93bb934b0794
mostmar pontosabb erteket ad
src/work/marci/preflow_demo_jacint.cc
     1.1 --- a/src/work/marci/preflow_demo_jacint.cc	Tue Feb 17 11:23:00 2004 +0000
     1.2 +++ b/src/work/marci/preflow_demo_jacint.cc	Tue Feb 17 11:24:21 2004 +0000
     1.3 @@ -4,6 +4,7 @@
     1.4  #include <list_graph.hh>
     1.5  #include <dimacs.hh>
     1.6  #include <preflow_push_max_flow.h>
     1.7 +#include <preflow_push_hl.h>
     1.8  #include <time_measure.h>
     1.9  
    1.10  using namespace marci;
    1.11 @@ -19,7 +20,8 @@
    1.12    ListGraph::EdgeMap<int> cap(G);
    1.13    readDimacsMaxFlow(std::cin, G, s, t, cap);
    1.14  
    1.15 -  std::cout << "preflow demo (JACINT)..." << std::endl;
    1.16 +  {
    1.17 +  std::cout << "preflow demo (preflow_push_max_flow by JACINT)..." << std::endl;
    1.18    //ListGraph::EdgeMap<int> flow(G); //0 flow
    1.19  
    1.20    double pre_time=currTime();
    1.21 @@ -39,6 +41,32 @@
    1.22    std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
    1.23    std::cout << "flow value: "<< max_flow_test.maxflow() << std::endl;
    1.24    std::cout << "cut value: "<< cut_value << std::endl;
    1.25 +  }
    1.26 +
    1.27 +/*
    1.28 +    {
    1.29 +  std::cout << "preflow demo (preflow_push_hl by JACINT)..." << std::endl;
    1.30 +  //ListGraph::EdgeMap<int> flow(G); //0 flow
    1.31 +
    1.32 +  double pre_time=currTime();
    1.33 +  preflow_push_hl<ListGraph, int> max_flow_test(G, s, t, cap);
    1.34 +  max_flow_test.run();
    1.35 +  ListGraph::NodeMap<bool> cut=max_flow_test.mincut();
    1.36 +  int cut_value=0;
    1.37 +  for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
    1.38 +    if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e);
    1.39 +  }
    1.40 +  double post_time=currTime();
    1.41 +  //std::cout << "maximum flow: "<< std::endl;
    1.42 +  //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) { 
    1.43 +  //  std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
    1.44 +  //}
    1.45 +  //std::cout<<std::endl;
    1.46 +  std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
    1.47 +  std::cout << "flow value: "<< max_flow_test.maxflow() << std::endl;
    1.48 +  std::cout << "cut value: "<< cut_value << std::endl;
    1.49 +  }
    1.50 +*/
    1.51  
    1.52    return 0;
    1.53  }