• Gurobi Staff

Hi Ozgur,

Could you elaborate on how and where Gurobi "gets stuck"? Does the execution of your code not proceed beyond the optimize() call? Are you using any callbacks in your code?

Thanks,
Matthias

Hi Matthias,

In my code, I have a time limit of 200 seconds and before the optimize() call, I print 'before optimization'. And after the optimize() call, I print 'after optimization'. These 3 consecutive lines of code is below:

model.Params.timeLimit = 200.0
print('before optimization')
model.optimize()
print('after optimization')

When the time limit of 200 seconds has reached, I receive the best found solution and the gap% as you can see below in the output . After the execution of optimize() call, I would expect the code to proceed to the next line and print 'after optimization', but this never happens. It continues running without any output for several hours until I cancel the job or it is cancelled automatically by the Slurm system because of the time limit. The code doesn't give any errors until I or the Slurm system cancel the execution.

Thank you

Ozgur

• Gurobi Staff

Hi Ozgur,

That is odd, what happens if you run this locally on your machine? The log indicates that Gurobi finished the optimization, I have no idea why it is not returning. Do you run any kind of multi-processing, is this the only model that is solved or is anything running in parallel? Also, can you monitor the machine resources while this phase where it hangs?

Another test you could to is to write out an MPS file using

model.write("mymodel.mps")

before you call optimize(). And then try to run it again using the Gurobi command line gurobi_cl.

Best,

Sonja

I have the same problem! And I run on a distributed computing environment. I have one head node and 8 worker nodes. The head node basically distributes the workers and does a synchronization while the worker nodes run Gurobi instances in parallel and report the results to the head node. The whole program is written in Python.

The program runs quite fine until one Gurobi instance comes across a problem unable to be solved within the given time period. And then it gets stuck and the head node waits indefinitely for a response from the worker.

Time limit reachedBest objective 5.705811978590e+10, best bound 5.339642852052e+10, gap 6.4175%

Hello, have you found the solution to your problem? I'm having a similar problem. I'm trying to solve a variant of the vehicle routing problem. I use a callback function to add capacity constraints as lazy constraints. When I set the time limit to e.g. 10 seconds a solution is found after that, but Python is still running and nothing happens after that. I have some additional code that comes after the line with model.optimize(callback) to print and plot the solution but that doesnt happen. When I run the code without the callback function everything works fine. When I use the callback function and Gurobi finds the optimal solution before the time limit everything works fine too.

• Gurobi Staff

Can you post a minimal, self-contained code example that reproduces the issue? It's difficult to say what's going on without examining the code.

Hello, Ive found the issue which was my own fault. The model.cbLazy() that I use were formulated incorrectly. After outputting a solution, the code would get stuck in a while loop. So it was a model issue, not a Gurobi issue. Nonetheless, thanks for the reply.