We revisit the elementary "WYNDOR GLASS CO." example and show

We start as in the previous examples and set up the primal problem.

We need to tell Pyomo that is should import dual variable values provided by the solver:

Now we solve the problem and access the results as usual.

Now suppose we can increase the production capacity at either one of the three plants by one unit. Which one should we choose in order to increase the profit the most?

Answer: The shadow price associated to the second constraint (plant 2) is the highest, so we should choose this one. Increasing the b_2 from 12 to 13 will increase the profit from 36 to 37.5. (Check this directly by changing the code above.)


Next, let us solve the explicit dual, which we set up in the usual way.

These are the values of the dual variables:

And this is the dual cost function. We see clearly that dual cost equals primal profit!

We can also ask the solver for the primal problem for dual variables ("shadow prices"). Note that there is one dual variable per constraint, so the dual variables are indexed by their corresponding constraint.

And we can ask for the dual variables of the dual problem:

The dual of the dual is the primal problem!