I am using Pulp with Python to specify an LP problem. I want to solve this using Gurobi. The following does work:
prob.solve(pulp.GUROBI_CMD())
However, now I want to specify a MIP Gap. This should be a parameter of the Gurobi solver according to this page.
What is the syntax to define this parameter (at, say, 0.05)?
Edit: I checked this post, but none of the suggestions works:
Hope anyone can give any suggestions on how to tackle this problem!
I had the issue myself, but none of the proposed solutions worked. Especially since I tried to pass several parameters, I couldn't figure out the syntax from the proposed solutions.
Deriving from the error message that we need tuples, the following worked for me:
prob.solve(pulp.GUROBI_CMD(options=[('MIPGap', '0.004'), ("TimeLimit", "300"), ("MIPFocus", "1")]))
Hope this helps other people with the same error.
Brought to the idea in a previous comment that the syntax of the "options" parameter might by wrong (thanks!), I found that a correct syntax is:
prob.solve(pulp.GUROBI_CMD(options=[("MIPgap", 0.9)]))
This works! Thanks a lot.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.