# Problems with ranges of shadow cost

**URL:** https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090
**Category:** Support
**Created:** [March 15, 2025, 11:00pm UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090 "2025-03-15T23:00:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dmorill](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/dmorill/32/901_2.png) [@dmorill](https://discuss.ampl.com/u/dmorill)
#### Post date: [March 15, 2025, 11:00pm UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/1 "2025-03-15T23:00:11Z")

</div>

Hello, I have been trying to find the ranges in which the dual prices (shadow prices) are valid. According to the official AMPL manual, the command `[constraint].dual;` can be used, and it works fine. The problem arises when using the command `[constraint].up;` or `[constraint].down;`, as I get the following message:

`Bad suffix .up for x1`

My .run file:

```auto
reset;

model windor.mod;
data windor.dat;

option cplex_options "sensitivity";
option presolve 0;
option solver cplex;

solve;

display z, x;
display r.dual;
#display x.rc;
display r.down, r.up;

```

How can I solve this? What am I doing wrong?

Thanks.

---

<div class="post-metadata">

### Author: ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)
#### Post date: [March 17, 2025, 2:52pm UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/2 "2025-03-17T14:52:10Z")

</div>

When CPLEX was switched to our [new solver interface library](https://mp.ampl.com/), the sensitivity option and suffixes were changed for consistency with other solvers.

To use the old option and suffixes, set `option solver cplexasl;` instead of `option solver cplex;`. This will revert to the older interface library (which does not have all features of the new library, but has all features described in the AMPL book).

If you want to stay with `option solver cplex;` then here are the new sensitivity option and suffixes from the [CPLEX options](https://dev.ampl.com/solvers/cplex/options.html) page:

```auto
alg:sens (sens, solnsens, sensitivity)
      Whether to return suffixes for solution sensitivities, i.e., ranges of
      values for which the optimal basis remains optimal (note that the
      variable and objective values can change):

      0 - No (default)
      1 - Yes: suffixes returned on variables are
      .sensobjlo = smallest objective coefficients
      .sensobj = current objective coefficients
      .sensobjhi = greatest objective coefficients
      .senslblo = smallest variable lower bounds
      .senslbhi = greatest variable lower bounds
      .sensublo = smallest variable upper bounds
      .sensubhi = greatest variable upper bounds;

      suffixes for all constraints are

      .senslblo = smallest constraint lower bounds
      .senslbhi = greatest constraint lower bounds
      .sensublo = smallest constraint upper bounds
      .sensubhi = greatest constraint upper bounds;

      suffixes for one-sided constraints only:

      .sensrhslo = smallest right-hand side values
      .sensrhshi = greatest right-hand side values.

      The suffixes correspond to the AMPL solver model, command 'solexpand'.
      For easiest interpretation, disable AMPL presolve, 'option presolve 0;'

```

Note that you need to specify `sensitivity=1` to get these sensitivity values.

---

<div class="post-metadata">

### Author: ![dmorill](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/dmorill/32/901_2.png) [@dmorill](https://discuss.ampl.com/u/dmorill)
#### Post date: [March 26, 2025, 4:19am UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/3 "2025-03-26T04:19:09Z")

</div>

Thank you for the response. It was very useful.

One doubt more, I wonder if you know what is the meaning of the suffixes?, for example in I suppose that is , the last is but the ?

Best regards,

---

<div class="post-metadata">

### Author: ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)
#### Post date: [March 28, 2025, 7:51pm UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/4 "2025-03-28T19:51:18Z")

</div>

I think part of your message has not come through properly:

> for example in I suppose that is , the last is but the ?

Please explain which suffix (or suffixes) you want an explanation for.

---

<div class="post-metadata">

### Author: ![dmorill](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/dmorill/32/901_2.png) [@dmorill](https://discuss.ampl.com/u/dmorill)
#### Post date: [March 30, 2025, 7:20am UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/5 "2025-03-30T07:20:37Z")

</div>

You are right, let me please give the complete sentence.

One doubt more, I wonder if you know what is the meaning of the suffixes?, for example in `sensublo` I suppose that `sens` is _sensitivity_, the last `lo` is _lower bound_ but what is the `ub`?

Thank you in advance.

---

<div class="post-metadata">

### Author: ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)
#### Post date: [April 2, 2025, 2:42am UTC](https://discuss.ampl.com/t/problems-with-ranges-of-shadow-cost/2090/6 "2025-04-02T02:42:10Z")

</div>

You can consider that each constraint in a linear program is of the form

lb \<= body \<= ub

where lb and ub are constant values computed from the data, and body is a linear expression involving the variables. When the linear program is solved, the solver can return an optimal basis (which determines the optimal solution).

If you change ub by not too much, then then same basis will be optimal (though it might give a different optimal solution). Suffixes sensublo and sensubhi are the lowest and highest values of ub for which the same basis is optimal.

Most constraints have either lb = -Infinity or ub = +Infinity, so that they can also be considered to have the form

body \<= rhs

or

body \>= rhs

where rhs is a constant. In that case, you can instead use suffixes .sensrhslo and .sensrhshi, which are the lowest and highest values of rhs for which the same basis is optimal.

Variables also have lower and upper bounds, so suffixes .sensublo and .sensubhi also make sense when applied to a variable.

(Note that all sensitivity results assume that only one constant is changed, while the rest of the linear program stays the same.)
