why using gurobi solver in loop could cause increase the optimisation time.
Answeredi was solving a optimisation problem based on sequential case. I have run the model for 24 times (24 time steps in my model and I have to obtain the optimal solution for each time step). Previously I just manually did that, e.g., run the model at one timestep and obtain the results, then move to the next stop. Now I believe my model is fine and add a loop to do it automatically.
Everything looks okay, but the solution time seems increased and it gave me something like this:
MIP start from previous solve produced solution with objective -4442.69 (148.07s)
MIP start from previous solve produced solution with objective -6599.13 (189.22s)
Looking forward to your significant answer
-
Could you please provide more information about how exactly you execute the loop and what you did before. A small code example would be best, cf. minimal reproducible example. In particular what do you change in the loop, i.e., how do you modify your model(s) at each iteration. Without the additional information, one could only start guessing what might have gone wrong.
0 -
Many thanks for the reply.
I have went through some documents which mentioned, the reason might be the MIP. By using an automated solve loop, this may cause Gurobi to reuse older heuristic solutions, leading to increased solve time.
So it would be excellent if the model can be reset to the initial status after each running. But I have no idea how to implement this.
0 -
Hi Cass,
Model.reset() sounds like what you are looking for.- Riley
0 -
Hi, Riley, many thanks for this. It indeed solved my trouble. I put it in the wrong location before and that was why I got some issues.
Best
0
Please sign in to leave a comment.
Comments
4 comments