[Gurobi] display relmipgap with ampl

1,480 views
Skip to first unread message

Phil

unread,
May 18, 2010, 3:15:52 AM5/18/10
to Gurobi Optimization
Hi

I'm using gurobi together with the ampl modeling system. Is there a
way to display the relative mip gap after solving a mip model? I'm
looking for something like:

display relmipgap;

thanks

Phil

Greg Glockner

unread,
May 19, 2010, 8:46:03 PM5/19/10
to gur...@googlegroups.com
There is no objective suffix to get the MIP gap, but you can see this information if you set the outlev to 1:

http://www.gurobi.com/doc/30/ampl/parameters.html

Phil

unread,
May 20, 2010, 8:50:07 AM5/20/10
to Gurobi Optimization
For the sake of automation I would like to write the solution
attributes (like relmipgap) into a .txt-File. Can I direct the outlev-
output into a .txt-File? Thanks

Robert Fourer

unread,
Oct 2, 2012, 10:18:58 AM10/2/12
to gur...@googlegroups.com

Here's an example showing how to compute both the absmipgap and relmipgap following a Gurobi solve in AMPL.  Note that you need to set option 'bestbound 1' to have the "best bound" information reported from Gurobi to AMPL.  In the example, Gurobi reports absmipgap = 3.07e+03 and relmipgap = 0.013, while AMPL reports 3071.67 and 0.0130363 -- actually the numbers are the same, but AMPL's display statement reports them with more significant digits.

 

Bob Fourer

4...@ampl.com

 

 

ampl: model multmip3.mod;

ampl: data multmip3.dat;

 

ampl: option solver gurobi;

ampl: option gurobi_options 'nodelim 25 bestbound 1';

ampl: solve;

 

Gurobi 5.0.0: nodelim 25

bestbound 1

 

Gurobi 5.0.0: node limit; objective 235625

408 simplex iterations

46 branch-and-cut nodes

plus 34 simplex iterations for intbasis

absmipgap = 3.07e+03, relmipgap = 0.013

 

suffix bestbound OUT;

 

ampl: display Total_Cost - Total_Cost.bestbound;

Total_Cost - (Total_Cost.bestbound) = 3071.67

 

ampl: display (Total_Cost - Total_Cost.bestbound)/Total_Cost;

(Total_Cost - (Total_Cost.bestbound))/Total_Cost = 0.0130363

 

 

From: gur...@googlegroups.com [mailto:gur...@googlegroups.com] On Behalf Of Along
Sent: Tuesday, October 02, 2012 1:35 AM
To: gur...@googlegroups.com
Subject: Re: [Gurobi] Re: display relmipgap with ampl

 

Dear Phil,

Have you find something like "display relmipgap"? I also want to direct the relmipgap into a .txt-File. Thanks.

 

Regards,

Along

2010520日星期四UTC+8下午85007秒,Phil写道:

Baburam Rijal

unread,
Oct 20, 2017, 12:45:20 AM10/20/17
to Gurobi Optimization
Hello Bob,
Is it possible to store those values (Gap, best bound and Time - the output "table" of option outlev 1) for each iteration so that I can monitor and compare the solution space with varying initial solutions using heuristics?
Thanks.

Baburam

Robert Fourer

unread,
Oct 20, 2017, 1:44:30 PM10/20/17
to gur...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages