[Lemon-commits] Alpar Juttner: Merge #347

Lemon HG hg at lemon.cs.elte.hu
Sun Feb 28 20:17:11 CET 2010


details:   http://lemon.cs.elte.hu/hg/lemon/rev/754272f20318
changeset: 920:754272f20318
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Sun Feb 28 19:58:24 2010 +0100
description:
	Merge #347

diffstat:

 tools/dimacs-solver.cc |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (61 lines):

diff --git a/tools/dimacs-solver.cc b/tools/dimacs-solver.cc
--- a/tools/dimacs-solver.cc
+++ b/tools/dimacs-solver.cc
@@ -91,7 +91,7 @@
   if(report) std::cerr << "\nMax flow value: " << pre.flowValue() << '\n';  
 }
 
-template<class Value>
+template<class Value, class LargeValue>
 void solve_min(ArgParser &ap, std::istream &is, std::ostream &,
                Value infty, DimacsDescriptor &desc)
 {
@@ -127,7 +127,8 @@
   if (report) {
     std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
     std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';
-    if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n';
+    if (res) std::cerr << "Min flow cost: "
+                       << ns.template totalCost<LargeValue>() << '\n';
   }
 }
 
@@ -151,7 +152,7 @@
 }
 
 
-template<class Value>
+template<class Value, class LargeValue>
 void solve(ArgParser &ap, std::istream &is, std::ostream &os,
            DimacsDescriptor &desc)
 {
@@ -169,7 +170,7 @@
   switch(desc.type)
     {
     case DimacsDescriptor::MIN:
-      solve_min<Value>(ap,is,os,infty,desc);
+      solve_min<Value, LargeValue>(ap,is,os,infty,desc);
       break;
     case DimacsDescriptor::MAX:
       solve_max<Value>(ap,is,os,infty,desc);
@@ -264,14 +265,16 @@
     }
     
   if(ap.given("double"))
-    solve<double>(ap,is,os,desc);
+    solve<double, double>(ap,is,os,desc);
   else if(ap.given("ldouble"))
-    solve<long double>(ap,is,os,desc);
+    solve<long double, long double>(ap,is,os,desc);
 #ifdef LEMON_HAVE_LONG_LONG
   else if(ap.given("long"))
-    solve<long long>(ap,is,os,desc);
+    solve<long long, long long>(ap,is,os,desc);
+  else solve<int, long long>(ap,is,os,desc);
+#else
+  else solve<int, long>(ap,is,os,desc);
 #endif
-  else solve<int>(ap,is,os,desc);
 
   return 0;
 }



More information about the Lemon-commits mailing list