COIN-OR::LEMON - Graph Library

Changeset 587:9db62975c32b in lemon for test


Ignore:
Timestamp:
02/26/09 08:39:16 (15 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Fix newSolver()/cloneSolver() API in LP tools + doc improvements (#230)

  • More logical structure for newSolver()/cloneSolver()
  • Fix compilation problem with gcc-3.3
  • Doc improvements
Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/lp_test.cc

    r485 r587  
    198198    check(const_cast<const LpSolver::Expr&>(e)[p2]==0, buf.str());
    199199
     200    //Test for clone/new
     201    LP* lpnew = lp.newSolver();
     202    LP* lpclone = lp.cloneSolver();
     203    delete lpnew;
     204    delete lpclone;
    200205
    201206  }
     
    248253  if (stat ==  LpSolver::OPTIMAL) {
    249254    std::ostringstream sbuf;
    250     sbuf << "Wrong optimal value: the right optimum is " << exp_opt;
     255    sbuf << "Wrong optimal value (" << lp.primal() <<") with "
     256         << lp.solverName() <<"\n     the right optimum is " << exp_opt;
    251257    check(std::abs(lp.primal()-exp_opt) < 1e-3, sbuf.str());
    252258  }
     
    356362}
    357363
     364template<class LP>
     365void cloneTest()
     366{
     367  //Test for clone/new
     368 
     369  LP* lp = new LP();
     370  LP* lpnew = lp->newSolver();
     371  LP* lpclone = lp->cloneSolver();
     372  delete lp;
     373  delete lpnew;
     374  delete lpclone;
     375}
     376
    358377int main()
    359378{
     
    366385    lpTest(lp_glpk1);
    367386    aTest(lp_glpk2);
     387    cloneTest<GlpkLp>();
    368388  }
    369389#endif
     
    382402#endif
    383403  }
     404    cloneTest<CplexLp>();
    384405#endif
    385406
     
    389410    lpTest(lp_soplex1);
    390411    aTest(lp_soplex2);
     412    cloneTest<SoplexLp>();
    391413  }
    392414#endif
     
    397419    lpTest(lp_clp1);
    398420    aTest(lp_clp2);
     421    cloneTest<ClpLp>();
    399422  }
    400423#endif
  • test/mip_test.cc

    r485 r587  
    107107}
    108108
     109template<class MIP>
     110void cloneTest()
     111{
     112 
     113  MIP* mip = new MIP();
     114  MIP* mipnew = mip->newSolver();
     115  MIP* mipclone = mip->cloneSolver();
     116  delete mip;
     117  delete mipnew;
     118  delete mipclone;
     119}
    109120
    110121int main()
     
    115126    GlpkMip mip1;
    116127    aTest(mip1);
     128    cloneTest<GlpkMip>();
    117129  }
    118130#endif
     
    130142#endif
    131143  }
     144  cloneTest<CplexMip>();
    132145#endif
    133146
Note: See TracChangeset for help on using the changeset viewer.