RHS Value
Awaiting user inputHello,
I get the RHS value of constraints with:
for c in model.getConstrs():
c.rhs
However, for the RHS values less than 0.05, c.rhs gives 0. I would like to know whether it is possible to obtain the exact value of RHS in any case.
Thank you for your help.
-
Official comment
This post is more than three 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. -
The RHS attribute should capture the exact value of the constraint's right-hand side. Note that Gurobi moves all constants in the constraint over to the right-hand side:
>>> c = m.addConstr(x + 0.03125 <= 0.0625)
>>> m.update()
>>> c.RHS
0.03125Alternatively, is it possible the printed RHS values are formatted to show only one decimal place?
If neither of those suggestions help, can you please post a few lines of self-contained code that reproduce the behavior you're seeing? It would also be helpful to know where you are running the code (in an interactive shell, Jupyter notebook, IDE, etc.).
0
Post is closed for comments.
Comments
2 comments