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

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:

``````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;
``````
``````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**
``````

1 Like

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.

``````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:

``````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
``````
1 Like