Changeset 1473:876c7b7f4dae in lemon-0.x
- Timestamp:
- 06/10/05 14:50:43 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1953
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_cplex.cc
r1460 r1473 392 392 //FIXME error 393 393 } 394 395 394 } 395 396 396 LpCplex::ProblemTypes LpCplex::_getProblemType() 397 397 { … … 411 411 //FIXME error 412 412 } 413 413 } 414 414 415 415 void LpCplex::_setMax() -
lemon/lp_glpk.cc
r1466 r1473 22 22 23 23 #include <lemon/lp_glpk.h> 24 24 //#include <iostream> 25 25 namespace lemon { 26 26 … … 440 440 LpGlpk::SolutionStatus LpGlpk::_getDualStatus() 441 441 { 442 // std::cout<<"Itt megy: "<<lpx_get_dual_stat(lp)<<std::endl; 443 // std::cout<<"Itt a primal: "<<lpx_get_prim_stat(lp)<<std::endl; 444 442 445 switch (lpx_get_dual_stat(lp)) { 443 446 case LPX_D_UNDEF://Undefined (no solve has been run yet) … … 446 449 // case LPX_D_INFEAS://Infeasible 447 450 return INFEASIBLE; 448 case LPX_ FEAS://Feasible449 switch (lpx_get_ prim_stat(lp)) {450 case LPX_ P_NOFEAS:451 case LPX_D_FEAS://Feasible 452 switch (lpx_get_status(lp)) { 453 case LPX_NOFEAS: 451 454 return INFINITE; 452 455 case LPX_OPT: -
test/lp_test.cc
r1445 r1473 1 1 #include<lemon/lp_skeleton.h> 2 #include "test_tools.h" 2 3 3 4 #ifdef HAVE_CONFIG_H … … 171 172 } 172 173 174 void aTest(LpSolverBase & lp) 175 { 176 typedef LpSolverBase LP; 177 178 //The following example is taken from the book by Gáspár and Temesi, page 39. 179 180 typedef LpSolverBase::Row Row; 181 typedef LpSolverBase::Col Col; 182 183 184 Col x1 = lp.addCol(); 185 Col x2 = lp.addCol(); 186 187 188 //Constraints 189 lp.addRow(3*x1+2*x2 >=6); 190 lp.addRow(-1*x1+x2<=4); 191 lp.addRow(5*x1+8*x2<=40); 192 lp.addRow(x1-2*x2<=4); 193 //Nonnegativity of the variables 194 lp.colLowerBound(x1, 0); 195 lp.colLowerBound(x2, 0); 196 //Objective function 197 lp.setObj(2*x1+x2); 198 199 lp.max(); 200 lp.solve(); 201 202 203 if (lp.primalStatus()==LpSolverBase::OPTIMAL){ 204 printf("Z = %g; x1 = %g; x2 = %g\n", 205 lp.primalValue(), 206 lp.primal(x1), lp.primal(x2)); 207 } 208 else{ 209 std::cout<<"Optimal solution not found!"<<std::endl; 210 } 211 212 check(lp.primalStatus()==LpSolverBase::OPTIMAL,"Primalstatus should be OPTIMAL"); 213 214 double opt=123/9; 215 check(lp.primalValue()==opt,"The optimum value is 122/9"); 216 217 218 } 219 220 173 221 int main() 174 222 { … … 179 227 LpGlpk lp_glpk; 180 228 lpTest(lp_glpk); 229 aTest(lp_glpk); 181 230 #endif 182 231 183 232 #ifdef HAVE_CPLEX 184 //LpCplex lp_cplex;185 //lpTest(lp_cplex);233 LpCplex lp_cplex; 234 lpTest(lp_cplex); 186 235 #endif 187 236
Note: See TracChangeset
for help on using the changeset viewer.