COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
04/29/04 18:25:03 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@633
Message:

preflow, maxflow

File:
1 edited

Legend:

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

    r475 r476  
    66#include <smart_graph.h>
    77#include <dimacs.h>
    8 //#include <edmonds_karp.h>
    98#include <time_measure.h>
    109//#include <graph_wrapper.h>
     
    7170  Timer ts;
    7271  Graph::EdgeMap<int> flow(G); //0 flow
    73   Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
    74     pre_flow_test(G, s, t, cap, flow/*, true*/);
    75   //  Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
    76   //  pre_flow_ize(G, s, t, cap, flow/*, false*/);
    77 //   PreflowRes<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
    78 //     pre_flow_res(G, s, t, cap, flow/*, true*/);
    79   //MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
    80   //  max_flow_test(G, s, t, cap, flow);
     72  MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     73    max_flow_test(G, s, t, cap, flow);
    8174
    8275  {
    8376    std::cout << "preflow ..." << std::endl;
    8477    ts.reset();
    85     pre_flow_test.run();
     78    max_flow_test.run();
    8679    std::cout << "elapsed time: " << ts << std::endl;
    87     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
     80    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    8881  }
    8982
     
    9285    FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
    9386    ts.reset();
    94     pre_flow_test.preflow(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
     87    max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    9588    std::cout << "elapsed time: " << ts << std::endl;
    96     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
     89    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    9790  }
    9891
     
    111104    ts.reset();
    112105    int i=0;
    113     while (pre_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
     106    while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
    114107    std::cout << "elapsed time: " << ts << std::endl;
    115108    std::cout << "number of augmentation phases: " << i << std::endl;
    116     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
     109    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    117110  }
    118111
     
    133126    ts.reset();
    134127    int i=0;
    135     while (pre_flow_test.augmentOnBlockingFlow2()) { ++i; }
     128    while (max_flow_test.augmentOnBlockingFlow2()) { ++i; }
    136129    std::cout << "elapsed time: " << ts << std::endl;
    137130    std::cout << "number of augmentation phases: " << i << std::endl;
    138     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
     131    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    139132  }
    140133
     
    144137    ts.reset();
    145138    int i=0;
    146     while (pre_flow_test.augmentOnShortestPath()) { ++i; }
     139    while (max_flow_test.augmentOnShortestPath()) { ++i; }
    147140    std::cout << "elapsed time: " << ts << std::endl;
    148141    std::cout << "number of augmentation phases: " << i << std::endl;
    149     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
     142    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    150143  }
    151144
Note: See TracChangeset for help on using the changeset viewer.