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
-
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
Please sign in to leave a comment.
Comments
2 comments