pulp icon indicating copy to clipboard operation
pulp copied to clipboard

Setting `primal_feasibility_tolerance` for `pulp.HiGHS` solving

Open HarrisonWilde opened this issue 2 months ago • 3 comments

What is your question

I am solving a problem via pulp.HiGHS but consistently get a "sub-optimal" solution with the following errors:

ERROR:   MIP solver claims optimality, but with num/max/sum primal(1/2.38419e-06/2.38419e-06) infeasibilities
ERROR:   Setting model status to Solve error

It is only ever a super tiny violation which presumably is some mathematical artefact (I hope?) and so I would rather not false-trigger the switch of model status as I am running a huge grid and programmatically interface with summaries of the results. I tried setting primal_feasibility_tolerance in many ways (found in HiGHS API) but cannot seem to get it to stick; solverParams from the pulp docs doesn't appear to do anything and in fact causes an error if I pass a dict into it.

Any help would be appreciated, might be that I am missing some docs somewhere!

HarrisonWilde avatar Oct 22 '25 14:10 HarrisonWilde

I suspect you have number instability in your model (too many decimals, or too large of a number). Trying rounding values to a reasonable degree (e.g., integers if possible) and see if that solves the issue

pchtsp avatar Oct 22 '25 16:10 pchtsp

I think you are correct, I rescaled the objective using the initial total of one of the components and it has disappeared, thank you!

HarrisonWilde avatar Oct 22 '25 16:10 HarrisonWilde

The issue still stands I think as it does seem impossible to tweak this parameter, but less urgent for me anyway!

HarrisonWilde avatar Oct 22 '25 16:10 HarrisonWilde