Making optimization simple (Python)
Screenshot of a python CPLEX model in IBM Watson Studio Local

Making optimization simple (Python)

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.

No alt text provided for this image

A few docplex python examples:

No alt text provided for this image

No alt text provided for this image


No alt text provided for this image

No alt text provided for this image


and we can call OPL model from python and

  • call an OPL model from python and then add python objective and constraints (MIP , CPO, and scheduling )

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.

Plus with docplex you can solve with IBMQuantum through an emulator or a real quantum device

No alt text provided for this image


PS:

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

No alt text provided for this image


Rony Roy

Sr. Solution Architect | Machine Learning | Artificial Intelligence| Operations Management | 14+ Years | AWS

4 年

This is a great starting point for me...

Simple and elegant?

回复

Definitely Python directly. Including Monty. :-)

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了