1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/marci/preflow_demo_athos.cc Mon Feb 16 18:15:31 2004 +0000
1.3 @@ -0,0 +1,44 @@
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.hh>
1.10 +#include <time_measure.h>
1.11 +
1.12 +using namespace marci;
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 demo (ATHOS)..." << std::endl;
1.26 + //ListGraph::EdgeMap<int> flow(G); //0 flow
1.27 +
1.28 + double pre_time=currTime();
1.29 + preflow_push<ListGraph, int> max_flow_test(G, s, t, cap);
1.30 + int flow_value=max_flow_test.run();
1.31 + //ListGraph::NodeMap<bool> cut=max_flow_test.mincut();
1.32 + //int cut_value=0;
1.33 + //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.34 + // if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e);
1.35 + //}
1.36 + double post_time=currTime();
1.37 + //std::cout << "maximum flow: "<< std::endl;
1.38 + //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.39 + // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.40 + //}
1.41 + //std::cout<<std::endl;
1.42 + std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
1.43 + std::cout << "flow value: "<< flow_value << std::endl;
1.44 + //std::cout << "cut value: "<< cut_value << std::endl;
1.45 +
1.46 + return 0;
1.47 +}