# Cant display dual variables values when using solvers highs or cbc

**URL:** https://discuss.ampl.com/t/cant-display-dual-variables-values-when-using-solvers-highs-or-cbc/391
**Category:** Support
**Tags:** solvers
**Created:** [February 22, 2023, 12:12pm UTC](https://discuss.ampl.com/t/cant-display-dual-variables-values-when-using-solvers-highs-or-cbc/391 "2023-02-22T12:12:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![JM\_slat](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/jm_slat/32/177_2.png) [@JM\_slat](https://discuss.ampl.com/u/JM_slat)
#### Post date: [February 22, 2023, 12:12pm UTC](https://discuss.ampl.com/t/cant-display-dual-variables-values-when-using-solvers-highs-or-cbc/391/1 "2023-02-22T12:12:33Z")

</div>

Hi, I have a problem regarding dual variables values obtained when using solvers ‘cbc’ or ‘highs’. Clearly the duals it shows are wrong when using ‘display contraint\_name’, but when using solvers like gurobi, minos, xpress, they show the correct values. Does ‘cbc’ or ‘highs’ able to calculate duals? If so, is there another syntax that I might use for it? ( ‘display constraint\_name.dual’ does not get them right also).

For example if I solve the following problem, I get theses results:

```auto
var x1 >= 0;
var x2>=0;
maximize obj : 2* x1 + 3 * x2;
subject to r1: x1+2*x2 <=5;
subject to r2: 2*x1+x2 <=4;

```

```auto
ampl: option solver gurobi;
ampl: model e2.mod;
ampl: solve;
Gurobi 10.0.0: Gurobi 10.0.0: optimal solution; objective 8
2 simplex iterations
ampl: display r1;
r1 = 1.33333

ampl: reset;
ampl: model e2.mod;
ampl: option solver highs;
ampl: solve;
HiGHS 1.4.0: HiGHS 1.4.0: optimal solution; objective 8
2 simplex iterations
0 barrier iterations
absmipgap=8, relmipgap=inf
ampl: display r1;
r1 = 5

ampl: display r1.dual;
**r1.dual = 5**

```

Thanks in advance.

---

<div class="post-metadata">

### Author: ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)
#### Post date: [February 22, 2023, 5:10pm UTC](https://discuss.ampl.com/t/cant-display-dual-variables-values-when-using-solvers-highs-or-cbc/391/2 "2023-02-22T17:10:09Z")

</div>

Hi @JM_slat,

Thanks for reporting this issue. We have just fixed HiGHS (version 20230222 has just been released) and CBC should be fixed soon but the issue seems trickier there.

```auto
var x1 >= 0;
var x2>=0;
maximize obj : 2* x1 + 3 * x2;
subject to r1: x1+2*x2 <=5;
subject to r2: 2*x1+x2 <=4;

option solver gurobi;
solve;
display r1, r1.dual;

option solver highs;
solve;
display r1, r1.dual;

```

produces the following output now:

```auto
Gurobi 10.0.0: optimal solution; objective 8
2 simplex iterations
r1 = 1.33333
r1.dual = 1.33333

HiGHS 1.4.0: optimal solution; objective 8
0 simplex iterations
0 barrier iterations
absmipgap=8, relmipgap=inf
r1 = 1.33333
r1.dual = 1.33333

```
