# Derivative of variable with respect to constraint?

**URL:** <https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [January 27, 2017, 10:57pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733 "2017-01-27T22:57:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [January 27, 2017, 10:57pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/1 "2017-01-27T22:57:24Z")

</div>

I have a Linear Programming problem that I am modeling using JuMP. If I understand correctly, `JuMP.getdual(cons)` evaluated on a constrain gives the rate of change of the objective if the RHS of the constrain is slightly increased.

I would like to evaluate the derivative of a variable with respect to a constraint (assuming that the optimal solution is unique). Is there a facility in JuMP to do this?

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 5, 2017, 10:38pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/2 "2017-02-05T22:38:39Z")

</div>

Not that I’m aware of. You’ll have to derive this from basic LP sensitivity analysis.

---

<div class="post-metadata">

**Author:** ![jorgeiv500](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jorgeiv500](https://discourse.julialang.org/u/jorgeiv500)\
**Post date:** [May 10, 2017, 3:40pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/3 "2017-05-10T15:40:37Z")

</div>

Take a look to juliaopt notebooks, there´s a sensitivity analisis notebook that emulates the excel solver sensitivity report. But you will need the Gurobi solver for evaluate the RHS changes. With solvers like Cbc and Clp you only can get the shadow prices and the reduced costs. If you need the allowable increase or decrease for RHS and variables, you can get it with Gurobi. I’m trying to get it with “coin or solvers” but still can’t right now.

---

<div class="post-metadata">

**Author:** ![adowling2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adowling2/32/539_2.png) [@adowling2](https://discourse.julialang.org/u/adowling2)\
**Post date:** [May 10, 2017, 4:12pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/4 "2017-05-10T16:12:25Z")

</div>

sIPOPT has support for sensitivity analysis calculations. Although this would be overkill for your problem (as it is a NLP solver), it might be helpful now or in the future.

[https://projects.coin-or.org/Ipopt/wiki/sIpopt](https://projects.coin-or.org/Ipopt/wiki/sIpopt)

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 10, 2017, 4:32pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/5 "2017-05-10T16:32:25Z")

</div>

Where can I find the “juliaopt notebooks”?

---

<div class="post-metadata">

**Author:** ![jorgeiv500](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jorgeiv500](https://discourse.julialang.org/u/jorgeiv500)\
**Post date:** [May 10, 2017, 4:34pm UTC](https://discourse.julialang.org/t/derivative-of-variable-with-respect-to-constraint/1733/6 "2017-05-10T16:34:26Z")

</div>

> [@adowling2](#):
>
> sIPOPT

> <https://github.com/JuliaOpt/juliaopt-notebooks/blob/master/notebooks/JuMP-SensitivityAnalysis.ipynb>
