Changeset 1298:d1ca90316b59 in lemon0.x
 Timestamp:
 04/04/05 16:45:23 (18 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1733
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/athos/lp/lp_glpk.cc
r1294 r1298 189 189 } 190 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 191 void LpGlpk::_setRowUpperBound(int i, Value up) 192 { 193 if (up==INF) { 194 //FIXME error 195 } 196 int b=lpx_get_row_type(lp, i); 197 double lo=lpx_get_row_lb(lp, i); 198 if (up==INF) { 199 switch (b) { 200 case LPX_FR: 201 case LPX_LO: 202 break; 203 case LPX_UP: 204 lpx_set_row_bnds(lp, i, LPX_FR, lo, up); 205 break; 206 case LPX_DB: 207 case LPX_FX: 208 lpx_set_row_bnds(lp, i, LPX_LO, lo, up); 209 break; 210 default: ; 211 //FIXME error 212 } 213 } else { 214 switch (b) { 215 case LPX_FR: 216 lpx_set_row_bnds(lp, i, LPX_UP, lo, up); 217 break; 218 case LPX_UP: 219 lpx_set_row_bnds(lp, i, LPX_UP, lo, up); 220 break; 221 case LPX_LO: 222 case LPX_DB: 223 case LPX_FX: 224 if (lo==up) 225 lpx_set_row_bnds(lp, i, LPX_FX, lo, up); 226 else 227 lpx_set_row_bnds(lp, i, LPX_DB, lo, up); 228 break; 229 default: ; 230 //FIXME error 231 } 232 } 233 } 234 235 void LpGlpk::_setObjCoeff(int i, Value obj_coef) 236 { 237 lpx_set_obj_coef(lp, i, obj_coef); 238 } 239 239 240 240 241 241 LpGlpk::SolutionStatus LpGlpk::_solve() 242 242 { 243 return SOLVED; 243 int i= lpx_simplex(lp); 244 switch (i) { 245 case LPX_E_OK: 246 return SOLVED; 247 break; 248 default: 249 return UNSOLVED; 250 } 244 251 } 245 252 246 253 LpGlpk::Value LpGlpk::_getPrimal(int i) 247 254 { 248 return 0; 249 } 250 255 return lpx_get_col_prim(lp,i); 256 } 257 258 251 259 LpGlpk::SolutionType LpGlpk::_getPrimalType() 252 260 { 253 return OPTIMAL; 254 } 255 261 int stat= lpx_get_status(lp); 262 switch (stat) { 263 case LPX_UNDEF://Undefined (no solve has been run yet) 264 return UNDEFINED; 265 break; 266 case LPX_NOFEAS://There is no feasible solution (primal, I guess) 267 case LPX_INFEAS://Infeasible 268 return INFEASIBLE; 269 break; 270 case LPX_UNBND://Unbounded 271 return INFINITE; 272 break; 273 case LPX_FEAS://Feasible 274 2 return FEASIBLE; 275 break; 276 case LPX_OPT://Feasible 277 return OPTIMAL; 278 break; 279 default: ; 280 //FIXME error 281 } 282 } 256 283 257 284
Note: See TracChangeset
for help on using the changeset viewer.