BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization
https://machinelearning.byu.edu
Other
569 stars 102 forks source link

Extend Solver Extension module to interface with Pyomo #184

Closed alma-walmsley closed 1 week ago

alma-walmsley commented 1 week ago

Previously, I had committed the solver extension module to link up with amplpy allowing access to more solvers - see https://github.com/BYU-PRISM/GEKKO/pull/176. This PR extends that module to solve through Pyomo. Pyomo interfaces with ASL (AMPL Solver Library) and so can provide the same functionality as AMPL, however it is completely open-source, so it does not have any limits and can be used commercially under the BSD license.

This PR maintains compatible with the previous version of the solver extension module, however, a lot has been refactored in the codebase:

In order to keep GEKKO lightweight, the two converters continue to not require amplpy or pyomo to be installed, unless the solver extension module is used.

The Pyomo converter supports about the same amount of model building functions as the amplpy converter, and definitely all the core optimization functions. It's missing a few more pre-built objects (didn't work straight out of the box as with amplpy), but hopefully this should be OK for now. It also currently does not support dynamic modelling (time, derivatives, etc), however, this could be added with Pyomo's DAE (differential algebraic equations) module in the future.

APMonitor commented 1 week ago

Great work on the pyomo extension!