Method checkSolution() added.
1.1 --- a/src/work/athos/mincostflows.h Thu May 06 15:39:31 2004 +0000
1.2 +++ b/src/work/athos/mincostflows.h Thu May 06 15:47:42 2004 +0000
1.3 @@ -187,13 +187,15 @@
1.4
1.5 //This function checks, whether the given solution is optimal
1.6 //Running after a \c run() should return with true
1.7 + //In this "state of the art" this only check optimality, doesn't bother with feasibility
1.8 bool checkSolution(){
1.9 Length mod_pot;
1.10 Length fl_e;
1.11 FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
1.12 //C^{\Pi}_{i,j}
1.13 - mod_pot = length[e]-potential[G.head(e)]+potential[G.head(e)];
1.14 + mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)];
1.15 fl_e = flow[e];
1.16 + // std::cout << fl_e << std::endl;
1.17 if (0<fl_e && fl_e<capacity[e]){
1.18 if (mod_pot != 0)
1.19 return false;
2.1 --- a/src/work/athos/mincostflows_test.cc Thu May 06 15:39:31 2004 +0000
2.2 +++ b/src/work/athos/mincostflows_test.cc Thu May 06 15:47:42 2004 +0000
2.3 @@ -71,8 +71,12 @@
2.4
2.5 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46");
2.6
2.7 + check(surb_test.checkSolution(), "Is the primal-dual solution pair really optimal?");
2.8 +
2.9 k=1;
2.10 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
2.11 +
2.12 + check(surb_test.checkSolution(), "Is the primal-dual solution pair really optimal?");
2.13
2.14 //cout << surb_test.run(s,t,k) << surb_test.totalLength()<<endl;
2.15 /*