GEKKO Python Tutorials

GEKKO Python is designed for large-scale optimization and accesses solvers of constrained, unconstrained, continuous, and discrete problems. Problems in linear programming, quadratic programming, integer programming, nonlinear optimization, systems of dynamic nonlinear equations, and multi-objective optimization can be solved. The platform can find optimal solutions, perform tradeoff analyses, balance multiple design alternatives, and incorporate optimization methods into external modeling and analysis software. It is free for academic and commercial use under the MIT license.

The GEKKO package is available through the package manager pip in Python.

 pip install gekko

Another method to obtain GEKKO is to include the following code snippet at the beginning of a Python script. If GEKKO is not available, it uses the pip module to install it.

try:
    from pip import main as pipmain
except:
    from pip._internal import main as pipmain
pipmain(['install','gekko'])
# to upgrade: pipmain(['install','--upgrade','gekko'])

Gekko source code is available on GitHub. It is downloaded 330,000 times per month according to PyPi stats.

Star

GEKKO Information

The latest GEKKO source is available on GitHub. Download statistics are available from the PyPI Stats Website. Functionality is tested with Python 2.7 and Python 3+ for all operating systems (Windows, MacOS, Linux) and architectures (such as ARM processors) that support Python.

If you use GEKKO and publish the results, please consider citing the following article:

  • Beal, L.D.R., Hill, D., Martin, R.A., and Hedengren, J. D., GEKKO Optimization Suite, Processes, Volume 6, Number 8, 2018, doi: 10.3390/pr6080106. Article - BibTeX - RIS

There are 18 example problems with GEKKO that are provided below. These examples demonstrate the equation solving, regression, differential equation simulation, nonlinear programming, machine learning, model predictive control, moving horizon estimation, debugging, and other applications. While these applications are designed to be tutorial in nature and very simple, GEKKO references are further application examples of complex and multi-disciplinary systems.


18 Example Applications


Learn GEKKO Python with Online Course

The Dynamic Optimization Course is graduate level course taught in three modules to introduce concepts in:

  • mathematical modeling (3 weeks)
  • machine learning, estimation (3 weeks)
  • control, optimization (3 weeks)

There are many other applications and instructional material posted to this freely available course web-site. The online course is generally offered starting each year in January. There are two course projects that include the advanced temperature control lab (1st project) and a project that is a group choice (2nd project). Below is an example student presentation at the end of the course. It is representative of the modeling, estimation, and control methods that are taught in the dynamic optimization course.

Streaming Chatbot
💬