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
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
在 2010年5月20日星期四UTC+8下午8时50分07秒,Phil写道: