python-mip
python-mip copied to clipboard
How to resume the MIP solver with a specified solution and not cold restart?
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.
Check if this works for you: https://python-mip.readthedocs.io/en/latest/custom.html#providing-initial-feasible-solutions
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
Strange, it works for me perfectly. 😃
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 !
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
?