src/work/athos/minlength_demo.cc
changeset 1365 c280de819a73
parent 607 327f7cf13843
equal deleted inserted replaced
2:5da1f31263f2 -1:000000000000
     1 #include <iostream>
       
     2 #include <fstream>
       
     3 
       
     4 #include <list_graph.h>
       
     5 #include <lemon/dimacs.h>
       
     6 #include <lemon/time_measure.h>
       
     7 #include "minlengthpaths.h"
       
     8 //#include <time_measure.h>
       
     9 
       
    10 using namespace lemon;
       
    11 
       
    12 // Use a DIMACS max flow file as stdin.
       
    13 // read_dimacs_demo < dimacs_max_flow_file
       
    14 int main(int argc, char ** argv) {
       
    15   typedef ListGraph Graph;
       
    16 
       
    17   typedef Graph::Node Node;
       
    18   //typedef Graph::EachEdgeIt EachEdgeIt;
       
    19 
       
    20   Graph G;
       
    21   Node s, t;
       
    22   Graph::EdgeMap<int> cap(G);
       
    23   readDimacs(std::cin, G, cap, s, t);
       
    24 
       
    25   std::cout << "Minlengthpaths demo (ATHOS)..." << std::endl;
       
    26   //Graph::EdgeMap<int> flow(G); //0 flow
       
    27 
       
    28   //  double pre_time=currTime();
       
    29 
       
    30   int k=1;
       
    31   if (argc>1)
       
    32     k = atoi(argv[1]);
       
    33   MinLengthPaths<Graph, Graph::EdgeMap<int> >
       
    34     surb_test(G,cap);
       
    35   Timer ts;
       
    36   ts.reset();
       
    37   std::cout << "Number of found paths: " << surb_test.run(s,t,k) << std::endl;
       
    38   std::cout << "elapsed time: " << ts << std::endl;
       
    39   
       
    40   std::cout << "Total length of found paths: " << surb_test.totalLength() << std::endl;
       
    41   //std::cout << (surb_test.checkComplementarySlackness() ? "OK (compl. slackn.)." : "Problem (compl. slackn.)!!!") << std::endl;
       
    42 
       
    43   //preflow_push<Graph, int> max_flow_test(G, s, t, cap);
       
    44   //int flow_value=max_flow_test.run();
       
    45 
       
    46   //double post_time=currTime();
       
    47 
       
    48   //std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
       
    49   //std::cout << "flow value: "<< flow_value << std::endl;
       
    50 
       
    51   return 0;
       
    52 }