Stop Criteria using JuMP with HiGHS when find the first feasible solution

Hello,
I have a MILP problem, which is feasible, and I would like to stop the model run when the solver find the first feasible solution. Is it possible to use a stop criteria like that?
I can only find one about time limit
Thanks!

You can use a Feasibility objective, as described in this section:

something like:

@objective(model, MOI.FEASIBILITY_SENSE, 0)
2 Likes

Hi @grem, welcome to the forum.

You could try setting the mip_max_improving_sols option:
https://ergo-code.github.io/HiGHS/dev/options/definitions/#mip_max_improving_sols

using JuMP, HiGHS
model = Model(HiGHS.Optimizer)
set_attribute(model, "mip_max_improving_sols", 1)
2 Likes

Thank you @odow, it works! The exact syntax is:

using JuMP, HiGHS
model = Model(HiGHS.Optimizer)
set_optimizer_attribute(model, "mip_max_improving_sols", 1)

Thank you for your help @Dan. I don’t understand exactly what is suppose to do this option but it looks that it is going through all solutions to identify the feasible ones. It doesn’t stop at the first feasible one.