Optimization (Prescriptive analytics, Operations Research, Decision Optimization) is doing more with less. Which is why most of the time, this makes sense. In a few posts I tried to show the way:

Then came 2018 and I tried a very simple story.

And many people liked Making Decision Optimization Simple where I gave some very simple OPL examples derived from the very simple bus example.

Python is everywhere especially thanks to the data science boom and to me the easiest path in order to use decision optimization in python is to either use the OPL - Python doopl API or to call OPL in Watson Studio either local or cloud.

Some people do not answer the same as me to the question whether we should use OPL from Python or Python directly and in this post, I d like to please them.

A few docplex python examples:

and we can call OPL model from python

There are many CPLEX Python API but the one I recommend is docplex. Good documentation for Mathematical Programming and Constraint Programming.

There are many available tutorial notebooks. And a very convenient way to run docplex python code is to use IBM Watson Studio.

PS:

Let's not forget since we deal with Python that all started with some excellent movies and some nonsense:



