COIN-OR::LEMON - Graph Library

Changes in / [618:b95898314e09:617:4137ef9aacc6] in lemon-main


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/network_simplex.h

    r618 r612  
    11481148      // Run Circulation to check if a feasible solution exists
    11491149      typedef ConstMap<Arc, Flow> ConstArcMap;
    1150       ConstArcMap zero_arc_map(0), inf_arc_map(inf_cap);
    11511150      FlowNodeMap *csup = NULL;
    11521151      bool local_csup = false;
     
    11691168          } else {
    11701169            Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
    1171               circ(_graph, *_plower, inf_arc_map, *csup);
     1170              circ(_graph, *_plower, ConstArcMap(inf_cap), *csup);
    11721171            circ_result = circ.run();
    11731172          }
     
    11751174          if (_pupper) {
    11761175            Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
    1177               circ(_graph, zero_arc_map, *_pupper, *csup);
     1176              circ(_graph, ConstArcMap(0), *_pupper, *csup);
    11781177            circ_result = circ.run();
    11791178          } else {
    11801179            Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
    1181               circ(_graph, zero_arc_map, inf_arc_map, *csup);
     1180              circ(_graph, ConstArcMap(0), ConstArcMap(inf_cap), *csup);
    11821181            circ_result = circ.run();
    11831182          }
     
    11961195          } else {
    11971196            Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
    1198               circ(rgraph, *_plower, inf_arc_map, neg_csup);
     1197              circ(rgraph, *_plower, ConstArcMap(inf_cap), neg_csup);
    11991198            circ_result = circ.run();
    12001199          }
     
    12021201          if (_pupper) {
    12031202            Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
    1204               circ(rgraph, zero_arc_map, *_pupper, neg_csup);
     1203              circ(rgraph, ConstArcMap(0), *_pupper, neg_csup);
    12051204            circ_result = circ.run();
    12061205          } else {
    12071206            Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
    1208               circ(rgraph, zero_arc_map, inf_arc_map, neg_csup);
     1207              circ(rgraph, ConstArcMap(0), ConstArcMap(inf_cap), neg_csup);
    12091208            circ_result = circ.run();
    12101209          }
  • test/min_cost_flow_test.cc

    r615 r609  
    234234    typedef int Flow;
    235235    typedef int Cost;
    236     typedef concepts::Digraph GR;
     236    // TODO: This typedef should be enabled if the standard maps are
     237    // reference maps in the graph concepts (See #190).
     238/**/
     239    //typedef concepts::Digraph GR;
     240    typedef ListDigraph GR;
     241/**/
    237242    checkConcept< McfClassConcept<GR, Flow, Cost>,
    238243                  NetworkSimplex<GR, Flow, Cost> >();
  • tools/dimacs-solver.cc

    r614 r611  
    9494template<class Value>
    9595void solve_min(ArgParser &ap, std::istream &is, std::ostream &,
    96                Value infty, DimacsDescriptor &desc)
     96               DimacsDescriptor &desc)
    9797{
    9898  bool report = !ap.given("q");
     
    101101  Digraph::NodeMap<Value> sup(g);
    102102  Timer ti;
    103 
    104   ti.restart();
    105   readDimacsMin(is, g, lower, cap, cost, sup, infty, desc);
    106   ti.stop();
    107   Value sum_sup = 0;
    108   for (Digraph::NodeIt n(g); n != INVALID; ++n) {
    109     sum_sup += sup[n];
    110   }
    111   if (report) {
    112     std::cerr << "Sum of supply values: " << sum_sup << "\n";
    113     if (sum_sup <= 0)
    114       std::cerr << "GEQ supply contraints are used for NetworkSimplex\n\n";
    115     else
    116       std::cerr << "LEQ supply contraints are used for NetworkSimplex\n\n";
    117   }
     103  ti.restart();
     104  readDimacsMin(is, g, lower, cap, cost, sup, 0, desc);
    118105  if (report) std::cerr << "Read the file: " << ti << '\n';
    119 
    120106  ti.restart();
    121107  NetworkSimplex<Digraph, Value> ns(g);
    122108  ns.lowerMap(lower).capacityMap(cap).costMap(cost).supplyMap(sup);
    123   if (sum_sup > 0) ns.problemType(ns.LEQ);
    124109  if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
    125110  ti.restart();
    126   bool res = ns.run();
    127   if (report) {
    128     std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
    129     std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';
    130     if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n';
    131   }
     111  ns.run();
     112  if (report) std::cerr << "Run NetworkSimplex: " << ti << '\n';
     113  if (report) std::cerr << "\nMin flow cost: " << ns.totalCost() << '\n';
    132114}
    133115
     
    170152    {
    171153    case DimacsDescriptor::MIN:
    172       solve_min<Value>(ap,is,os,infty,desc);
     154      solve_min<Value>(ap,is,os,desc);
    173155      break;
    174156    case DimacsDescriptor::MAX:
Note: See TracChangeset for help on using the changeset viewer.