gekko

GEKKO Python for Machine Learning and Dynamic Optimization

https://github.com/byu-prism/gekko

Science Score: 85.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: sciencedirect.com, mdpi.com
  • Committers with academic emails
    1 of 16 committers (6.3%) from academic institutions
  • Institutional organization owner
    Organization byu-prism has institutional domain (apm.byu.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

GEKKO Python for Machine Learning and Dynamic Optimization

Basic Info
Statistics
  • Stars: 667
  • Watchers: 20
  • Forks: 114
  • Open Issues: 32
  • Releases: 25
Created about 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation Support

README.md

GEKKO

GEKKO is a Python package for machine learning and optimization, specializing in time series and differential algebraic equations (DAE) systems. GEKKO provides a user-friendly interface to the APMonitor optimization suite. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP). Modes of operation include parameter regression, dynamic data reconciliation, real-time optimization, dynamic simulation, and nonlinear predictive control.

Gekko Logo

Installation

A pip package is available:

sh pip install gekko

The most recent version is listed on PyPi. You can upgrade from the command line with the upgrade flag:

sh pip install --upgrade gekko

GEKKO runs in remote mode (solved on high performance server) or on a local CPU when option remote=False such as m=GEKKO(remote=False). The pip package includes the Windows executable (apm.exe), a Linux executable (apm), a MacOS executable (apmmac), and a Linux ARM processor executable such as for a Raspberry Pi (apmarm). With Linux under WSL on x86 platform, the Windows executable is used. Gekko can be used with remote server access (default option) for all operating systems.

What does GEKKO do?

GEKKO is optimization software for machine learning and optimization of mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP). Modes of operation include data reconciliation, real-time optimization, dynamic simulation, and nonlinear predictive control. The client or server is freely available with interfaces in MATLAB, Python, or from a web browser.

GEKKO is a high-level abstraction of mathematical optimization problems. Values in the models are defined by Constants, Parameters, and Variables. The values are related to each other by Intermediates or Equations. Objective functions are defined to maximize or minimize certain values. Objects are built-in collections of values (constants, parameters, and variables) and relationships (intermediates, equations, and objective functions). Objects can build upon other objects with object-oriented relationships.

The APMonitor executable on the back-end compiles a model to byte-code and performs model reduction based on analysis of the sparsity structure (incidence of variables in equations or objective function) of the model. For differential and algebraic equation systems, orthogonal collocation on finite elements is used to transcribe the problem into a purely algebraic system of equations. APMonitor has several modes of operation, adjustable with the imode parameter. The core of all modes is the nonlinear model. Each mode interacts with the nonlinear model to receive or provide information. The 9 modes of operation are:

  1. Steady-state simulation (SS)
  2. Model parameter update (MPU)
  3. Real-time optimization (RTO)
  4. Dynamic simulation (SIM)
  5. Moving horizon estimation (EST)
  6. Nonlinear control / dynamic optimization (CTL)
  7. Sequential dynamic simulation (SQS)
  8. Sequential dynamic estimation (SQE)
  9. Sequential dynamic optimization (SQO)

Modes 1-3 are steady state modes with all derivatives set equal to zero. Modes 4-6 are dynamic modes where the differential equations define how the variables change with time. Modes 7-9 are the same as 4-6 except the solution is performed with a sequential versus a simultaneous approach. Each mode for simulation, estimation, and optimization has a steady state and dynamic option.

APMonitor provides the following to a Nonlinear Programming Solver (APOPT, BPOPT, IPOPT, MINOS, SNOPT) in sparse form:

  • Variables with default values and constraints
  • Objective function
  • Equations
  • Evaluation of equation residuals
  • Sparsity structure
  • Gradients (1st derivatives)
  • Gradient of the equations
  • Gradient of the objective function
  • Hessian of the Lagrangian (2nd derivatives)
  • 2nd Derivative of the equations
  • 2nd Derivative of the objective function

Once the solution is complete, APMonitor writes the results in results.csv that is loaded back into the python variables by GEKKO

When the system of equations does not converge, APMonitor produces a convergence report in ‘infeasibilities.txt’. There are other levels of debugging that help expose the steps that APMonitor is taking to analyze or solve the problem. Setting APM.diaglevel to higher levels (0-10) gives more output to the user. Setting APM.coldstart to 2 decomposes the problem into irreducible sets of variables and equations to identify infeasible equations or properly initialize a model.

Open-Source Modeling

Open-source modeling languages are essential tools for data analysis and scientific computing. Gekko is a mathematical programming language for optimization problems with physics-based and data-driven models. The importance of a collaborative development effort in open-source modeling languages cannot be overstated. Collaboration allows developers to pool their resources and knowledge, leading to faster and more robust development. Additionally, collaboration fosters a culture of sharing and support, helping to ensure the longevity and continued improvement of these essential tools. Below are select references to the Gekko Optimization Suite.

