Yes. At least that’s my understanding and what I’ve observed with HiGHS.
EDIT: to be clearer, I analyze my MILP results with code similar to this:
optimize!(model)
if termination_status(model) == TIME_LIMIT
if primal_status(model) == FEASIBLE_POINT
@warn "Time limit with feasible solution" code=termination_status(model) status=raw_status(model)
else
@error "Time limit without any feasible solution" code=termination_status(model) status=raw_status(model)
throw(Infeasible())
end
elseif termination_status(model) != OPTIMAL
@error "JuMP did not solve to optimality" code=termination_status(model) status=raw_status(model)
throw(Infeasible())
end
if JuMP is terminated via timeout will the solution object be set to the best it has found?
It depends on the solver, and whether the solver found a feasible solution before the time limit.
But yes, you can use primal_status(model) to check if it is a FEASIBLE_POINT, and termination_status(model) to check whether the point is OPTIMAL or suboptimal because of a limit like TIME_LIMIT.
Maybe using a callback and storing the solutions in the callback function is the way to go. Don’t know how drastic the performance hit would be.
Link to callback doc: Solver-independent Callbacks · JuMP