Code Hangs with Timeout Error in R when Calling Gurobi through Python API using reticulate
ユーザーの入力を待っています。Hello,
I am calling Gurobi using the Python API from R using the reticulate package. In R, I have wrapped my Python call in outer functions as I perform a series of computations. However, I want to skip over certain groups of computations if they collectively take too long (say over 600 seconds). So, I am using the base::withTimeout function in R, wrapped in the try function to deal with the timeout errors and skip them.
However, occasionally, the program will not properly timeout a computation and properly handle the typical timeout error. Instead, I will get an unusual error that prints to the console (which should not happen with the try function). But unlike a typical R error, it does not terminate the code. Instead, it will hang, sometimes for a minute or two, but other times for hours (substantially longer than the typical 100-second Gurobi TimeLim parameter I typically set). I am not sure why it does this. The error is:
`Error in .Call(`_reticulate_py_call_impl`, x, args, keywords) : reached elapsed time limit`
If I set the Gurobi time limit to 1 second, it does not cause this error anymore. As far as I can gather, I only get this error if the function attempts to time out when Gurobi is in the middle of solving a model. This is likely a problem with how R interacts with calling a Gurobi-containing Python function using reticulate (rather than a problem with Gurobi itself). However, I hoped anyone would know how to stop the code from hanging. Even just skipping the current pass of the loop would be great.
-
正式なコメント
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,
Have you considered using the Gurobi R package?
Cheers,
David0
投稿コメントは受け付けていません。
コメント
2件のコメント