Reputation: 3
I have formalized a problem as a mathematical model and implemented the model into Gurobi. I think, it works completely fine and finds the optimal solution.
My code whole code: https://www.dropbox.com/s/48tggpieaoe1zx8/midterm.py?dl=0
However, when I try to get more detailed information for sensitivity analysis some functions such as 'eachVar.RC , eachVar.SAObjLow , eachVar.SAObjUp' don't work. Error: 'AttributeError: Unable to retrieve attribute 'RC''
print('Variable Information Including Sensitivity Information:')
tVars = PrettyTable(['Variable Name', ' Value', 'ReducedCost', '
SensLow', ' SensUp']) #column headers
for eachVar in m.getVars():
tVars.add_row([eachVar.varName,eachVar.x,eachVar.RC,eachVar.SAObjLow,eachVar.SAObjUp])
print(tVars)
Upvotes: 0
Views: 1084
Reputation: 21597
There are integer variables in your model. Sensitivity information like reduced costs(rc) and dual prices (pi) are not available for models with integer variables. This is true for most any mixed integer solver.
Upvotes: 1