Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Callable Library solution status

    Posted 09/29/15 09:43 PM

    Originally posted by: glebB


    I try to figure out a reliable way to query solution status in C. There are many status flags for different outcomes and their documentation is skinny. And I know that has been changing between CPLEX versions. Is there a sustainable way to query the result states (OPT, FEAS, INFEAS, UNBND, INForUNBND, UNKNOWN, ERROR), similar to IloAlgorithm? At the moment I use the following switch and not sure if it's correct:

       /* Converting the status. */
       switch(cplexStatus) {
         case CPXMIP_OPTIMAL:
         case CPXMIP_OPTIMAL_TOL:
           s = Status::OPT;
           break;
         case CPXMIP_INFEASIBLE:
    //      case CPXMIP_OPTIMAL_INFEAS:
         case CPXMIP_INForUNBD:
           s = Status::UNSAT;
           break;
         case CPXMIP_SOL_LIM:
         case CPXMIP_NODE_LIM_FEAS:
         case CPXMIP_TIME_LIM_FEAS:
         case CPXMIP_FAIL_FEAS:
         case CPXMIP_MEM_LIM_FEAS:
         case CPXMIP_ABORT_FEAS:
         case CPXMIP_FAIL_FEAS_NO_TREE:
           s = Status::SAT;
           break;
         case CPXMIP_UNBOUNDED:
         case CPXMIP_ABORT_RELAXATION_UNBOUNDED:
           s = Status::UNBND;
           break;
         case CPXMIP_ABORT_INFEAS:
         case CPXMIP_FAIL_INFEAS:
           s = Status::ERROR;
           break;
         default:
           s = Status::UNKNOWN;
       }

     

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Callable Library solution status

    Posted 10/15/15 08:51 AM

    What may help is the CPXsolninfo() function. This gives you a quick way to assess whether the problem was found primal/dual feasible and what type of solution is available. Other than that, I don't see anything better than enumerating the CPLEX status values.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Callable Library solution status

    Posted 10/15/15 07:35 PM

    Originally posted by: glebB


    Currently doing as follows, using CPXgetsolnpoolnumsolns():
     

       /* Converting the status. */
       switch(cplexStatus) {
         case CPXMIP_OPTIMAL:
           s = Status::OPT;
           wrap_assert(CPXgetsolnpoolnumsolns(env, lp), "Optimality reported but pool empty?", false);
           break;
         case CPXMIP_INFEASIBLE:
           s = Status::UNSAT;
           break;
    //      case CPXMIP_OPTIMAL_INFEAS:
         case CPXMIP_INForUNBD:
           s = Status::UNSATorUNBND;
           break;
         case CPXMIP_SOL_LIM:
         case CPXMIP_NODE_LIM_FEAS:
         case CPXMIP_TIME_LIM_FEAS:
         case CPXMIP_FAIL_FEAS:
         case CPXMIP_MEM_LIM_FEAS:
         case CPXMIP_ABORT_FEAS:
         case CPXMIP_FAIL_FEAS_NO_TREE:
           s = Status::SAT;
           wrap_assert(CPXgetsolnpoolnumsolns(env, lp), "Feasibility reported but pool empty?", false);
           break;
         case CPXMIP_UNBOUNDED:
           s = Status::UNBND;
           break;
    //     case CPXMIP_ABORT_INFEAS:
         case CPXMIP_FAIL_INFEAS:
           s = Status::ERROR;
           break;
         default:
    //      case CPXMIP_OPTIMAL_TOL:
    //      case CPXMIP_ABORT_RELAXATION_UNBOUNDED:
           if (CPXgetsolnpoolnumsolns (env, lp))
             s = Status::SAT;
           else
            s = Status::UNKNOWN;
       }

     

    Another question, is there any primal bound? Sometimes it is possible to obtain such a bound even without having any primal solution.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Callable Library solution status

    Posted 10/19/15 01:30 AM

    CPLEX does not compute a primal bound unless the model has proven to be feasible (i.e., there is an incumbent solution). It does that because the presence of a primal bound would suggest feasibility and that was not proven yet. If you know a primal bound and want CPLEX to use this to cut off nodes then you can tell this bound to CPLEX via parameters CPX_PARAM_CUTLO or CPX_PARAM_CUTUP.


    #CPLEXOptimizers
    #DecisionOptimization