Hi Emre,

Does your python script stop entirely at this point (i.e. without reaching your openpyxl commands which follow the optimize() call)?  If so, the likely cause is that the optimization run is consuming a lot of memory, and your operating system has killed off the process to prevent it affecting any other tasks on your machine.

This would appear to be the case from looking at the logs, which indicate that there >1 million open nodes in the tree at this point:

4188157 1311111 58783.8231 58 10 58781.0000 58852.7228 0.12% 4.9 50s

You could verify whether this is the case by checking the system's memory use using task manager/activity monitor during the run.

There are some suggestions in this post regarding how to avoid this.  I suggest trying points 2 and 3 on that list first.  It may slow down the solve a little, but should prevent the solver from using so much memory.

I just tried points 2-4 in that thread, but they made no difference. I'm not sure memory is the issue, since Task Manager doesn't indicate it and it's very inconsistent to when it happens. It can complete a problem with 84 million nodes, and then stop during the next problem at 4 million nodes.

You are right that the program stops before the sheet.cell lines, since nothing gets written to the spreadsheet.

Hi Emre,

This is strange.  I'll test this on my end to see if I can find the same behaviour.  Just to confirm - you are running Gurobi 9.1.2, on windows, with which version of Python?

You mentioned that the problem is inconsistent - so if you were solving the same problem instance, would it crash at the same/similar point in the solve each time?  If that's the case could you please also try changing the value of the Seed parameter (try, say Seed=1) for the model that is failing?  Sometimes in these inconsistent cases, changing the random seed can be enough to change the solve path and avoid whatever is causing the problem.

I forgot to post another response, but yesterday I tried running Gurobi again with the same parameters as I did in the last post, and it's working fine now. I have no idea what changed, but as of today the problem hasn't resurfaced. Hopefully this sticks. Thank you for your help!

Hi Emre,

Great to hear this is working for you now, thanks for letting us know.

Best regards,
Simon