How to printf the optimization gap

116 views
Skip to first unread message

Hililielala

unread,
Mar 8, 2014, 8:31:58 AM3/8/14
to am...@googlegroups.com

Hello,
I need to print the optimization gap when my program finishies due to timelimit.
I have been looking for this answer a lot and I can not find it. I have already tried

suffix absmipgap OUT;
display <name of the objective function>.absmipgap;

but it returns always zero, even if the message is "CPLEX 12.6.0.0: time limit with integer solution; objective 7.9"

Thank you very much if anyone could help me.
H.

Robert Fourer

unread,
Mar 10, 2014, 10:51:57 AM3/10/14
to am...@googlegroups.com

Before solving, you need to set

 

   option cplex_options 'return_mipgap 3';

 

or add 'return_mipgap 3' to the cplex_options string that you're already using.  Then you can display the values of <obj>.absmipgap and <obj>.relmipgap.

 

Bob Fourer

am...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages