COIN-OR::LEMON - Graph Library

Changeset 10:d7ce0311ece2 in lemon-benchmark for tests


Ignore:
Timestamp:
12/11/11 07:33:29 (13 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Some common benchmarking tools added

Location:
tests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • tests/CMakeLists.txt

    r9 r10  
    99
    1010ADD_EXECUTABLE(circulation
    11         circulation.cc
     11        circulation.cc main.cc
    1212)
    1313
  • tests/circulation.cc

    r9 r10  
     1#include <benchmark_tools.h>
    12#include <lemon/circulation.h>
    23#include <lemon/smart_graph.h>
    34#include <lemon/lgf_reader.h>
    45#include <lemon/dimacs.h>
    5 #include <lemon/time_measure.h>
    66#include <lemon/error.h>
    77
     
    1010using namespace lemon;
    1111
    12 int main(int argc, char **argv)
     12int testMain(int argc, char **argv)
    1313{
    1414  if(argc!=2) exit(1);
     
    3232    return 1;
    3333  }
    34   std::cerr << "Read the file: " << ti << '\n';
     34  logTime("file-read",ti);
     35
     36  Timer tf;
    3537  ti.restart();
    36  
    3738  Circulation<SmartDigraph,
    3839    SmartDigraph::ArcMap<Value>,SmartDigraph::ArcMap<Value>,
    3940    SmartDigraph::NodeMap<Value> > circ(g,lo_cap,up_cap,sup);
    40   std::cerr << "Setup Circulation class: " << ti << '\n';
     41  logTime("setup",ti);
    4142  ti.restart();
    4243  bool res = circ.run();
     44  logTime("alg",ti);
     45  logTime("full",tf);
    4346  if(res)
    4447    {
    45       std::cerr << "A feasible circulation is found: " << ti << "\n";
     48      std::cerr << "A feasible circulation is found\n";
     49      std::cerr << "Checking...\n";
    4650      ti.restart();
    4751      bool res2 = circ.checkFlow();
    48       std::cerr << "Checked in time " << ti << "\n";
     52      logTime("check",ti);
    4953      if(res2)
    50         std::cerr << "Success!\nn";
     54        std::cerr << "Success!\n";
    5155      else
    52         std::cerr << "Oops!!!!\n\n";
     56        std::cerr << "Oops!!!!\n";
    5357    }
    5458  else
    5559    {
    56       std::cerr << "A dual solution is found: " << ti << "\n";
     60      std::cerr << "A dual solution is found\n";
     61      std::cerr << "Checking...\n";
    5762      ti.restart();
    5863      bool res2 = circ.checkBarrier();
    59       std::cerr << "Checked in time " << ti << "\n";
     64      logTime("check",ti);
    6065      if(res2)
    61         std::cerr << "Success!\nn";
     66        std::cerr << "Success!\n";
    6267      else
    63         std::cerr << "Dual-Oops!!!!\n\n";
     68        std::cerr << "Dual-Oops!!!!\n";
    6469
    6570    }
Note: See TracChangeset for help on using the changeset viewer.