-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting TimeLimit globally in Gurobi.jl or JuMP.jl #471
Comments
No. Although you might be able to re-use an env = Gurobi.Env()
GRBsetdblparam(env, "TimelImit", 1.0)
for _ in 1:3
model = Model(() -> Gurobi.Optimizer(env)
optimize!(model)
end
Turn off Gurobi logging? |
Thanks. GRBsetdblparam seems to work for TimeLimit globally, but it gives the following warning: "WARNING: redefinition of constant GRB_ENV. This may fail, cause incorrect answers, or produce other errors." And set_silent didn't stop the loop messages. |
That wasn't part of my code. If you copied https://github.com/jump-dev/Gurobi.jl#reusing-the-same-gurobi-environment-for-multiple-solves, then only run
You can also use |
Yes, I already had "const GRB_ENV = Gurobi.Env()" in my code and added "GRBsetdblparam(GRB_ENV, "TimelImit", 1)" after it. I think the warning was because of the "const". After removing it, there's no warning.
This works, and it resolved the original issue. Even with the local settings (TimeLimit set in the model in the loop rather than globally), there are no messages anymore. It seems that setting the OutputFlag to 0 locally in the model only suppresses the MIPgap update reports but setting it to 0 in ENV globally, suppresses all Gurobi messages. |
Yes, I think this was a bug in the upstream Gurobi solver that may get fixed in future.
Great. I'll close this issue then. Please use the community forum if you have other questions, https://discourse.julialang.org/c/domain/opt/13, we try to reserve GitHub issues for bug reports and feature requests. |
Is there a way to set the Gurobi TimeLimit globally in the code, i.e., not for a specific model? I'm solving a MIP in a loop, and each time, Gurobi 9.5.1 displays the message "Set parameter TimeLimit to value ...", which makes reading my code messages and monitoring the execution progress difficult.
The text was updated successfully, but these errors were encountered: