39 Node v3=graph.addNode(); |
39 Node v3=graph.addNode(); |
40 Node v4=graph.addNode(); |
40 Node v4=graph.addNode(); |
41 Node v5=graph.addNode(); |
41 Node v5=graph.addNode(); |
42 Node t=graph.addNode(); |
42 Node t=graph.addNode(); |
43 |
43 |
|
44 ListGraph::NodeMap<int> supply_demand(graph); |
|
45 |
|
46 supply_demand.set(s, 2); |
|
47 supply_demand.set(v1, 3); |
|
48 supply_demand.set(v3, -1); |
|
49 supply_demand.set(t, -4); |
|
50 |
44 Edge s_v1=graph.addEdge(s, v1); |
51 Edge s_v1=graph.addEdge(s, v1); |
45 Edge v1_v2=graph.addEdge(v1, v2); |
52 Edge v1_v2=graph.addEdge(v1, v2); |
46 Edge s_v3=graph.addEdge(s, v3); |
53 Edge s_v3=graph.addEdge(s, v3); |
47 Edge v2_v4=graph.addEdge(v2, v4); |
54 Edge v2_v4=graph.addEdge(v2, v4); |
48 Edge v2_v5=graph.addEdge(v2, v5); |
55 Edge v2_v5=graph.addEdge(v2, v5); |
79 std::cout << "Enhanced capacity scaling algorithm test (for the mincostflow problem)..." << std::endl; |
86 std::cout << "Enhanced capacity scaling algorithm test (for the mincostflow problem)..." << std::endl; |
80 |
87 |
81 MinCostFlow< ListGraph, ListGraph::EdgeMap<int>, ListGraph::NodeMap<int> > |
88 MinCostFlow< ListGraph, ListGraph::EdgeMap<int>, ListGraph::NodeMap<int> > |
82 min_cost_flow_test(graph, cost, supply_demand); |
89 min_cost_flow_test(graph, cost, supply_demand); |
83 |
90 |
84 int k=1; |
91 min_cost_flow_test.run(); |
|
92 //int k=1; |
85 |
93 |
86 /* |
94 /* |
87 check( min_cost_flow_test.run(s,t,k) == 1 && min_cost_flow_test.totalLength() == 19,"One path, total cost should be 19"); |
95 check( min_cost_flow_test.run(s,t,k) == 1 && min_cost_flow_test.totalLength() == 19,"One path, total cost should be 19"); |
88 |
96 |
89 check(min_cost_flow_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); |
97 check(min_cost_flow_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); |