HiGHS icon indicating copy to clipboard operation
HiGHS copied to clipboard

LP early termination

Open jajhall opened this issue 5 months ago • 1 comments

Discussed in https://github.com/ERGO-Code/HiGHS/discussions/2472

Originally posted by baharev July 19, 2025 When solving an LP relaxation, I want to terminate the simplex solver early if the objective function reaches a certain threshold, since the node will be cut off anyway. I thought the objective_bound option would do exactly that, but this option seems to have no effect.

How can I achieve early termination?

As a workaround, I could add the objective as an additional constraint and impose the bound that constraint, but it’s not ideal.

Maybe a custom simplex interrupt callback could do it, but that’s also not ideal in Python.

Any help is greatly appreciated.

jajhall avatar Jul 19 '25 23:07 jajhall

I see that objective_bound is only applied in the case of minimizations - as only that was necessary for the HiGHS MIP solver (which minimizes internally) - so this is something for me to add

However, for your example (as a maximizer), the optimal objective value is 8.6363636364. The initial dual objective value is 48, and the next three are 9, 8.8, 8.6923, and then the optimal value of 8.6363636364. Hence an objective bound of 0 is never satisfied.

I've hacked something in, and with an objective_bound value of 8.7, the solver takes only 3 iterations, and returns the status HighsModelStatusk::ObjectiveBound`. There are some sign errors when maximizing.

Note to self: reachedExactObjectiveBound has a cost-saving check_frequency, but the check is not generally performed the first time that objective_bound is satisfied (with the perturbed costs). This should be forced, and then checks performed according to the frequency.

jajhall avatar Jul 19 '25 23:07 jajhall