Checking new RHS in multiple Scenarios
AnsweredI am using the multiple scenario Gurobi model in Python where in one of the scenarios I changed the RHS by:
constr.ScenNRHS = new_RHS
Now I would like to see whether this change has been successfully made, so I wrote:
print(constr.ScenNRHS)
to see the updated RHS, but got the following error message:
File "src/gurobipy/constr.pxi", line 67, in gurobipy.Constr.__getattr__
File "src/gurobipy/constr.pxi", line 95, in gurobipy.Constr.getAttr
File "src/gurobipy/attrutil.pxi", line 100, in gurobipy.__getattr
AttributeError: Value of parameter ScenarioNumber is larger than the number of scenarios.
I was wondering if this is the correct way to check the new RHS?
0
-
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. -
I think you need to call a model update before printing the attribute.
Model modifications (bound changes, right-hand side changes, objective changes, etc.) are placed in a queue and are applied to the model when calling
update,optimize, orwrite.After that they are accessible.0 -
That makes sense. Thank you.
0
Post is closed for comments.
Comments
3 comments