tests/circulation.cc
changeset 11 cf6519daa7fa
parent 10 d7ce0311ece2
child 12 4eab99ff2666
equal deleted inserted replaced
1:95d4eb477569 2:c1dbb1d01326
     2 #include <lemon/circulation.h>
     2 #include <lemon/circulation.h>
     3 #include <lemon/smart_graph.h>
     3 #include <lemon/smart_graph.h>
     4 #include <lemon/lgf_reader.h>
     4 #include <lemon/lgf_reader.h>
     5 #include <lemon/dimacs.h>
     5 #include <lemon/dimacs.h>
     6 #include <lemon/error.h>
     6 #include <lemon/error.h>
       
     7 #include <istream>
     7 
     8 
     8 const char test_name[] = "circulation";
     9 std::string test_name = "circulation";
     9 
    10 
    10 using namespace lemon;
    11 using namespace lemon;
    11 
    12 
    12 int testMain(int argc, char **argv)
    13 int testMain(std::istream &input)
    13 {
    14 {
    14   if(argc!=2) exit(1);
       
    15 
       
    16   typedef int Value;
    15   typedef int Value;
    17   
    16   
    18   SmartDigraph g;
    17   SmartDigraph g;
    19   
    18   
    20   SmartDigraph::ArcMap<Value> lo_cap(g);
    19   SmartDigraph::ArcMap<Value> lo_cap(g);
    22   SmartDigraph::ArcMap<Value> cost(g);
    21   SmartDigraph::ArcMap<Value> cost(g);
    23   SmartDigraph::NodeMap<Value> sup(g);
    22   SmartDigraph::NodeMap<Value> sup(g);
    24   
    23   
    25   Timer ti;
    24   Timer ti;
    26   try {
    25   try {
    27     std::ifstream input;
       
    28     input.open(argv[1]);
       
    29     readDimacsMin(input, g, lo_cap, up_cap, cost, sup);
    26     readDimacsMin(input, g, lo_cap, up_cap, cost, sup);
    30   } catch (FormatError& error) {
    27   } catch (FormatError& error) {
    31     std::cerr << error.what() << std::endl;
    28     std::cerr << error.what() << std::endl;
    32     return 1;
    29     return 1;
    33   }
    30   }
    34   logTime("file-read",ti);
    31   logTime("fread",ti);
    35 
    32 
    36   Timer tf;
    33   Timer tf;
    37   ti.restart();
    34   ti.restart();
    38   Circulation<SmartDigraph,
    35   Circulation<SmartDigraph,
    39     SmartDigraph::ArcMap<Value>,SmartDigraph::ArcMap<Value>,
    36     SmartDigraph::ArcMap<Value>,SmartDigraph::ArcMap<Value>,