Image for post
Image for post

Learning Resources for Decision Optimization using IBM CPLEX

Sumeet Parashar
Jul 29, 2019 · 7 min read

Decision Optimization (aka mathematical optimization techniques) has been around for quite some time and providing value for strategic to operational business problems. With the advancement and growth in adoption of Data and AI, availability of data, and faith in data science; use of decision optimization has been gaining even more traction to operationalize on the insights uncovered from predictive models.

Image for post
Image for post
Predictive and Prescriptive (Decision Optimization) Analytics working together

As more and more clients, business partners and even data scientists in my own organization are trying to learn about Decision Optimization, a very common request / question that gets asked : “Where can I start learning and what are the training resources available ?”

Here in this article, I have tried to summarize and collect many basic to intermediate level self-learning resources that are publicly available. Thanks to the efforts of many people in this community who have contributed.

Modeling approaches for Optimization (only considering IBM CPLEX)

Optimization models for can be built using variety of languages/APIs (OPL, Python, Java, C, C#.. etc). Here, we will primarily cover resources for model building using Python, OPL (Optimization Programming Language), and natural language assisted model building approach available in DO4WS ().

In terms of some basic aspects of learning about optimization, and model building, I will compare the Python vs OPL approach as follows:

Image for post
Image for post
Basic comparison between Optimization modeling approaches using OPL and Python

This document will cover three different approaches to learn CPLEX

1. : using Python as well as using DO model builder experience

2. Build CPLEX optimization model using Python API

3. Model with OPL using CPLEX Optimization Studio

If you are new to optimization and prefer not to jump into coding directly, the Watson Studio approach is the easiest to begin.

1. Decision Optimization (CPLEX) in Watson Studio

Watson Studio is IBM’s leading Datascience and Machine Learning development platform.

Decision Optimization is also available in Watson Studio as one of the toolset among many other advanced features such as AutoAI, Visual model builder (SPSS modeler), as well as many open source tools such as Pytho, R, Scala etc.

Decision Optimization models can be developed in Watson Studio using one of the two approaches

A. Using Decision Optimization for Watson Studio (DO4WS) model builder experience

B. Using Python notebooks

A. Using Decision Optimization for Watson Studio (DO4WS) model builder experience

Here are some of the resources to get an overview, product tour / demo and samples for Decision Optimization for Watson Studio (DO4WS) model builder experience.

IBM Digital Technical Engagement page for DO4WS:

DO4WS product tour / guided demo:

Demo of Natural Language based modeling assistant in DO4WS:

Supply Demand use case:

Technician Scheduling Use case:

DO4WS is available on Watson Studio Local version 1.2.3 with the Decision Optimization (DO) add-on installation. DO4WS is also available as a beta version on Watson Studio cloud. You can sign up for account on Watson Studio Cloud at

To sign up for the beta of DO4WS, you can register here:

Project and data samples are available on IBM Decision Optimization’s github page. Check the DOforWS category on left

Image for post
Image for post
DO4WS project assets available on GitHub

B. Using Python Notebooks in DO4WS (Watson Studio Public cloud):

Login to your Watson Studio account ( or sign up for a free account).

Decision Optimization model building experience using Python Notebooks is now generally available (GA) in Watson Studio. Quick Overview and basic steps are available here:

Once you create an account on Watson Studio and log in, go to “Community” page

Search “CPLEX” on community page and you will see quite a few notebooks samples available for CPLEX Optimization modeling (image below shows a screenshot of CPLEX related notebooks on Watson Studio Community page)

Image for post
Image for post
CPLEX Python notebook samples available on Watson Studio

All these notebooks are also publicly available to see even without an account on Watson Studio. Some direct links are provided below.

> Finding optimal locations of new store using Decision Optimization

> Maximizing the profit of an oil company

> Predictive Maintenance Optimization

> The Nurse Assignment Problem

> The Unit Commitment Problem (UCP)

More information about building CPLEX Optimization model with Python is covered in next section.

2. Build CPLEX optimization model using Python API

Optimization modeling with python can be tried either on Watson Studio, or one can also use any local python development environment like PyCharm or Jupyter notebooks etc. To test it locally, CPLEX solver should be installed on your local computer. This can be done by either installing CPLEX Optimization Studio Community edition () or get a formal full version trial from IBM or use the self-serve development subscription available at

The image below shows a very high level overview of steps to build and solve an optimization model using Python API for CPLEX.

Image for post
Image for post

A complete sample model with steps and explanation is provided in this :

All the python notebook sample links provided in the previous section of Watson Studio are also relevant here.

More samples on Github:

Here is a collection of some sample CPLEX models in python:

Here is another github page with collection of several code and model samples related to CPLEX

This page also covers an overview and collection of links for information about Python API for CPLEX called docplex.

Ignore the references to DOcloud or DOcplexCloud. These are the names of the older service of CPLEX on Cloud. While DOcplexCloud service is still active, the new home for CPLEX solver on Cloud is IBM Watson Machine Learning (WML) called .

Further documentation of CPLEX Python API is available here

3. Model with OPL using CPLEX Optimization Studio (COS):

Install .

CPLEX Optimization studio (screenshot below) provides development environment for writing OPL models, provides model information such as Decision Variables, Objectives and Constraints. It also provides run statistics. One of the strong feature is that it also provides solution pool i.e. few other good feasible solutions along with the best solution.

Image for post
Image for post
OPL model in CPLEX Optimization Studio

Many opl model samples and data come packed with the installation. You can load examples from File -> Import -> Example

Will open a wizard to help you sort / search exmaples as shown below:

Image for post
Image for post
OPL sample models available in CPLEX Optimization Studio

Here are some resources to learn more about CPLEX Optimization Studio: Basic Introduction, overview and product tour:

Test drive on a virtual machine with CPLEX Optimization Studio installed.

CPLEX is one of the most popular Optimziation Solver for Linear Progamming (LP), Mixed Integer Programming (MIP) and Scheduling Problems. 100’s of video tutorials are available on youtube from people in academia, industry, IBM and broader datascience + Operations Research (OR) community. You can search CPLEX OPL or CPLEX java etc and you will find tutorials for many different programming approaches for building optimization models with CPLEX. Here is a search result on YouTube for “CPLEX OPL”

Basic to advanced tutorials and feature documentation is available on IBM Knowledge center website:

Numerous model samples and code assets are also available on this github page of IBM Decision Optimization

This concludes the collection of basic learning resources for Decision Optimization model building with various products, namely

- Watson Studio (local or public cloud version)

- CPLEX Optimization Studio on-prem installation. Local CPLEX solver can solve models built using OPL as well as Python.

Some more resources are provided below to cover topics ranging from use cases, advanced approaches such as Constraint Programming etc.

Predictive Maintenance Scheduling:

Optimization use cases for Retail, Transportation and Energy industries

Solving Resource-Constrained Project Scheduling Problems with CP Optimizer:

Decision Optimization news blog @ IBM Developer:

Decision Optimization Github pages:

IBM Watson

AI Platform for the Enterprise

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store