GEKKO is a Python package for machine learning and optimization of mixed-integer and differential algebraic equations (DAE) systems, coupled with large-scale solvers for various programming types (LP, QP, NLP, MILP, MINLP). It provides an object-oriented interface to the APMonitor optimization suite, supporting modes like parameter regression, dynamic data reconciliation, real-time optimization, dynamic simulation, and nonlinear predictive control. Currently at version 1.3.2, GEKKO is actively maintained with frequent releases and consistently sees over 100,000 downloads per month.
pip install gekkoVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a simple nonlinear programming (NLP) problem with two variables, two constraints, and an objective function. It initializes a GEKKO model, sets up the variables, equations, and objective, and then solves the problem, printing the optimal variable values and objective function value.
To explicitly use the public server for solving, initialize the model with `m = GEKKO(remote=True)`.
Replace `math.exp(x)` or `np.sin(y)` with `m.exp(x)` or `m.sin(y)` where `x` and `y` are GEKKO variables. Direct use of `math` or `numpy` functions will typically result in `AttributeError` or `TypeError`.
If experiencing solver issues or needing specific solvers, consider using `m = GEKKO(remote=True)` to leverage the public server, or consult GEKKO documentation for specific local solver bundles for your OS/architecture.
Simplify your model by reducing variables or equations, splitting the problem into sub-problems, or using a remote server (`remote=True`) which might have increased limits. You may also need to check model formulation for redundant expressions.
Run `pip install gekko` in your terminal or environment.
Examine `m.options.APPSTATUS` and `m.options.APPINFO` for specific error codes. Try different initial values for variables, relax constraints, or switch to a different solver (`m.options.SOLVER = 1` for APOPT, `3` for IPOPT if available). Set `m.options.DEBUG=1` or `disp=True` during `m.solve()` for more verbose output.
Replace `math.function(m.Var)` or `np.function(m.Var)` with `m.function(m.Var)`. For example, use `m.exp(x)` instead of `math.exp(x)`.
Ensure GEKKO is correctly installed and its executables are present. If running on an unsupported architecture for local solve, or if executables are corrupted, consider using `m = GEKKO(remote=True)` to offload solving to the public server. Reinstalling GEKKO (`pip install --upgrade gekko`) might also resolve missing executables.