1.1 --- a/src/work/marci/preflow_demo_jacint.cc Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,73 +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_push_max_flow.h>
1.10 -#include <preflow_push_hl.h>
1.11 -#include <time_measure.h>
1.12 -
1.13 -using namespace lemon;
1.14 -
1.15 -// Use a DIMACS max flow file as stdin.
1.16 -// read_dimacs_demo < dimacs_max_flow_file
1.17 -int main(int, char **) {
1.18 - typedef ListGraph::NodeIt NodeIt;
1.19 - typedef ListGraph::EachEdgeIt EachEdgeIt;
1.20 -
1.21 - ListGraph G;
1.22 - NodeIt s, t;
1.23 - ListGraph::EdgeMap<int> cap(G);
1.24 - readDimacsMaxFlow(std::cin, G, s, t, cap);
1.25 -
1.26 - {
1.27 - std::cout << "preflow demo (preflow_push_max_flow by JACINT)..." << std::endl;
1.28 - //ListGraph::EdgeMap<int> flow(G); //0 flow
1.29 -
1.30 - double pre_time=currTime();
1.31 - preflow_push_max_flow<ListGraph, int> max_flow_test(G, s, t, cap);
1.32 - max_flow_test.run();
1.33 - ListGraph::NodeMap<bool> cut(G);
1.34 - max_flow_test.mincut(cut);
1.35 - int cut_value=0;
1.36 - for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.37 - if (cut.get(G.source(e)) && !cut.get(G.target(e))) cut_value+=cap.get(e);
1.38 - }
1.39 - double post_time=currTime();
1.40 - //std::cout << "maximum flow: "<< std::endl;
1.41 - //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.42 - // std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
1.43 - //}
1.44 - //std::cout<<std::endl;
1.45 - std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
1.46 - std::cout << "flow value: "<< max_flow_test.maxflow() << std::endl;
1.47 - std::cout << "cut value: "<< cut_value << std::endl;
1.48 - }
1.49 -
1.50 - {
1.51 - std::cout << "preflow demo (preflow_push_hl by JACINT)..." << std::endl;
1.52 - //ListGraph::EdgeMap<int> flow(G); //0 flow
1.53 -
1.54 - double pre_time=currTime();
1.55 - preflow_push_hl<ListGraph, int> max_flow_test(G, s, t, cap);
1.56 - max_flow_test.run();
1.57 - ListGraph::NodeMap<bool> cut(G);
1.58 - max_flow_test.mincut(cut);
1.59 - int cut_value=0;
1.60 - for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.61 - if (cut.get(G.source(e)) && !cut.get(G.target(e))) cut_value+=cap.get(e);
1.62 - }
1.63 - double post_time=currTime();
1.64 - //std::cout << "maximum flow: "<< std::endl;
1.65 - //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.66 - // std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
1.67 - //}
1.68 - //std::cout<<std::endl;
1.69 - std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
1.70 - std::cout << "flow value: "<< max_flow_test.maxflow() << std::endl;
1.71 - std::cout << "cut value: "<< cut_value << std::endl;
1.72 - }
1.73 -
1.74 -
1.75 - return 0;
1.76 -}