Changeset 1484:a3484f00a5f0 in lemon-0.x for test
- Timestamp:
- 06/14/05 15:55:28 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1965
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/lp_test.cc
r1475 r1484 40 40 LP::Col p1,p2,p3,p4,p5; 41 41 LP::Constr c; 42 43 p1=lp.addCol(); 44 p2=lp.addCol(); 45 p3=lp.addCol(); 46 p4=lp.addCol(); 47 p5=lp.addCol(); 42 48 43 49 e[p1]=2; … … 200 206 lp.solve(); 201 207 202 208 double opt=122.0/9.0; 209 203 210 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 207 217 } 208 218 else{ … … 212 222 check(lp.primalStatus()==LpSolverBase::OPTIMAL,"Primalstatus should be OPTIMAL"); 213 223 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...)"); 216 226 217 227 … … 225 235 226 236 #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); 230 240 #endif 231 241
Note: See TracChangeset
for help on using the changeset viewer.