src/work/athos/minlength_demo.cc
changeset 905 5be029d19c98
parent 511 325c9430723e
child 921 818510fa3d99
equal deleted inserted replaced
0:a8cd8decfb63 1:8ff379779e27
     1 #include <iostream>
     1 #include <iostream>
     2 #include <fstream>
     2 #include <fstream>
     3 
     3 
     4 #include <list_graph.h>
     4 #include <list_graph.h>
     5 #include <dimacs.h>
     5 #include <hugo/dimacs.h>
     6 #include <minlengthpaths.h>
     6 #include <hugo/time_measure.h>
       
     7 #include "minlengthpaths.h"
     7 //#include <time_measure.h>
     8 //#include <time_measure.h>
     8 
     9 
     9 using namespace hugo;
    10 using namespace hugo;
    10 
    11 
    11 // Use a DIMACS max flow file as stdin.
    12 // Use a DIMACS max flow file as stdin.
    17   //typedef Graph::EachEdgeIt EachEdgeIt;
    18   //typedef Graph::EachEdgeIt EachEdgeIt;
    18 
    19 
    19   Graph G;
    20   Graph G;
    20   Node s, t;
    21   Node s, t;
    21   Graph::EdgeMap<int> cap(G);
    22   Graph::EdgeMap<int> cap(G);
    22   readDimacsMaxFlow(std::cin, G, s, t, cap);
    23   readDimacs(std::cin, G, cap, s, t);
    23 
    24 
    24   std::cout << "preflow demo (ATHOS)..." << std::endl;
    25   std::cout << "Minlengthpaths demo (ATHOS)..." << std::endl;
    25   //Graph::EdgeMap<int> flow(G); //0 flow
    26   //Graph::EdgeMap<int> flow(G); //0 flow
    26 
    27 
    27   //  double pre_time=currTime();
    28   //  double pre_time=currTime();
    28 
    29 
    29   int k=1;
    30   int k=1;
    30   if (argc>1)
    31   if (argc>1)
    31     k = atoi(argv[1]);
    32     k = atoi(argv[1]);
    32   MinLengthPaths<Graph, Graph::EdgeMap<int> >
    33   MinLengthPaths<Graph, Graph::EdgeMap<int> >
    33     surb_test(G,cap);
    34     surb_test(G,cap);
    34   std::cout << surb_test.run(s,t,k) << std::endl;
    35   Timer ts;
    35   std::cout << surb_test.totalLength() << std::endl;
    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 
    36   //preflow_push<Graph, int> max_flow_test(G, s, t, cap);
    43   //preflow_push<Graph, int> max_flow_test(G, s, t, cap);
    37   //int flow_value=max_flow_test.run();
    44   //int flow_value=max_flow_test.run();
    38 
    45 
    39   //double post_time=currTime();
    46   //double post_time=currTime();
    40 
    47