COIN-OR::LEMON - Graph Library

Changeset 1484:a3484f00a5f0 in lemon-0.x for test


Ignore:
Timestamp:
06/14/05 15:55:28 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1965
Message:
  • lp_test is made working.
  • some more 'const' for those who like them..
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/lp_test.cc

    r1475 r1484  
    4040    LP::Col p1,p2,p3,p4,p5;
    4141    LP::Constr c;
     42   
     43    p1=lp.addCol();
     44    p2=lp.addCol();
     45    p3=lp.addCol();
     46    p4=lp.addCol();
     47    p5=lp.addCol();
    4248   
    4349    e[p1]=2;
     
    200206  lp.solve();
    201207
    202 
     208  double opt=122.0/9.0;
     209 
    203210  if (lp.primalStatus()==LpSolverBase::OPTIMAL){
    204     printf("Z = %g; x1 = %g; x2 = %g\n",
    205            lp.primalValue(),
    206            lp.primal(x1), lp.primal(x2));
     211    std::cout<< "Z = "<<lp.primalValue()
     212             << " (error = " << lp.primalValue()-opt
     213             << "); x1 = "<<lp.primal(x1)
     214             << "; x2 = "<<lp.primal(x2)
     215             <<std::endl;
     216   
    207217  }
    208218  else{
     
    212222  check(lp.primalStatus()==LpSolverBase::OPTIMAL,"Primalstatus should be OPTIMAL");
    213223
    214   double opt=123/9;
    215   check(lp.primalValue()==opt,"The optimum value is 122/9");
     224  check(std::abs(lp.primalValue()-opt)<1e-3,
     225        "Wrong optimal value: the right optimum is 122/9 (13.555555...)");
    216226
    217227
     
    225235
    226236#ifdef HAVE_GLPK
    227   LpGlpk lp_glpk;
    228   lpTest(lp_glpk);
    229   aTest(lp_glpk);
     237  LpGlpk lp_glpk1,lp_glpk2;
     238  lpTest(lp_glpk1);
     239  aTest(lp_glpk2);
    230240#endif
    231241
Note: See TracChangeset for help on using the changeset viewer.