Forum Discussion

FICO's avatar
FICO
Community Manager
4 months ago

MIP solution status

Hello,

I've been using code like this to get the solution status of a MIP:

case getprobstat of

XPRS_OPT: status:="Optimum found"

XPRS_UNF: status:="Unfinished"

XPRS_INF: status:="Infeasible"

XPRS_UNB: status:="Unbounded"

XPRS_OTH: status:="Failed"

else status:="???"

end-case

I just discovered that there are also status codes like XPRS_MIP_INFEAS and other XPRS_MIP_*. Two of them look particularly useful: XPRS_MIP_SOLUTION and XPRS_MIP_NO_SOL_FOUND, since they offer additional information. How can these codes be used? Are they returned by getprobstat too? Are they used together with those in the code snippet above or these should not be mixed?

Thank you,

Miroslav

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    The statuses you mentioned are both mapped to XPRS_UNF.

    XPRS_MIP_* are values for the MIPSTATUS attribute that you can query directly as described here:

    mipstatus := getparam("XPRS_mipstatus")

    This way you can get the more detailed status information that is specific to MIP. The most detailed information you can get by querying attributes SOLVESTATUS and SOLSTATUS. This tells you why Xpress stopped and what kind of solution is available.

  • FICO's avatar
    FICO
    Community Manager

    Here is a piece of Mosel code that captures all values for MIPSTATUS in a similar way as your example:

     case getparam("XPRS_MIPSTATUS") of
       XPRS_MIP_NOT_LOADED: status:="Problem has not been loaded"
       XPRS_MIP_LP_NOT_OPTIMAL: status:="MIP search incomplete - LP not solved, no integer solution"
       XPRS_MIP_LP_OPTIMAL: status:="MIP search incomplete - LP solved, no integer solution"
       XPRS_MIP_NO_SOL_FOUND: status:="MIP search incomplete - no integer solution"
       XPRS_MIP_SOLUTION: status:="MIP search incomplete - integer solution found"
       XPRS_MIP_INFEAS: status:="MIP search complete - no integer solution found"
       XPRS_MIP_OPTIMAL: status:="MIP search complete - integer solution found"
       XPRS_MIP_UNBOUNDED: status:="MIP search incomplete - initial continuous relaxation is unbounded"
       else status:="Unkonwn status value"
     end-case 

    Status information provided through MIPSTATUS, LPSTATUS etc depends on the problem type that is being solved, whereas the more recently introduced generic status values SOLVESTATUS and SOLSTATUS work with all problem types supported by Xpress Solver, similarly to Mosel's 'getprobstat'. Here is another piece of Mosel code to show their possible values and meaning:

     declarations
       SolStat, SolvStat: array(integer) of string    ! Status messages
     end-declarations
     
     SolvStat:: ([XPRS_SOLVESTATUS_UNSTARTED, XPRS_SOLVESTATUS_STOPPED, 
       XPRS_SOLVESTATUS_FAILED, XPRS_SOLVESTATUS_COMPLETED])  
      ["The solve has not been started.", "Optimization has been interrupted.",
       "Optimization has run into a nonrecoverable problem and failed.",
       "Search completed."] 
     
     SolStat:: ([XPRS_SOLSTATUS_NOTFOUND, XPRS_SOLSTATUS_OPTIMAL, 
       XPRS_SOLSTATUS_FEASIBLE, XPRS_SOLSTATUS_INFEASIBLE, XPRS_SOLSTATUS_UNBOUNDED])
      ["No solution available.", "An optimal solution has been found.",
       "A solution that is not proven optimal is found.",
       "No solution exists.", "The problem is unbounded, if feasible."]
     
     writeln("Problem solve status: ", SolvStat(getparam("XPRS_SOLVESTATUS")), 
             " Solution status: ", SolStat(getparam("XPRS_SOLSTATUS")))
  • FICO's avatar
    FICO
    Community Manager

    Susanne and Daniel,

    Thank you for the quick response! This is very helpful.

    Regards,

    Miroslav