I’d like to know how it’s possible to obtain the lagrange multipliers from an optimal solution in a Concrete model solved with glpk?
Thanks!
Advertisement
Answer
This works for me in gurobi
, try it out and tell me if it works with glpk
.
You need to prompt getting the Lagrange multipliers / dual variable in pyomo by putting the following line somewhere before solving your model:
JavaScript
x
2
1
model.dual = Suffix(direction=Suffix.IMPORT)
2
And then after solving the model, you can get the dual variable for all your constraints by:
JavaScript
1
2
1
model.dual.pprint()
2