I'm solving a problem several times in a for loop with Gurobi 8.1.0 and with different parameters and a time limit for each solve command. Now i want to know the absolute and relative MIP-gap. I followed the instructions here https://groups.google.com/forum/#!topic/gurobi/tCtJDfC6AhA
Could it be that it is not possible to use display cost.bestbound; in a for loop? I get a 'Bad suffix .bestbound for cost' right at the beginning when i try to run my .run file.
Without the for loop (running the problem only once) it works. Is there any workaround for it?
To reference a suffix within a loop, you may need to define the suffix before the loop starts. In your case you would put the command
suffix bestbound OUT;
toward the beginning of your script, before the start of your loop.
(To be precise, Gurobi tells AMPL to define suffix .bestbound if it's not already defined; when this happens you see "suffix bestbound OUT;" after the solve. However, AMPL scans the entire contents of the loop before starting to execute it. So if your script executes its first "solve" after the loop has started, then when AMPL scans the loop it will encounter .bestbound before the solve has had a chance to define that suffix. In that case your script must explicitly define .bestbound before the loop starts.)