Changeset 1484:a3484f00a5f0 in lemon0.x
 Timestamp:
 06/14/05 15:55:28 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1965
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

lemon/lp_base.h
r1462 r1484 48 48 ///\param n is a floating id 49 49 ///\return the corresponding fix id 50 int fixId(int n) {return cross[n];}50 int fixId(int n) const {return cross[n];} 51 51 ///Convert a fix id to a floating one 52 52 53 53 ///\param n is a fix id 54 54 ///\return the corresponding floating id 55 int floatingId(int n) { return index[n];}55 int floatingId(int n) const { return index[n];} 56 56 ///Add a new floating id. 57 57 
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)<1e3, 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.