# Pyomo sensitivity report access

I have been learning pyomo with glpk for a week now and I would like to know if pyomo team has developed a way to access "allowable increase" and "allowable decrease" values of the objective function coefficients in my model? Perhaps also the reduced costs?

Also would like to know if there is a way to access the entire sensitivity report in one shot?

Here is a simple example of how one can access the suffix needed for printing the dual information of the constraints and also the reduced cost of the variables:

model = ConcreteModel()

model.dual = Suffix(direction=Suffix.IMPORT)
model.rc = Suffix(direction=Suffix.IMPORT)

# declare decision variables
model.x = Var(domain=NonNegativeReals)
model.y = Var(domain=NonNegativeReals)

# declare objective
model.profit = Objective(
expr = 40*model.x + 30*model.y,
sense = maximize)

# declare constraints
model.demand = Constraint(expr = model.x <= 40)
model.laborA = Constraint(expr = model.x + model.y <= 80)
model.laborB = Constraint(expr = 2*model.x + model.y <= 100)

# solve
SolverFactory('cbc').solve(model)

print()
model.x.pprint()

print("\nSolution")
print(f"x = {model.x()}")
print(f"y = {model.y()}")

print("\nSensitivity Analysis for constraints")
print(f"y_demand = {-model.dual[model.demand]}")
print(f"y_laborA = {-model.dual[model.laborA]}")
print(f"y_laborB = {-model.dual[model.laborB]}")

print()
str = "{0:7.2f} {1:7.2f} {2:7.2f} {3:7.2f}"
print("Constraint value lslack uslack dual")
for c in [model.demand, model.laborA, model.laborB]:
print(c, str.format(c(), c.lslack(), c.uslack(), model.dual[c]))

print("\nSensitivity Analysis for variables")
print(f"x = {model.rc[model.x]}")
print(f"x = {model.rc[model.y]}")


and the results would be:

x : Size=1, Index=None
Key  : Lower : Value : Upper : Fixed : Stale : Domain
None :     0 :  20.0 :  None : False : False : NonNegativeReals

Solution
x = 20.0
y = 60.0

Sensitivity Analysis for constraints
y_demand = 0.0
y_laborA = -20.0
y_laborB = -10.0

Constraint value lslack uslack dual
demand   20.00     inf   20.00   -0.00
laborA   80.00     inf    0.00   20.00
laborB  100.00     inf    0.00   10.00

Sensitivity Analysis for variables
x = 0.0
x = 0.0