Re: [Gurobi] Gurobi vs CPLEX, no dual variables returned

484 views
Skip to first unread message

Onur Uzunlar

unread,
May 14, 2013, 1:25:09 PM5/14/13
to gur...@googlegroups.com
Hi,

1.99999 means 2 and similarly 15.9999 means 16. It is all about the tolerances. You get the dual variables when you solve pure LP however your model includes binary variables which means no dual variables...

Sent from my iPhone

On May 14, 2013, at 12:59 PM, "Angelos Vassiliou" <brave.fr...@gmail.com> wrote:

Hello all,

I just started using AMPL, Gurobi and CPLEX yesterday.
I wrote the following model:

set LINKS = 1 .. 4 ;

param g{j in LINKS} >=0 ;

var b {LINKS} >=0 ;
var a {LINKS} binary ;

minimize noc: sum {j in LINKS} g[j]*b[j];

subject to thresh {j in LINKS}: a[j]*g[j]*b[j] >= 4;

And the following data file:

param: g :=
    1  2
    2  3
    3  4
    4  5 ;


i then run this in AMPL, and these are my results:


ampl: reset; model ../models/net_simple.txt; data ../data/simple_net.txt; solve;
Gurobi 5.0.1: optimal solution; objective 15.99998243
10 simplex iterations
No dual variables returned.
ampl:
ampl:
ampl: display b;
b [*] :=
1  1.99999
2  1.33333
3  1
4  0.8
;

ampl: display a;
a [*] :=
1  1
2  1
3  1
4  1
;


ampl: option solver cplex;
ampl:
ampl: reset; model ../models/net_simple.txt; data ../data/simple_net.txt; solve;
CPLEX 12.5.0.0: IBM ILOG CPLEX Optimization Studio Commercial Edition                        ÿ
optimal integer solution; objective 15.99999998
11 MIP simplex iterations
0 branch-and-bound nodes
No basis.
ampl:
ampl: display b;
b [*] :=
1  2
2  1.33333
3  1
4  0.8
;

ampl: display a;
a [*] :=
1  1
2  1
3  1
4  1
;

ampl:

So why did Gurobi give me a solution that included an answer of b[1] = 1.9999, instead of 2 which is apparently the correct answer?
And does anyone know why the objective reached was 15.99999, and not 16 (Which is the obviously correct answer)?
Even in CPLEX, which figured out that b[1]=2, it still misscalculated the objective. Is there a way to fix this?
and what does "
No dual variables returned." mean?
Is there a book i can read that discusses MIP in combination to AMPL/Gurobi ?


Thanks

--
 
---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Greg Glockner

unread,
May 14, 2013, 2:31:59 PM5/14/13
to gur...@googlegroups.com
Integrality is addressed in FAQ 26, "Why does Gurobi sometimes return values for integer variables that are not integers?":

http://www.gurobi.com/resources/faqs


Additionally, the default behavior of AMPL is to solve the fixed LP after solving a MIP, so that you get reduced costs and dual values from the fixed model, for what that's worth.

Reply all
Reply to author
Forward
0 new messages