coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
531 stars 92 forks source link

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

Open arunpatro opened 4 years ago

arunpatro commented 4 years ago

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.

WitJakuczun commented 4 years ago

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

uurriola commented 4 years ago

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

WitJakuczun commented 4 years ago

Strange, it works for me perfectly. 😃

h-g-s commented 4 years ago

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 !

vncoelho commented 4 years ago

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?