Changeset 968:774349a16ba0 in lemon1.2
 Timestamp:
 11/07/12 18:13:26 (7 years ago)
 Branch:
 1.2
 Parents:
 966:08712a8c3afe (diff), 967:c5990f454032 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.  Phase:
 public
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

tools/dimacssolver.cc
r877 r968 118 118 if (report) std::cerr << "Read the file: " << ti << '\n'; 119 119 120 ti.restart(); 121 NetworkSimplex<Digraph, Value> ns(g); 120 typedef NetworkSimplex<Digraph, Value> MCF; 121 ti.restart(); 122 MCF ns(g); 122 123 ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup); 123 124 if (sum_sup > 0) ns.supplyType(ns.LEQ); 124 125 if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n'; 125 126 ti.restart(); 126 boolres = ns.run();127 typename MCF::ProblemType res = ns.run(); 127 128 if (report) { 128 129 std::cerr << "Run NetworkSimplex: " << ti << "\n\n"; 129 std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';130 std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" : "not found") << '\n'; 130 131 if (res) std::cerr << "Min flow cost: " 131 132 << ns.template totalCost<LargeValue>() << '\n'; … … 188 189 189 190 int main(int argc, const char *argv[]) { 190 typedef SmartDigraph Digraph;191 192 typedef Digraph::Arc Arc;193 191 194 192 std::string inputName; 
tools/dimacssolver.cc
r967 r968 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 200320 095 * Copyright (C) 20032010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 89 89 pre.run(); 90 90 if(report) std::cerr << "Run Preflow: " << ti << '\n'; 91 if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n'; 92 } 93 94 template<class Value >91 if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n'; 92 } 93 94 template<class Value, class LargeValue> 95 95 void solve_min(ArgParser &ap, std::istream &is, std::ostream &, 96 96 Value infty, DimacsDescriptor &desc) … … 129 129 std::cerr << "Run NetworkSimplex: " << ti << "\n\n"; 130 130 std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" : "not found") << '\n'; 131 if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n'; 131 if (res) std::cerr << "Min flow cost: " 132 << ns.template totalCost<LargeValue>() << '\n'; 132 133 } 133 134 } … … 149 150 if(report) std::cerr << "Run MaxMatching: " << ti << '\n'; 150 151 if(report) std::cerr << "\nCardinality of max matching: " 151 << mat.matchingSize() << '\n'; 152 } 153 154 155 template<class Value >152 << mat.matchingSize() << '\n'; 153 } 154 155 156 template<class Value, class LargeValue> 156 157 void solve(ArgParser &ap, std::istream &is, std::ostream &os, 157 158 DimacsDescriptor &desc) … … 167 168 exit(1); 168 169 } 169 170 170 171 switch(desc.type) 171 172 { 172 173 case DimacsDescriptor::MIN: 173 solve_min<Value >(ap,is,os,infty,desc);174 solve_min<Value, LargeValue>(ap,is,os,infty,desc); 174 175 break; 175 176 case DimacsDescriptor::MAX: … … 236 237 237 238 DimacsDescriptor desc = dimacsType(is); 238 239 239 240 if(!ap.given("q")) 240 241 { … … 261 262 std::cout << "\n\n"; 262 263 } 263 264 264 265 if(ap.given("double")) 265 solve<double >(ap,is,os,desc);266 solve<double, double>(ap,is,os,desc); 266 267 else if(ap.given("ldouble")) 267 solve<long double >(ap,is,os,desc);268 solve<long double, long double>(ap,is,os,desc); 268 269 #ifdef LEMON_HAVE_LONG_LONG 269 270 else if(ap.given("long")) 270 solve<long long>(ap,is,os,desc); 271 solve<long long, long long>(ap,is,os,desc); 272 else solve<int, long long>(ap,is,os,desc); 273 #else 274 else solve<int, long>(ap,is,os,desc); 271 275 #endif 272 else solve<int>(ap,is,os,desc);273 276 274 277 return 0;
Note: See TracChangeset
for help on using the changeset viewer.