259 // } |
259 // } |
260 } |
260 } |
261 |
261 |
262 LpCplex::SolutionStatus LpCplex::_getPrimalStatus() |
262 LpCplex::SolutionStatus LpCplex::_getPrimalStatus() |
263 { |
263 { |
|
264 //7.5-os cplex statusai |
|
265 // #define CPX_OPTIMAL 1 |
|
266 // #define CPX_INFEASIBLE 2 |
|
267 // #define CPX_UNBOUNDED 3 |
|
268 // #define CPX_OBJ_LIM 4 |
|
269 // #define CPX_IT_LIM_FEAS 5 |
|
270 // #define CPX_IT_LIM_INFEAS 6 |
|
271 // #define CPX_TIME_LIM_FEAS 7 |
|
272 // #define CPX_TIME_LIM_INFEAS 8 |
|
273 // #define CPX_NUM_BEST_FEAS 9 |
|
274 // #define CPX_NUM_BEST_INFEAS 10 |
|
275 // #define CPX_OPTIMAL_INFEAS 11 |
|
276 // #define CPX_ABORT_FEAS 12 |
|
277 // #define CPX_ABORT_INFEAS 13 |
|
278 // #define CPX_ABORT_DUAL_INFEAS 14 |
|
279 // #define CPX_ABORT_PRIM_INFEAS 15 |
|
280 // #define CPX_ABORT_PRIM_DUAL_INFEAS 16 |
|
281 // #define CPX_ABORT_PRIM_DUAL_FEAS 17 |
|
282 // #define CPX_ABORT_CROSSOVER 18 |
|
283 // #define CPX_INForUNBD 19 |
|
284 // #define CPX_PIVOT 20 |
|
285 |
|
286 // Ezeket hova tegyem: |
|
287 // ??case CPX_ABORT_DUAL_INFEAS |
|
288 // ??case CPX_ABORT_CROSSOVER |
|
289 // ??case CPX_INForUNBD |
|
290 // ??case CPX_PIVOT |
|
291 |
|
292 int stat = CPXgetstat (env, lp); |
|
293 switch (stat) { |
|
294 case 0: |
|
295 return UNDEFINED; //Undefined |
|
296 break; |
|
297 case CPX_OPTIMAL://Optimal |
|
298 return OPTIMAL; |
|
299 break; |
|
300 case CPX_UNBOUNDED://Unbounded |
|
301 return INFINITE; |
|
302 break; |
|
303 case CPX_INFEASIBLE://Infeasible |
|
304 case CPX_IT_LIM_INFEAS: |
|
305 case CPX_TIME_LIM_INFEAS: |
|
306 case CPX_NUM_BEST_INFEAS: |
|
307 case CPX_OPTIMAL_INFEAS: |
|
308 case CPX_ABORT_INFEAS: |
|
309 case CPX_ABORT_PRIM_INFEAS: |
|
310 case CPX_ABORT_PRIM_DUAL_INFEAS: |
|
311 return INFEASIBLE; |
|
312 break; |
|
313 case CPX_OBJ_LIM: |
|
314 case CPX_IT_LIM_FEAS: |
|
315 case CPX_TIME_LIM_FEAS: |
|
316 case CPX_NUM_BEST_FEAS: |
|
317 case CPX_ABORT_FEAS: |
|
318 case CPX_ABORT_PRIM_DUAL_FEAS: |
|
319 return FEASIBLE; |
|
320 break; |
|
321 default: |
|
322 return UNDEFINED; //Everything else comes here |
|
323 //FIXME error |
|
324 } |
|
325 |
|
326 |
|
327 //Nem tudom, hanyas cplex verzio statusai |
264 // CPX_STAT_ABORT_DUAL_OBJ_LIM |
328 // CPX_STAT_ABORT_DUAL_OBJ_LIM |
265 // CPX_STAT_ABORT_IT_LIM |
329 // CPX_STAT_ABORT_IT_LIM |
266 // CPX_STAT_ABORT_OBJ_LIM |
330 // CPX_STAT_ABORT_OBJ_LIM |
267 // CPX_STAT_ABORT_PRIM_OBJ_LIM |
331 // CPX_STAT_ABORT_PRIM_OBJ_LIM |
268 // CPX_STAT_ABORT_TIME_LIM |
332 // CPX_STAT_ABORT_TIME_LIM |
275 // CPX_STAT_OPTIMAL_FACE_UNBOUNDED |
339 // CPX_STAT_OPTIMAL_FACE_UNBOUNDED |
276 // CPX_STAT_OPTIMAL_INFEAS |
340 // CPX_STAT_OPTIMAL_INFEAS |
277 // CPX_STAT_OPTIMAL_RELAXED |
341 // CPX_STAT_OPTIMAL_RELAXED |
278 // CPX_STAT_UNBOUNDED |
342 // CPX_STAT_UNBOUNDED |
279 |
343 |
280 //Unimplemented |
344 // int stat = CPXgetstat (env, lp); |
281 int stat = CPXgetstat (env, lp); |
345 // switch (stat) { |
282 switch (stat) { |
346 // case CPX_STAT_OPTIMAL://Optimal |
283 case CPX_STAT_OPTIMAL://Optimal |
347 // return OPTIMAL; |
284 return OPTIMAL; |
348 // break; |
285 break; |
349 // case CPX_STAT_INFEASIBLE://Infeasible |
286 case CPX_STAT_INFEASIBLE://Infeasible |
350 // return INFEASIBLE; |
287 return INFEASIBLE; |
351 // break; |
288 break; |
352 // case CPX_STAT_UNBOUNDED://Unbounded |
289 case CPX_STAT_UNBOUNDED://Unbounded |
353 // return INFINITE; |
290 return INFINITE; |
354 // break; |
291 break; |
355 // case CPX_STAT_NUM_BEST://Feasible |
292 case CPX_STAT_NUM_BEST://Feasible |
356 // return FEASIBLE; |
293 return FEASIBLE; |
357 // break; |
294 break; |
358 // default: |
295 default: |
359 // return UNDEFINED; //Everything else comes here |
296 return UNDEFINED; //Everything else comes here |
360 // //FIXME error |
297 //FIXME error |
361 // } |
298 } |
362 |
299 } |
363 } |
300 |
364 |
301 LpCplex::Value LpCplex::_getPrimal(int i) |
365 LpCplex::Value LpCplex::_getPrimal(int i) |
302 { |
366 { |
303 Value x; |
367 Value x; |