Error retrieving Gurobi running times

Hello, I am experiencing a problem retrieving Gurobi running times with option “timing 1”.

As far as I could see, the problem arises when solving a named problem within a loop. The following .run file;

var x1>=0;
minimize objfun: x1;

option solver gurobi;
option gurobi_options "timing 1";

problem testing: x1, objfun;

repeat{
	solve testing;
	display testing.time_solver;
	break;
}

produces the following error:

Bad suffix .time_solver for testing
context:  display  >>> testing.time_solver; <<< 
Possible suffix values for testing.suffix:
	astatus   exitcode   message   relax
	result    sstatus    stage

Solving the problem outside the loop works fine. Solving the problem without naming it also works fine (using “Initial.time_solver”) .

Best regards,
Julio.

This is a known issue. If you choose the option “timing 1” then Gurobi defines “suffix time_solver OUT;” for you (if it has not been defined already). However the AMPL command processor does a preliminary parsing of a loop before any commands in the loop are executed; as a result, if you make a reference to .time_solver in a loop, then the command processor may encounter .time_solver before a “solve;” has had a chance to define it.

In this particular case, you should be able to fix the problem by adding the AMPL statement “suffix time_solver OUT;” just before the beginning of the loop.

I see, thanks a lot for the quick and clear response.

Best regards,
Julio.