tools/dimacs-solver.cc
changeset 1063 1782aa72495a
parent 877 141f9c0db4a3
parent 1005 c5990f454032
child 1092 dceba191c00d
equal deleted inserted replaced
14:6292a65aced7 16:8a52c91f0bad
   115     else
   115     else
   116       std::cerr << "LEQ supply contraints are used for NetworkSimplex\n\n";
   116       std::cerr << "LEQ supply contraints are used for NetworkSimplex\n\n";
   117   }
   117   }
   118   if (report) std::cerr << "Read the file: " << ti << '\n';
   118   if (report) std::cerr << "Read the file: " << ti << '\n';
   119 
   119 
   120   ti.restart();
   120   typedef NetworkSimplex<Digraph, Value> MCF;
   121   NetworkSimplex<Digraph, Value> ns(g);
   121   ti.restart();
       
   122   MCF ns(g);
   122   ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup);
   123   ns.lowerMap(lower).upperMap(cap).costMap(cost).supplyMap(sup);
   123   if (sum_sup > 0) ns.supplyType(ns.LEQ);
   124   if (sum_sup > 0) ns.supplyType(ns.LEQ);
   124   if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
   125   if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
   125   ti.restart();
   126   ti.restart();
   126   bool res = ns.run();
   127   typename MCF::ProblemType res = ns.run();
   127   if (report) {
   128   if (report) {
   128     std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
   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     if (res) std::cerr << "Min flow cost: "
   131     if (res) std::cerr << "Min flow cost: "
   131                        << ns.template totalCost<LargeValue>() << '\n';
   132                        << ns.template totalCost<LargeValue>() << '\n';
   132   }
   133   }
   133 }
   134 }
   134 
   135 
   185       break;
   186       break;
   186     }
   187     }
   187 }
   188 }
   188 
   189 
   189 int main(int argc, const char *argv[]) {
   190 int main(int argc, const char *argv[]) {
   190   typedef SmartDigraph Digraph;
       
   191 
       
   192   typedef Digraph::Arc Arc;
       
   193 
   191 
   194   std::string inputName;
   192   std::string inputName;
   195   std::string outputName;
   193   std::string outputName;
   196 
   194 
   197   ArgParser ap(argc, argv);
   195   ArgParser ap(argc, argv);