3 June 2022 (353 words)

Python optimization tools

We're expanding the scope of this blog to include optimization modelling using Python.

Python is a popular programming language for many data science applications, including optimization modelling. A key feature of Python is the availability of many packages for building and solving optimization models, including:

  • CVXPY. Modeling language for convex optimization problems.
  • Gekko. Modelling language for machine learning and optimization.
  • OR-Tools. General purpose linear, mixed integer, and constraint programming, plus specific tools for vehicle routing and graph algorithms.
  • PuLP. Optimization modelling language written in Python.
  • Pyomo. Optimization modelling language with a diverse set of optimization capabilities.
  • Python-MIP. Collection of tools for the modelling and solution of mixed integer linear programs.
  • SciPy. General purpose numerical and scientific computing library.

These tools provide access to a variety of solvers, which help us solve a wide range of problem types. In addition to the solvers built into some of the packages, we'll also use:

  • Bonmin. A solver for general mixed integer non-linear programs.
  • CBC. A linear and mixed integer program solver.
  • Couenne. A solver that aims to find global optima of non-convex mixed integer non-linear programs.
  • GLPK. Package for solving large-scale linear and mixed integer programs.
  • Ipopt. Package for large-scale non-linear optimization.
  • NEOS Server. Internet-based service that provides remote access to many solvers.
  • Octeract. A global mixed integer non-linear solver.

As discussed in our article Optimization in Excel vs Python, the choice of optimization tool depends on the circumstances, including the model's features and the modellers' and users' familiarity with the tools. As optimization tools, Excel and Python both have advantages and disadvantages. By expanding our blog's scope to include Python tools, we're looking to enable you to use the approach that works best in your situation.

We'll focus on free and open-source packages and solvers, though the concepts can also be applied to commercial software like CPLEX and Gurobi.

In our next article, we'll step through the process of setting up an environment for Python modelling. In subsequent articles, we'll explore a variety of Python optimization packages, sometimes contrasting a Python model implementation with an Excel implementation.