12 #include <lemon/preflow.h> |
12 #include <lemon/preflow.h> |
13 #include <lemon/min_cost_flow.h> |
13 #include <lemon/min_cost_flow.h> |
14 //#include <augmenting_flow.h> |
14 //#include <augmenting_flow.h> |
15 //#include <preflow_res.h> |
15 //#include <preflow_res.h> |
16 #include <work/marci/merge_node_graph_wrapper.h> |
16 #include <work/marci/merge_node_graph_wrapper.h> |
17 #include <work/marci/lp/lp_solver_wrapper_2.h> |
17 #include <work/marci/lp/lp_solver_wrapper_3.h> |
18 |
18 |
19 namespace lemon { |
19 namespace lemon { |
20 |
20 |
21 template<typename Edge, typename EdgeIndexMap> |
21 template<typename Edge, typename EdgeIndexMap> |
22 class PrimalMap { |
22 class PrimalMap { |
226 lp.setColBounds(col_it, LPX_FX, lcapacity[e], capacity[e]); |
226 lp.setColBounds(col_it, LPX_FX, lcapacity[e], capacity[e]); |
227 else |
227 else |
228 lp.setColBounds(col_it, LPX_DB, lcapacity[e], capacity[e]); |
228 lp.setColBounds(col_it, LPX_DB, lcapacity[e], capacity[e]); |
229 lp.setObjCoef(col_it, cost[e]); |
229 lp.setObjCoef(col_it, cost[e]); |
230 } |
230 } |
|
231 LPSolver::ColIt col_it; |
|
232 for (lp.col_iter_map.first(col_it, lp.VALID_CLASS); |
|
233 lp.col_iter_map.valid(col_it); |
|
234 lp.col_iter_map.next(col_it)) { |
|
235 std::cout << "ize " << lp.col_iter_map[col_it] << std::endl; |
|
236 } |
231 for (typename Graph::NodeIt n(g); n!=INVALID; ++n) { |
237 for (typename Graph::NodeIt n(g); n!=INVALID; ++n) { |
232 typename Graph::template EdgeMap<Num> coeffs(g, 0); |
238 typename Graph::template EdgeMap<Num> coeffs(g, 0); |
233 for (typename Graph::InEdgeIt e(g, n); e!=INVALID; ++e) |
239 for (typename Graph::InEdgeIt e(g, n); e!=INVALID; ++e) |
234 coeffs.set(e, coeffs[e]+1); |
240 coeffs.set(e, coeffs[e]+1); |
235 for (typename Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) |
241 for (typename Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) |
242 //std::cout << " edge:" <<g.id(e)<<" "<<coeffs[e]; |
248 //std::cout << " edge:" <<g.id(e)<<" "<<coeffs[e]; |
243 row.push_back(std::make_pair(edge_index_map[e], coeffs[e])); |
249 row.push_back(std::make_pair(edge_index_map[e], coeffs[e])); |
244 } |
250 } |
245 } |
251 } |
246 //std::cout << std::endl; |
252 //std::cout << std::endl; |
|
253 std::cout << " " << g.id(n) << " " << row.size() << std::endl; |
247 lp.setRowCoeffs(row_it, row.begin(), row.end()); |
254 lp.setRowCoeffs(row_it, row.begin(), row.end()); |
248 lp.setRowBounds(row_it, LPX_FX, 0.0, 0.0); |
255 lp.setRowBounds(row_it, LPX_FX, 0.0, 0.0); |
249 } |
256 } |
250 lp.solveSimplex(); |
257 lp.solveSimplex(); |
251 //std::cout << lp.colNum() << std::endl; |
258 //std::cout << lp.colNum() << std::endl; |