COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
09/15/04 12:34:12 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1153
Message:

correction of SubGraphWrapper? bug.

File:
1 edited

Legend:

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

    r849 r854  
    44// max_flow_demo < dimacs_max_flow_file
    55
    6 
    76#include <iostream>
    87#include <fstream>
    98
    10 #include <sage_graph.h>
    119#include <hugo/smart_graph.h>
     10#include <hugo/list_graph.h>
    1211#include <hugo/dimacs.h>
    1312#include <hugo/time_measure.h>
    14 //#include <graph_wrapper.h>
    1513#include <hugo/preflow.h>
    1614#include <augmenting_flow.h>
    17 //#include <preflow_res.h>
    18 #include <for_each_macros.h>
    1915#include <graph_concept.h>
    2016
     
    2319int main(int, char **) {
    2420
    25   typedef SageGraph MutableGraph;
    26 
    27   //typedef FullFeatureGraphConcept Graph;
    28   //typedef SmartGraph Graph;
    29   typedef SageGraph Graph;
     21  typedef ListGraph MutableGraph;
     22  typedef SmartGraph Graph;
    3023  typedef Graph::Node Node;
    3124  typedef Graph::EdgeIt EdgeIt;
     
    5447    max_flow_test.minCut(cut);
    5548
    56     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     49    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    5750      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    5851        std::cout << "Slackness does not hold!" << std::endl;
     
    6457  {
    6558    std::cout << "preflow ..." << std::endl;
    66     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
     59    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
    6760    ts.reset();
    68     max_flow_test.preflow(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
     61    max_flow_test.run(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    6962    std::cout << "elapsed time: " << ts << std::endl;
    7063    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    7164
    72     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     65    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    7366      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    7467        std::cout << "Slackness does not hold!" << std::endl;
     
    8982  {
    9083    std::cout << "physical blocking flow augmentation ..." << std::endl;
    91     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
     84    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
    9285    ts.reset();
    9386    int i=0;
     
    9790    std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    9891
    99     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     92    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    10093      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    10194        std::cout << "Slackness does not hold!" << std::endl;
     
    107100  {
    108101    std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
    109     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
     102    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
    110103    ts.reset();
    111104    int i=0;
     
    115108    std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    116109
    117     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     110    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    118111      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    119112        std::cout << "Slackness does not hold!" << std::endl;
     
    125118  {
    126119    std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
    127     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
     120    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
    128121    ts.reset();
    129122    int i=0;
     
    133126    std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    134127
    135     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     128    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    136129      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    137130        std::cout << "Slackness does not hold!" << std::endl;
     
    143136  {
    144137    std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
    145     FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
     138    for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0);
    146139    ts.reset();
    147140    int i=0;
     
    151144    std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
    152145
    153     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
     146    for(Graph::EdgeIt e(g); e!=INVALID; ++e) {
    154147      if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e])
    155148        std::cout << "Slackness does not hold!" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.