BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization

Home Page:https://machinelearning.byu.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better error when no solution found

marcosfelt opened this issue · comments

Currently, when the solver doesn't find a solution, it raises a generic exception. Using a generic exception makes it difficult to specifically catch failed solutions and do custom error handling.

raise Exception(apm_error)

Would you accept a PR that creates a custom error for failed solutions?

Try setting debug=0 to allow the code to proceed without the exception with m.solve(debug=0). The status is reported by m.options.APPSTATUS or m.options.APPINFO for more specific error information.