HiGHS duals for MIPs

I’m testing out the HiGHS optimizer in JuMP, and have found that HiGHS returns duals (they all seem to be 0) for MIPs. All other optimizers that I’ve used return errors when attempting to find duals of MIPs:

ERROR: AssertionError: !(model.last_solved_by_mip)

I guess my question is whether this is an oversight that will be corrected, or if HiGHS will return valid marginal costs at the MIP solution. (Without the need to fix the integer variables and re-solve.)

The reason that this matters (to me) is that I have code that attempts the fix and resolve approach, but only does so if the model didn’t have any valid duals. So my code thinks that HiGHS is returning valid duals, but it is not.

Thanks.

HiGHS does not return duals for MIPs.

You should not query dual(con) without first checking dual_status(model) to see if a dual solution is available.

If a dual solution is not available, for example, because dual_status(model) == NO_SOLUTION, the querying dual(con) is undefined behavior that depends on the solver. It might error, or return a placeholder value like 0.0.

2 Likes

Thanks; I should have probably ‘read the docs’.

I think, at some point, I presumed that the has_duals(m) check was to avoid the code crashing, but I had a try statement for that…

HiGHS is now passing all my tests – or to be more accurate, my code now has a few fewer bugs.

1 Like