tools/dimacs-solver.cc
changeset 1184 3c00344f49c9
parent 1093 fb1c7da561ce
     1.1 --- a/tools/dimacs-solver.cc	Mon Jul 16 16:21:40 2018 +0200
     1.2 +++ b/tools/dimacs-solver.cc	Wed Oct 17 19:14:07 2018 +0200
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2010
     1.8 + * Copyright (C) 2003-2013
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -117,16 +117,18 @@
    1.13    }
    1.14    if (report) std::cerr << "Read the file: " << ti << '\n';
    1.15  
    1.16 +  typedef NetworkSimplex<Digraph, Value> MCF;
    1.17    ti.restart();
    1.18 -  NetworkSimplex<Digraph, Value> ns(g);
    1.19 +  MCF ns(g);
    1.20    ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup);
    1.21    if (sum_sup > 0) ns.supplyType(ns.LEQ);
    1.22    if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
    1.23    ti.restart();
    1.24 -  bool res = ns.run();
    1.25 +  typename MCF::ProblemType res = ns.run();
    1.26    if (report) {
    1.27      std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
    1.28 -    std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';
    1.29 +    std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" :
    1.30 +                                       "not found") << '\n';
    1.31      if (res) std::cerr << "Min flow cost: "
    1.32                         << ns.template totalCost<LargeValue>() << '\n';
    1.33    }
    1.34 @@ -187,9 +189,6 @@
    1.35  }
    1.36  
    1.37  int main(int argc, const char *argv[]) {
    1.38 -  typedef SmartDigraph Digraph;
    1.39 -
    1.40 -  typedef Digraph::Arc Arc;
    1.41  
    1.42    std::string inputName;
    1.43    std::string outputName;
    1.44 @@ -223,11 +222,13 @@
    1.45        if (!output) {
    1.46          throw IoError("Cannot open the file for writing", ap.files()[1]);
    1.47        }
    1.48 +      // fall through
    1.49      case 1:
    1.50        input.open(ap.files()[0].c_str());
    1.51        if (!input) {
    1.52          throw IoError("File cannot be found", ap.files()[0]);
    1.53        }
    1.54 +      // fall through
    1.55      case 0:
    1.56        break;
    1.57      default:
    1.58 @@ -252,6 +253,7 @@
    1.59            break;
    1.60          case DimacsDescriptor::SP:
    1.61            std::cout << "sp";
    1.62 +          break;
    1.63          case DimacsDescriptor::MAT:
    1.64            std::cout << "mat";
    1.65            break;