COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
10/08/04 15:07:51 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1283
Message:

Suurballe and MinCostFlow? classes are now able to increase the flow 1 by 1 with
this->augment()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/min_cost_flow_test.cc

    r921 r941  
    2222//#include <maps.h>
    2323
    24 using namespace std;
    2524using namespace lemon;
    26 
    2725
    2826
     
    4240int main()
    4341{
     42  typedef ListGraph Graph;
     43  typedef Graph::Node Node;
     44  typedef Graph::Edge Edge;
    4445
    45   typedef ListGraph::Node Node;
    46   typedef ListGraph::Edge Edge;
    47 
    48   ListGraph graph;
     46  Graph graph;
    4947
    5048  //Ahuja könyv példája
     
    6866 
    6967
    70   ListGraph::EdgeMap<int> length(graph);
     68  Graph::EdgeMap<int> length(graph);
    7169
    7270  length.set(s_v1, 6);
     
    7977  length.set(v5_t, 8);
    8078
    81   ListGraph::EdgeMap<int> capacity(graph);
     79  Graph::EdgeMap<int> capacity(graph);
    8280
    8381  capacity.set(s_v1, 2);
     
    9391  std::cout << "Mincostflows algorithm test..." << std::endl;
    9492
    95   MinCostFlow< ListGraph, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> >
    96     surb_test(graph, length, capacity);
     93  MinCostFlow< Graph, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     94    surb_test(graph, length, capacity, s, t);
    9795
    9896  int k=1;
    9997
    100   check(  surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
     98  surb_test.augment();
     99  check(  surb_test.flowValue() == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
     100
     101  check(  surb_test.run(k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
    101102
    102103  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
     
    104105  k=2;
    105106 
    106   check(  surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41");
     107  check(  surb_test.run(k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41");
    107108
    108109  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    109110 
    110  
     111  surb_test.augment();
     112  surb_test.augment();
     113  surb_test.augment();
    111114  k=4;
    112115
    113   check(  surb_test.run(s,t,k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64");
     116  check(  surb_test.run(k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64");
    114117
    115118  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    116119
    117120
    118   cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
    119        << endl;
     121  std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
     122            << std::endl;
    120123
    121124  return passed ? 0 : 1;
Note: See TracChangeset for help on using the changeset viewer.