Setting time limit through amplpy

Hi,

I’m solving a problem through amplpy. I wish to set a timelimit on the solver. However, I explored all ampl options and see no such option. How do I do that?

Sample code:
ampl = AMPL(Environment(‘…’))
#set solver
ampl.setOption(‘solver’, ‘cbc’)

Hi Jessica,

The limit limit is a solver option. You can see all options for CBC at: CBC Options — AMPL Resources

ampl.setOption('cbc_options', 'timelim=60')

BTW: this applies to the latest CBC driver released recently. You may need to download the latest version for CBC from the AMPL Portal) in case you have an older installation.