Gunnell, L., Nicholson, B., Hedengren, J.D., Equation-based and data-driven modeling: Open-source software current state and future directions, Computers & Chemical Engineering, 2024, 108521, ISSN 0098-1354, DOI: 10.1016/j.compchemeng.2023.108521. Preprint

Hedengren, J. D. and Asgharzadeh Shishavan, R., Powell, K.M., and Edgar, T.F., Nonlinear Modeling, Estimation and Predictive Control in APMonitor, Computers and Chemical Engineering, Volume 70, pg. 133–148, 2014, doi: 10.1016/j.compchemeng.2014.04.013. Preprint

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 (Open Access)

Star History Chart

Owner

  • Name: BYU PRISM
  • Login: BYU-PRISM
  • Kind: organization
  • Email: support@apmonitor.com
  • Location: Brigham Young University, Provo, UT

Process Research and Intelligent Systems Modeling

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use GEKKO software, please cite the journal article."
authors:
- family-names: "Beal"
  given-names: "Logan"
  orcid: "https://orcid.org/0000-0002-5634-0683"
- family-names: "Hill"
  given-names: "Daniel"
- family-names: "Martin"
  given-names: "R. Abraham"
- family-names: "Hedengren"
  given-names: "John"
  orcid: "https://orcid.org/0000-0002-5535-5277"
title: "GEKKO Optimization Suite"
journal: "Processes"
doi: 10.3390/pr6080106
url: "https://www.mdpi.com/2227-9717/6/8/106"
month: 7
issue: 106
volume: 6
year: 2018

GitHub Events

Total
  • Create event: 1
  • Release event: 2
  • Issues event: 13
  • Watch event: 65
  • Issue comment event: 14
  • Push event: 25
  • Pull request event: 4
  • Fork event: 9
Last Year
  • Create event: 1
  • Release event: 2
  • Issues event: 13
  • Watch event: 65
  • Issue comment event: 14
  • Push event: 25
  • Pull request event: 4
  • Fork event: 9

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 776
  • Total Committers: 16
  • Avg Commits per committer: 48.5
  • Development Distribution Score (DDS): 0.385
Top Committers
Name Email Commits
APMonitor j****n@a****m 477
Logan Beal b****n@g****m 155
Daniel Hill d****2@g****m 94
abe-mart a****n@b****u 33
Junho Park j****k@g****m 3
abe-mart a****t@g****m 3
Sean Lane 5****e@u****m 2
Nathaniel Gates n****s@g****m 1
Kinggerm c****r@f****m 1
Zach Baird 2****i@u****m 1
André David a****h@u****m 1
Sam Havens s****m@c****m 1
oacom o****c@y****m 1
andreasroithervoigt 3****t@u****m 1
llgunnell7 3****7@u****m 1
Damon J Petersen d****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 121
  • Total pull requests: 15
  • Average time to close issues: 5 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 100
  • Total pull request authors: 9
  • Average comments per issue: 3.47
  • Average comments per pull request: 0.27
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 9
  • Pull requests: 3
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 15 hours
  • Issue authors: 9
  • Pull request authors: 2
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • APMonitor (13)
  • PerplexedFox (3)
  • abe-mart (3)
  • fatsen (2)
  • quynhtran29 (2)
  • aaronjohnsabu1999 (2)
  • Tibalt (2)
  • talsaiag (2)
  • reinderien (2)
  • mastwood (1)
  • Tastaturtaste (1)
  • jtpdowns (1)
  • akhilbhat060890 (1)
  • sangnguyens (1)
  • CaptainFerMag (1)
Pull Request Authors
  • APMonitor (6)
  • alma-walmsley (4)
  • llgunnell7 (3)
  • JianjunJin (1)
  • adavidzh (1)
  • tosemml (1)
  • iillyyaa (1)
  • jnhopark (1)
  • zmeri (1)
Top Labels
Issue Labels
enhancement (25) bug (21) help wanted (1) question (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 112,164 last-month
  • Total docker downloads: 36
  • Total dependent packages: 12
  • Total dependent repositories: 51
  • Total versions: 67
  • Total maintainers: 1
pypi.org: gekko

Machine learning and optimization for dynamic systems

  • Versions: 67
  • Dependent Packages: 12
  • Dependent Repositories: 51
  • Downloads: 112,164 Last month
  • Docker Downloads: 36
Rankings
Downloads: 1.0%
Dependent packages count: 1.0%
Dependent repos count: 2.1%
Average: 2.5%
Stargazers count: 2.8%
Docker downloads count: 3.6%
Forks count: 4.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • flask *
  • flask_cors *
  • numpy >=1.8
  • ujson *