Changes in tools/dimacs-solver.cc [594:d657c71db7db:611:85cb3aa71cce] in lemon-1.2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/dimacs-solver.cc
r594 r611 44 44 #include <lemon/preflow.h> 45 45 #include <lemon/matching.h> 46 #include <lemon/network_simplex.h> 46 47 47 48 using namespace lemon; … … 91 92 } 92 93 94 template<class Value> 95 void solve_min(ArgParser &ap, std::istream &is, std::ostream &, 96 DimacsDescriptor &desc) 97 { 98 bool report = !ap.given("q"); 99 Digraph g; 100 Digraph::ArcMap<Value> lower(g), cap(g), cost(g); 101 Digraph::NodeMap<Value> sup(g); 102 Timer ti; 103 ti.restart(); 104 readDimacsMin(is, g, lower, cap, cost, sup, 0, desc); 105 if (report) std::cerr << "Read the file: " << ti << '\n'; 106 ti.restart(); 107 NetworkSimplex<Digraph, Value> ns(g); 108 ns.lowerMap(lower).capacityMap(cap).costMap(cost).supplyMap(sup); 109 if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n'; 110 ti.restart(); 111 ns.run(); 112 if (report) std::cerr << "Run NetworkSimplex: " << ti << '\n'; 113 if (report) std::cerr << "\nMin flow cost: " << ns.totalCost() << '\n'; 114 } 115 93 116 void solve_mat(ArgParser &ap, std::istream &is, std::ostream &, 94 117 DimacsDescriptor &desc) … … 129 152 { 130 153 case DimacsDescriptor::MIN: 131 std::cerr << 132 "\n\n Sorry, the min. cost flow solver is not yet available.\n"; 154 solve_min<Value>(ap,is,os,desc); 133 155 break; 134 156 case DimacsDescriptor::MAX:
Note: See TracChangeset
for help on using the changeset viewer.