tests/circulation.cc
changeset 10 d7ce0311ece2
parent 9 7768d68909e8
child 11 cf6519daa7fa
     1.1 --- a/tests/circulation.cc	Sun Dec 11 06:55:47 2011 +0100
     1.2 +++ b/tests/circulation.cc	Sun Dec 11 07:33:29 2011 +0100
     1.3 @@ -1,15 +1,15 @@
     1.4 +#include <benchmark_tools.h>
     1.5  #include <lemon/circulation.h>
     1.6  #include <lemon/smart_graph.h>
     1.7  #include <lemon/lgf_reader.h>
     1.8  #include <lemon/dimacs.h>
     1.9 -#include <lemon/time_measure.h>
    1.10  #include <lemon/error.h>
    1.11  
    1.12  const char test_name[] = "circulation";
    1.13  
    1.14  using namespace lemon;
    1.15  
    1.16 -int main(int argc, char **argv)
    1.17 +int testMain(int argc, char **argv)
    1.18  {
    1.19    if(argc!=2) exit(1);
    1.20  
    1.21 @@ -31,36 +31,41 @@
    1.22      std::cerr << error.what() << std::endl;
    1.23      return 1;
    1.24    }
    1.25 -  std::cerr << "Read the file: " << ti << '\n';
    1.26 +  logTime("file-read",ti);
    1.27 +
    1.28 +  Timer tf;
    1.29    ti.restart();
    1.30 -  
    1.31    Circulation<SmartDigraph,
    1.32      SmartDigraph::ArcMap<Value>,SmartDigraph::ArcMap<Value>,
    1.33      SmartDigraph::NodeMap<Value> > circ(g,lo_cap,up_cap,sup);
    1.34 -  std::cerr << "Setup Circulation class: " << ti << '\n';
    1.35 +  logTime("setup",ti);
    1.36    ti.restart();
    1.37    bool res = circ.run();
    1.38 +  logTime("alg",ti);
    1.39 +  logTime("full",tf);
    1.40    if(res)
    1.41      {
    1.42 -      std::cerr << "A feasible circulation is found: " << ti << "\n";
    1.43 +      std::cerr << "A feasible circulation is found\n";
    1.44 +      std::cerr << "Checking...\n";
    1.45        ti.restart();
    1.46        bool res2 = circ.checkFlow();
    1.47 -      std::cerr << "Checked in time " << ti << "\n";
    1.48 +      logTime("check",ti);
    1.49        if(res2)
    1.50 -        std::cerr << "Success!\nn";
    1.51 +        std::cerr << "Success!\n";
    1.52        else
    1.53 -        std::cerr << "Oops!!!!\n\n";
    1.54 +        std::cerr << "Oops!!!!\n";
    1.55      }
    1.56    else
    1.57      {
    1.58 -      std::cerr << "A dual solution is found: " << ti << "\n";
    1.59 +      std::cerr << "A dual solution is found\n";
    1.60 +      std::cerr << "Checking...\n";
    1.61        ti.restart();
    1.62        bool res2 = circ.checkBarrier();
    1.63 -      std::cerr << "Checked in time " << ti << "\n";
    1.64 +      logTime("check",ti);
    1.65        if(res2)
    1.66 -        std::cerr << "Success!\nn";
    1.67 +        std::cerr << "Success!\n";
    1.68        else
    1.69 -        std::cerr << "Dual-Oops!!!!\n\n";
    1.70 +        std::cerr << "Dual-Oops!!!!\n";
    1.71  
    1.72      }
    1.73  }