python-mip icon indicating copy to clipboard operation
python-mip copied to clipboard

How to resume the MIP solver with a specified solution and not cold restart?

Open arunpatro opened this issue 4 years ago • 5 comments

I have a fixed one time compute time of 10 mins.

In the first run, I find a solution but it is not optimal. I save the model using m.write('mymodel.lp'), I have tried with m.write('mymodel.mps') also.

When I reload this model via m.read('mymodel.lp') or m.read('mymodel.mps.mps.gz'), it seems to overwrite the objective value and starts optimizing from start. This is pointless as I want to start from a given solution. I was unable to find any documentation for this.

Everytime I call m.optimize(), it starts from starting, rather than resuming. Can anyone help with resuming the solver rather than restarting it.

arunpatro avatar Apr 15 '20 10:04 arunpatro

Check if this works for you: https://python-mip.readthedocs.io/en/latest/custom.html#providing-initial-feasible-solutions

WitJakuczun avatar Apr 15 '20 17:04 WitJakuczun

MIP models define a "start" attribute to provide an initial solution, as pointed out by WiteJakuczun, however it does not seem to work at the moment, see #44

uurriola avatar Apr 16 '20 17:04 uurriola

Strange, it works for me perfectly. 😃

WitJakuczun avatar Apr 16 '20 18:04 WitJakuczun

Hi @uurriola , the case in #44 seemed to be specific for the case where MIPStart was informed, but if your pull request fix this case, great !

h-g-s avatar Apr 16 '20 19:04 h-g-s

Hi everything, first of all, congratulations for the nice job here, @h-g-s. I wonder to load the .sol or .mst that was exported with write. Is it possible to load previously saved solution and load them on model.start = SolutionsLoaded?

vncoelho avatar Jun 09 '20 21:06 vncoelho