COIN-OR::LEMON - Graph Library

Changeset 554:2d27cbaa982d in lemon-0.x


Ignore:
Timestamp:
05/06/04 17:47:42 (20 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@727
Message:

Method checkSolution() added.

Location:
src/work/athos
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/work/athos/mincostflows.h

    r551 r554  
    188188    //This function checks, whether the given solution is optimal
    189189    //Running after a \c run() should return with true
     190    //In this "state of the art" this only check optimality, doesn't bother with feasibility
    190191    bool checkSolution(){
    191192      Length mod_pot;
     
    193194      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
    194195        //C^{\Pi}_{i,j}
    195         mod_pot = length[e]-potential[G.head(e)]+potential[G.head(e)];
     196        mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)];
    196197        fl_e = flow[e];
     198        //      std::cout << fl_e << std::endl;
    197199        if (0<fl_e && fl_e<capacity[e]){
    198200          if (mod_pot != 0)
  • src/work/athos/mincostflows_test.cc

    r551 r554  
    7272  check(  surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46");
    7373
     74  check(surb_test.checkSolution(), "Is the primal-dual solution pair really optimal?");
     75
    7476  k=1;
    7577  check(  surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
     78
     79  check(surb_test.checkSolution(), "Is the primal-dual solution pair really optimal?");
    7680 
    7781  //cout << surb_test.run(s,t,k) << surb_test.totalLength()<<endl;
Note: See TracChangeset for help on using the changeset viewer.