COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
04/06/04 14:00:34 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@429
Message:

gw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/edmonds_karp_demo.cc

    r305 r311  
    99#include <time_measure.h>
    1010//#include <graph_wrapper.h>
    11 
    12 class CM {
    13 public:
    14   template<typename T> int get(T) const {return 1;}
    15 };
     11#include <preflow.h>
    1612
    1713using namespace hugo;
     
    8985//   std::cout << "p2:" << cgw.nodeNum() << std::endl;
    9086
    91 
    92   {
    93     std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl;
     87  {
     88    std::cout << "preflow ..." << std::endl;
     89    Graph::EdgeMap<int> flow(G); //0 flow
     90
     91    Timer ts;
     92    ts.reset();
     93
     94    Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     95      max_flow_test(G, s, t, cap, flow);
     96    max_flow_test.run();
     97//    int i=0;
     98//    while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) {
     99//     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
     100//       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
     101//     }
     102//     std::cout<<std::endl;
     103//      ++i;
     104//    }
     105
     106//   std::cout << "maximum flow: "<< std::endl;
     107//   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
     108//     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
     109//   }
     110//   std::cout<<std::endl;
     111    std::cout << "elapsed time: " << ts << std::endl;
     112//    std::cout << "number of augmentation phases: " << i << std::endl;
     113    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
     114  }
     115
     116  {
     117    std::cout << "physical blocking flow augmentation ..." << std::endl;
    94118    Graph::EdgeMap<int> flow(G); //0 flow
    95119
     
    119143
    120144  {
    121     std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl;
     145    std::cout << "faster physical blocking flow augmentation ..." << std::endl;
    122146    Graph::EdgeMap<int> flow(G); //0 flow
    123147
     
    147171
    148172  {
    149     std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
     173    std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
    150174    Graph::EdgeMap<int> flow(G); //0 flow
    151175
     
    175199
    176200  {
    177     std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl;
     201    std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
    178202    Graph::EdgeMap<int> flow(G); //0 flow
    179203
Note: See TracChangeset for help on using the changeset viewer.