ampl / amplpy

Python API for AMPL
https://amplpy.ampl.com
BSD 3-Clause "New" or "Revised" License
66 stars 19 forks source link

Fail to choose a different solver - always using 'minos' #43

Closed rfigueiredo2022 closed 2 years ago

rfigueiredo2022 commented 2 years ago

Hi!

I am using python 3.10.2, and I'm using amplpy to run a model in AMPL using a free solver (e.g. 'bonmin'). To do that, I've tried to choose the solver with:

if argc > 1:
        ampl.set_option('solver','bonmin')

However, it gives an error saying that 'minos' is not available for my AMPL license. So, to confirm which solver is being actually used, I use the following code right after the previous:

 value = ampl.get_option('solver')
 if value is not None:
        print('Option solver exists and has value:', value)

And it returns: 'Option solver exists and has value: minos', confirming that 'minos' is still being considered. Why doesn't amplpy update the solver I'm choosing instead of keeping 'minos'? Anyone else has had this problem?

Thank you!