0
votes

I am optimizing a MILP model in CPLEX (Python interface) that takes a long time to solve. Sometimes I need to do concurrent runs if my timelimit runs out. In order to continue optimizing with a solution from a previous, unfinished, run I usually provide the .sol file as a warm start.

Now I have a change in the objective function coefficients. The model's constraints and variables stay the same. Is it possible to provide a solution from the 'old', already optimized model to the model with the revised coefficients? Will CPLEX find the optimal solution of the new model faster than just starting fresh, regardless if it is is in the same 'range' as the old solution? And can I provide the .sol file for this as usual or should I use an .mst file?

On a related note, I am finding that when I use a previous solution as a warm start, CPLEX does use the best integer value found previously but often starts with a higher best bound. So the gap initially is higher than what previously has already been reached. Is there a method to overcome this, possibly speeding up the run?

2
It is normal that the best possible bound is not as good as before. You may want to use the MIP emphasis or cuts option to move that bound quicker. - Erwin Kalvelagen

2 Answers

0
votes

you can warmstart with a .sol file but also with APIS

warm start through API in https://www.linkedin.com/pulse/making-optimization-simple-python-alex-fleischer/

from docplex.mp.model import Model

mdl = Model(name='buses')
nbbus40 = mdl.integer_var(name='nbBus40')
nbbus30 = mdl.integer_var(name='nbBus30')
mdl.add_constraint(nbbus40*40 + nbbus30*30 >= 300, 'kids')
mdl.minimize(nbbus40*500 + nbbus30*400)

warmstart=mdl.new_solution()
warmstart.add_var_value(nbbus40,8)
warmstart.add_var_value(nbbus30,0)
mdl.add_mip_start(warmstart)


sol=mdl.solve(log_output=True)

for v in mdl.iter_integer_vars():
    print(v," = ",v.solution_value)

Sometimes warmstart helps, some times it does not. Fixed start helps too sometimes.(The search space is smaller so the search can be faster)

0
votes

You say you are using ".sol" file as mip start, but there is a dedicated format for mip starts: MST format in ".mst" files. If you are using DOcplex, from a solution produced by Model.solve(), you can export a mst file using export_as_mst, which takes a WriteLevel argument. This enumerated value controls what is written in the MST file: by default, only discrete values are used in the mip start, which avoids precision issues.

This is one of the reasons you should prefer MST format for mip starts.