0

I am trying to solve a large MIP scheduling problem. Since it will take a long time to solve the problem, I want to run the same model with fewer event point and find its n-th solution. Use that solution as an initial solution/seed for a bigger(more event points) model to find its n-th solution and use this to cascade up till the desired number of event points.

Using the solution from the small problem, I use its binary values in the mip start and let the newly added event point un touched. I save these values in a dictionary name seed_sol where the key is the binary variable(obtain when creating the varible) and the value is 0/1 from the previous solve.

m.add_mip_start(SolveSolution(m, seed_sol))

Using the above code, I warm start my larger runs. However, when I look at the output log I realised that the solution rarely improves and the gap is very low(I know for a fact that the actual optimal solution is much much higher). I suspect that the 'add_mip_start' function forces the solution values to my initial seed solution and tries to improve the solution by only adjusting the newly added binary variables.

How do i fix this to get the desired outcome?

Using:

  • Python 3.6.8
  • cplex 12.10.0.0
  • docplex 2.19.202
Abilash
  • 95
  • 10

2 Answers2

1

warmstart provides a starting point but will not reduce the search space.

Example at https://github.com/AlexFleischerParis/zoodocplex/blob/master/zoowarmstartapi.py:

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)

What you could try instead is fixed start

Example from https://github.com/AlexFleischerParis/zoodocplex/blob/master/zoofixedstart.py

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)

#Fixed start nbBus40 should be 5
nbbus40.lb=5
nbbus40.ub=5

mdl.solve()


for v in mdl.iter_integer_vars():
    print(v," = ",v.solution_value)
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • What if you solve a model in an iterative manner? In each iteration, you want to use the solution of the most recent iteration as the start point. Therefore, do we need to remove the solutions that are used as warmup in the previous iterations and only add the most recent solution as the start point? If so, how could we remove the older warmup solutions? – mdslt Jul 27 '22 at 14:32
0

The MIP start is used as a starting point, but its start values might be changed in the search, as opposed to a fixed start, where fixed values are considered as hard constraints. BTW, you can also implement fixed starts with constraints, this facilitates adding or removing these fixed starts.

However, the interest of a MIP start resides in the quality of the initial solution. In your case, it seems the initial solution is much smaller than the large problem, so it might not help much.

To assess your MIP performance issues, can you indicate the size of the problem (as printed by Model.print_information())) and also the CPLEX log (at least the part where cplex stalls.)

Philippe Couronne
  • 826
  • 1
  • 5
  • 6