About sensitivity analysis of constraint shadow price

  • 29 March 2019
  • 2 replies

I would like to know how to get the sensitivity analysis of a constraint shadow price.

For example, say we have the following constraint: x+y ≤ c

and its shadow price "SP".

How do I get the relationship between c and SP ? In other words, the sensitivity analysis of SP according to c.

I would appreciate if you can show me how to achieve this in AIMMS. Thank you very much for your assistance!

Best answer by Arthur 29 March 2019, 14:41

View original

2 replies

Userlevel 4
Badge +1
Hi @Paul G.,

AIMMS or CPLEX (or Gurobi) do not have features that directly provide you with the relationship between c and SP (after doing only one solve). The only way to get this information is by solving the model multiple times.

Attached are two projects that calculate the relationship between c and SP.

The first project (stst0020_1) uses a step size to calculate the SP for each c. This project starts with the current value for c, and then substracts a small value (given by the parameter stepsize) and solves the model again. This is repeated until the model becomes infeasible, in which case we can stop the loop because for smaller c the model will remain infeasible.

Next we do another loop in which we start with the original value for c, and this time we add a small value and solve the model. This process is repeated until the constraint is no longer binding (that is, in the solution x + y is strictly smaller than c), in which case we can stop the loop because for all larger c the constraint will not be binding and therefore the shadow price will be 0.

In this first project a set is created with all possible values of c, and the corresponding shadow price is stored in the parameter shadow prices.

The second project (stst0020_2) makes use of the RightHandSideRange property of a constraint. If this property is specified then the solver will calculate a range of right-hand-side values for which the optimal basis does not change, and consequently the shadow price does not change. Note that the current right-hand-side value (c) is always part of this range. The second project uses the ranges to identify intervals of right-hand-side values that have the same shadow price. In this project a set of intervals is created, and for each interval the smallest and largest right-hand-side value is stored (in the parameters interval_lower and interval_upper respectively) and the corresponding shadow prices is stored (in the parameter interval_shadow_price). This second approach is much faster because it does less solves.

Both projects use a different approach to store the relationship between c and SP. I hope that one of these approaches is something you can work with; if not, please let me know what you had in mind.
Hi @Arthur ,

The two solve methods are very helpful, and the examples are very detailed. They solved my problem!

Thank you very much.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator