COIN-OR::LEMON - Graph Library

Changeset 854:baf0b6e40211 in lemon-0.x for src/work/marci


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.

Location:
src/work/marci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/augmenting_flow.h

    r777 r854  
    12621262          typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
    12631263                                        res_graph_to_F[res_graph.head(e)]);
    1264           original_edge.update();
     1264          //original_edge.update();
    12651265          original_edge.set(f, e);
    1266           residual_capacity.update();
     1266          //residual_capacity.update();
    12671267          residual_capacity.set(f, res_graph.resCap(e));
    12681268        } else {
     
    12701270            typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
    12711271                                          res_graph_to_F[res_graph.head(e)]);
    1272             original_edge.update();
     1272            //original_edge.update();
    12731273            original_edge.set(f, e);
    1274             residual_capacity.update();
     1274            //residual_capacity.update();
    12751275            residual_capacity.set(f, res_graph.resCap(e));
    12761276          }
     
    12951295      while (!dfs.finished()) {
    12961296        ++dfs;
    1297         if (F.valid(/*typename MG::OutEdgeIt*/(dfs))) {
     1297        if (typename MG::Edge(dfs)!=INVALID) {
    12981298          if (dfs.isBNodeNewlyReached()) {
    12991299            typename MG::Node v=F.tail(dfs);
     
    13121312
    13131313          } else {
    1314             F.erase(/*typename MG::OutEdgeIt*/(dfs));
     1314            F.erase(typename MG::Edge(dfs));
    13151315          }
    13161316        }
  • 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.