diff -r 7e109b222053 -r 6474b8254f24 lemon/lp_cplex.cc --- a/lemon/lp_cplex.cc Wed Aug 02 20:15:22 2006 +0000 +++ b/lemon/lp_cplex.cc Wed Aug 02 20:15:59 2006 +0000 @@ -269,6 +269,24 @@ //CPX_PARAM_LPMETHOD status = CPXlpopt(env, lp); //status = CPXprimopt(env, lp); +#if CPX_VERSION >= 900 + if (status) + { + return UNSOLVED; + } + else + { + switch (CPXgetstat(env, lp)) + { + case CPX_STAT_OPTIMAL: + case CPX_STAT_INFEASIBLE: + case CPX_STAT_UNBOUNDED: + return SOLVED; + default: + return UNSOLVED; + } + } +#else if (status == 0){ //We want to exclude some cases switch (CPXgetstat(env, lp)){ @@ -285,6 +303,7 @@ else{ return UNSOLVED; } +#endif } LpCplex::Value LpCplex::_getPrimal(int i) @@ -380,6 +399,7 @@ // Determines which algorithm is used when CPXlpopt() (or "optimize" in the Interactive Optimizer) is called. Currently the behavior of the "Automatic" setting is that CPLEX simply invokes the dual simplex method, but this capability may be expanded in the future so that CPLEX chooses the method based on problem characteristics //Hulye cplex void statusSwitch(CPXENVptr env,int& stat){ +#if CPX_VERSION < 900 int lpmethod; CPXgetintparam (env,CPX_PARAM_LPMETHOD,&lpmethod); if (lpmethod==2){ @@ -391,12 +411,25 @@ stat=CPX_UNBOUNDED; } } +#endif } LpCplex::SolutionStatus LpCplex::_getPrimalStatus() { - int stat = CPXgetstat(env, lp); +#if CPX_VERSION >= 900 + switch (stat) + { + case CPX_STAT_OPTIMAL: + return OPTIMAL; + case CPX_STAT_UNBOUNDED: + return INFINITE; + case CPX_STAT_INFEASIBLE: + return INFEASIBLE; + default: + return UNDEFINED; + } +#else statusSwitch(env,stat); //CPXgetstat(env, lp); //printf("A primal status: %d, CPX_OPTIMAL=%d \n",stat,CPX_OPTIMAL); @@ -429,7 +462,7 @@ return UNDEFINED; //Everything else comes here //FIXME error } - +#endif } //9.0-as cplex verzio statusai @@ -452,6 +485,17 @@ LpCplex::SolutionStatus LpCplex::_getDualStatus() { int stat = CPXgetstat(env, lp); +#if CPX_VERSION >= 900 + switch (stat) + { + case CPX_STAT_OPTIMAL: + return OPTIMAL; + case CPX_STAT_UNBOUNDED: + return INFEASIBLE; + default: + return UNDEFINED; + } +#else statusSwitch(env,stat); switch (stat) { case 0: @@ -464,11 +508,23 @@ return UNDEFINED; //Everything else comes here //FIXME error } +#endif } LpCplex::ProblemTypes LpCplex::_getProblemType() { int stat = CPXgetstat(env, lp); +#if CPX_VERSION >= 900 + switch (stat) + { + case CPX_STAT_OPTIMAL: + return PRIMAL_DUAL_FEASIBLE; + case CPX_STAT_UNBOUNDED: + return PRIMAL_FEASIBLE_DUAL_INFEASIBLE; + default: + return UNKNOWN; + } +#else switch (stat) { case CPX_OPTIMAL://Optimal return PRIMAL_DUAL_FEASIBLE; @@ -483,6 +539,7 @@ return UNKNOWN; //FIXME error } +#endif } void LpCplex::_setMax()