diff -r cd72eae05bdf -r 3c00344f49c9 tools/dimacs-solver.cc --- a/tools/dimacs-solver.cc Mon Jul 16 16:21:40 2018 +0200 +++ b/tools/dimacs-solver.cc Wed Oct 17 19:14:07 2018 +0200 @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2010 + * Copyright (C) 2003-2013 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -117,16 +117,18 @@ } if (report) std::cerr << "Read the file: " << ti << '\n'; + typedef NetworkSimplex MCF; ti.restart(); - NetworkSimplex ns(g); + MCF ns(g); ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup); if (sum_sup > 0) ns.supplyType(ns.LEQ); if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n'; ti.restart(); - bool res = ns.run(); + typename MCF::ProblemType res = ns.run(); if (report) { std::cerr << "Run NetworkSimplex: " << ti << "\n\n"; - std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n'; + std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" : + "not found") << '\n'; if (res) std::cerr << "Min flow cost: " << ns.template totalCost() << '\n'; } @@ -187,9 +189,6 @@ } int main(int argc, const char *argv[]) { - typedef SmartDigraph Digraph; - - typedef Digraph::Arc Arc; std::string inputName; std::string outputName; @@ -223,11 +222,13 @@ if (!output) { throw IoError("Cannot open the file for writing", ap.files()[1]); } + // fall through case 1: input.open(ap.files()[0].c_str()); if (!input) { throw IoError("File cannot be found", ap.files()[0]); } + // fall through case 0: break; default: @@ -252,6 +253,7 @@ break; case DimacsDescriptor::SP: std::cout << "sp"; + break; case DimacsDescriptor::MAT: std::cout << "mat"; break;