Free model after interrupt (ctrl-c)
回答済みI 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
-
正式なコメント
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
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
投稿コメントは受け付けていません。
コメント
3件のコメント