equal
deleted
inserted
replaced
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: " << ns.totalCost() << '\n'; |
131 if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n'; |
131 } |
132 } |
132 } |
133 } |
133 |
134 |
134 void solve_mat(ArgParser &ap, std::istream &is, std::ostream &, |
135 void solve_mat(ArgParser &ap, std::istream &is, std::ostream &, |
184 break; |
185 break; |
185 } |
186 } |
186 } |
187 } |
187 |
188 |
188 int main(int argc, const char *argv[]) { |
189 int main(int argc, const char *argv[]) { |
189 typedef SmartDigraph Digraph; |
|
190 |
|
191 typedef Digraph::Arc Arc; |
|
192 |
190 |
193 std::string inputName; |
191 std::string inputName; |
194 std::string outputName; |
192 std::string outputName; |
195 |
193 |
196 ArgParser ap(argc, argv); |
194 ArgParser ap(argc, argv); |