Free model after interrupt (ctrl-c)
AnsweredI am using julia, so my question might be more appropriate for the Gurobi.jl folks, but I was hoping to check here first to see if something is possible.
I have an optimization `model` that is currently getting optimized with `GRBoptimize(model)`. Partway through, an exception occurs (in my case, I interrupt the optimizer with ctrl-c). Similar to this post and this post, I would like to free the Gurobi memory with `GRBfreemodel(model)`. I have a try-catch block that should free the model if any exception occurs:
try err=GRBoptimize(model); catch
GRBterminate(model);
err=GRBfreemodel(model); end
but the code runs, I receive an error message coded 10017: OPTIMIZATION_IN_PROGRESS.
My question is: is there any way to halt the optimization and free the model for an "in-progress" optimization model?
Thanks,
Jake
-
Hi Jake,
I am not a Julia expert but I think that the Knowledge Base article How do I terminate Gurobi with SIGKILL? might give you an idea of how to handle the \(\texttt{GRBterminate}\) call properly. The important thing to know is that the terminate call may take a while to process the information and terminate all threads. This is what you need to capture and wait for before freeing the model.
I hope this helps.
Best regards,
Jaromił1 -
Ahh, thank you for pointing out the waiting requirement!
0
Please sign in to leave a comment.
Comments
2 comments