`timelimit` doesn't seem to work in amplpy

from amplpy import AMPL
ampl = AMPL() 
ampl.option['gurobi_options'] = 'timelimit=3000;'

Timelimit is not working in my case. I am running an optimization problem that takes forever to run. Now, setting this timelimit, it runs so fast with poor results. It doesn’t even obey the time-limit. What could I be doing wrong?

1 Like

Hi @Anthony_Nwachukwu,

Could you please try with the following and send us the output?

ampl.option['gurobi_options'] = 'timelimit=3000 outlev=1'

This will produce additional verbose output and show what is happening during all that time. The timelimit is sometimes not respected by the solvers as some operations run til the end before checking the time-limit. However, it is not common to take much more than the time limit that was set.

Thank you so much. It works well now.

1 Like