Overview
GEKKO provides a Python interface to the APMonitor optimization suite for equation-based and data-driven modeling. Its documented focus includes time series and differential algebraic equation systems, with applications in simulation, estimation, and process optimization. It is a modeling toolkit rather than a pretrained predictive model: users define the mathematical relationships and objectives for their own problem.
Models are assembled from constants, parameters, variables, intermediate expressions, equations, and objectives. A symbolic model represents a data point or time instance, while the selected solution mode extends it across observations or a time horizon. The APMonitor backend compiles the model, analyzes its sparse structure, and supplies derivatives to optimization solvers. For differential algebraic systems, orthogonal collocation converts the dynamic problem into algebraic equations. Solution results are written to results.csv and loaded back into GEKKO's Python variables.
Documented workflows include steady-state simulation, parameter updates, real-time optimization, moving horizon estimation, and nonlinear control. Dynamic simulation, estimation, and optimization can use simultaneous or sequential solution approaches. GEKKO also supports linear, quadratic, nonlinear, and mixed-integer programming, allowing discrete decisions and continuous dynamics within the documented problem classes.
Execution can use a remote server, which is the default, or a local CPU through the remote=False option. The README identifies bundled executables for several platforms, but these excerpts do not establish tested compatibility or comparative performance. Models may fail to converge; APMonitor provides an infeasibility report and diagnostic settings to help investigate initialization and inconsistent equations.
Key Features
- Symbolic model construction using constants, parameters, variables, intermediate expressions, equations, and maximization or minimization objectives.
- Support for linear, quadratic, nonlinear, and mixed-integer optimization, alongside differential algebraic equations and complementarity-constrained problems.
- Steady-state and dynamic modes for simulation, parameter estimation, real-time optimization, and nonlinear predictive control.
- Simultaneous and sequential approaches to dynamic simulation, estimation, and optimization.
- Backend model compilation, sparse derivative generation through automatic differentiation, and orthogonal collocation for differential algebraic systems.
- Remote or local execution, with results returned to Python variables and infeasibility reports available for unsuccessful solves.
Use Cases
- Intended evaluation: formulate a process model with differential and algebraic equations, then compare simulated trajectories with representative process measurements.
- Intended evaluation: fit uncertain process parameters or assess moving horizon estimation using a measured time series and a user-defined model.
- Intended evaluation: prototype nonlinear predictive control with process constraints and an explicit operating objective before considering deployment.
- Intended evaluation: represent discrete operating choices and continuous process variables in a mixed-integer optimization problem.
How to Use
- Start with the official documentation and modeling examples. Select a simulation, estimation, or optimization workflow that matches your intended problem.
- Consult the repository README for the supplied pip installation instructions and the PyPI listing for package information. Do not treat packaging classifiers as evidence of tested compatibility.
- Define your constants, parameters, variables, equations, and objective. For dynamic work, prepare the relevant time horizon and observations according to the documentation; distinguish measured inputs from quantities to estimate.
- Choose the appropriate solution mode and execution location. Remote solving is the documented default; remote=False selects local execution. Consider whether your inputs are appropriate for remote processing.
- Evaluate a representative example, inspect the values returned to Python, and compare them with your expected behavior. If the solve fails, examine infeasibilities.txt and consult the documented diagnostic and initialization options before expanding the model.