Why python can make your decision making process easier

Mohsen Moarefdoost Ph.D. Operations Research Scientist
Read Time: 2 minutes apprx.
open source operations research optimization python

Andy Picture MT 3 Web

If you are dealing with complex, large scale and multi layered systems, you may end up analyzing and solving multiple, even nested, optimization problems (LP- linear programs, MIP- mixed integer programs, QP- quadratic programs, etc.) in your decision making process. So, you need to design an analytical algorithm that calls optimization problems multiple times, use output of one and feed it to the other problem, and might need to update couple of them and solve them again.

This process cannot be (or not easily) implemented and executed in modeling languages like GAMS and AMPL. You need to use a programming language like C/C++, C#, Java or Python for implementing your algorithm and modeling the mathematical optimization problems in the algorithm. You also need a solver to solve the optimization problems. I recommend Python because it’s easy, powerful, and there is a lot of helpful online help.

Moreover, many commercial and open source optimization solvers have Python interface. I have worked with “Gurobipy” which is the python interface for Gurobi. It is easy to model LP/MIP and QP problems using Python and call problems multiple times with high flexibility. It’s syntaxes for creating the mathematical programming models are simple, narrative and very close to the mathematical formulations. However, you need to have Gurobi license. If you don’t have Gurobi license, you can use one of python’s mathematical modeling packages to model the optimization models and call whatever solver you have access to.

Fortunately, there are many open source and powerful packages and libraries to formulate and analyze optimization applications. My suggestions are “Pymo and “PuLP”. These libraries have fine documentations and examples, and they are easy to learn and apply.