ampl / amplpy

Python API for AMPL

Home Page:https://amplpy.ampl.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

option for allowing exceptions to be thrown instead of error/warning messages with AMPL.solve()

pjcpjc opened this issue · comments

This is just for the AMPL.solve routine. Every time we encounter an error or warning message there, it always is something serious enough that we would prefer it be an exception throw. This is particularly important for platform deployment, since we have a good mechanism for presenting the exception to the user in a clean way.

You don't need to change previous functionality - can you add an argument to AMPL.solve indicating the preference of "print error warnings or throw exceptions".

Here are a couple of examples.

issue10.zip

Ready for testing

Looks good, I think our system can handle this well now (especially if people develop amplpy apps by using notebooks instead of .py files, since that will allow them to debug the notebook and see the full text anyway).