@@ -63,7 +63,7 @@ function SolFileResults(
6363end
6464
6565function MOI. get (sol:: SolFileResults , :: MOI.ResultCount )
66- return MOI . get (sol, MOI . PrimalStatus ()) == MOI . FEASIBLE_POINT ? 1 : 0
66+ return isempty (sol. variable_primal) ? 0 : 1
6767end
6868
6969function MOI. get (sol:: SolFileResults , :: MOI.RawStatusString )
@@ -206,6 +206,15 @@ For the primal status, assume a solution is present. Other code is responsible
206206for returning `MOI.NO_SOLUTION` if no primal solution is present.
207207"""
208208function _interpret_status (solve_result_num:: Int , raw_status_string:: String )
209+ message = lowercase (raw_status_string)
210+ # Handle some status strings that are, in most cases, solver-specific.
211+ if occursin (" time limit, feasible solution" , message)
212+ return MOI. TIME_LIMIT, MOI. FEASIBLE_POINT
213+ end
214+ # No handle the solve status codes. These are solver-specific, although they
215+ # should be grouped into XYZ codes, where the first digit is a generic
216+ # group (optimal, infeasible, limit, etc), and the YZ are solver-specific
217+ # codes with more meaning.
209218 if 0 <= solve_result_num < 100
210219 # Solved, and nothing went wrong. Even though we say `LOCALLY_SOLVED`,
211220 # some solvers like SHOT use this status to represent problems that are
@@ -224,10 +233,7 @@ function _interpret_status(solve_result_num::Int, raw_status_string::String)
224233 elseif 500 <= solve_result_num < 600
225234 return MOI. OTHER_ERROR, MOI. UNKNOWN_RESULT_STATUS
226235 end
227- # If we didn't get a valid solve_result_num, try to get the status from the
228- # solve_message string. Some solvers (e.g. SCIP) don't ever print the
229- # suffixes so we need this.
230- message = lowercase (raw_status_string)
236+ # If all else fails, attempt to infer the status from `raw_status_string`.
231237 if occursin (" optimal" , message)
232238 return MOI. LOCALLY_SOLVED, MOI. FEASIBLE_POINT
233239 elseif occursin (" infeasible" , message)
0 commit comments