COIN-OR::LEMON - Graph Library

Changeset 1322:cfc26d103bcf in lemon-0.x


Ignore:
Timestamp:
04/08/05 08:34:34 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1761
Message:

Demo prog that computes the max flow by LP

Location:
src/demo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/demo/Makefile.am

    r1296 r1322  
    11AM_CPPFLAGS = -I$(top_srcdir)/src
    2 
     2LDADD = $(top_builddir)/src/lemon/libemon.la -lglpk
    33EXTRA_DIST = sub_graph_wrapper_demo.dim
    44
     
    66                        sub_graph_wrapper_demo                          \
    77                        graph_to_eps_demo                               \
     8                        lp_demo                                         \
    89                        dim_to_lgf
    910
    1011dim_to_dot_SOURCES = dim_to_dot.cc
    1112
    12 sub_graph_wrapper_demo_SOURCES = sub_graph_wrapper_demo.cc tight_edge_filter_map.h
     13sub_graph_wrapper_demo_SOURCES = sub_graph_wrapper_demo.cc \
     14        tight_edge_filter_map.h
    1315
    1416graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc
    1517
     18lp_demo_SOURCES = lp_demo.cc
     19
    1620dim_to_lgf_SOURCES = dim_to_lgf.cc
  • src/demo/lp_demo.cc

    r1309 r1322  
    3838    lp.setObj(ex);
    3939  }
    40 
     40  lp.max();
    4141  lp.solve();
    4242
    43   return 0;
     43  return lp.primalValue();
    4444}
    4545
     
    4949
    5050  ListGraph g;
    51   ListGraph::Node s=g.addNode();
    52   ListGraph::Node t=g.addNode();
     51  ListGraph::Node s;
     52  ListGraph::Node t;
     53 
    5354
    5455  ListGraph::EdgeMap<double> cap(g);
    5556 
    5657  GraphReader<ListGraph> reader(std::cin,g);
    57   reader.addEdgeMap("capacity",cap).run();
     58  reader.addNode("source",s).addNode("target",t)
     59    .addEdgeMap("capacity",cap).run();
    5860 
    59   maxFlow(g,cap,s,t);
     61  // std::ifstream file("../test/preflow_");
     62//   readDimacs(file, g, cap, s, t);
     63
     64  std::cout << "Max flow value = " << maxFlow(g,cap,s,t) << std::endl;
    6065
    6166}
Note: See TracChangeset for help on using the changeset viewer.