Learning Resources for Decision Optimization using IBM CPLEX
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.
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 CPLEX 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 (Decision Optimization for Watson Studio).
In terms of some basic aspects of learning about optimization, and model building, I will compare the Python vs OPL approach as follows:
This document will cover three different approaches to learn CPLEX
1. IBM Watson Studio: 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: https://www.ibm.com/demos/collection/IBM-Decision-Optimization-for-Watson-Studio/
DO4WS product tour / guided demo: https://www.ibm.com/cloud/garage/dte/producttour/create-and-deploy-optimization-model
Demo of Natural Language based modeling assistant in DO4WS:
Supply Demand use case: https://www.youtube.com/watch?v=LSCv04L_Glw
Technician Scheduling Use case: https://ibm.box.com/s/ld4atiho798431ycidypl2pw71oga5ws
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 https://www.ibm.com/cloud/watson-studio
To sign up for the beta of DO4WS, you can register here: https://datasciencex.typeform.com/to/Lz8yoh
Project and data samples are available on IBM Decision Optimization’s github page. https://ibmdecisionoptimization.github.io Check the DOforWS category on left
B. Using Python Notebooks in DO4WS (Watson Studio Public cloud):
Login to your Watson Studio account ( or sign up for a free account). https://www.ibm.com/cloud/watson-studio
Decision Optimization model building experience using Python Notebooks is now generally available (GA) in Watson Studio. Quick Overview and basic steps are available here: https://medium.com/ibm-watson/decision-optimization-is-now-available-in-watson-studio-66e834220ed2
Once you create an account on Watson Studio and log in, go to “Community” page https://dataplatform.cloud.ibm.com/community
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)
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 https://dataplatform.cloud.ibm.com/exchange/public/entry/view/aceccfd155454fd9741852e12e9cce4e
> Maximizing the profit of an oil company https://dataplatform.cloud.ibm.com/exchange/public/entry/view/4d23b3d57fa821a2d5c726d3f21582f2
> Predictive Maintenance Optimization https://dataplatform.cloud.ibm.com/exchange/public/entry/view/5d686c16d14491f4c3997b67fed61ec8
> The Nurse Assignment Problem https://dataplatform.cloud.ibm.com/exchange/public/entry/view/1bee661025715d0712bc5d139b494587
> The Unit Commitment Problem (UCP) https://dataplatform.cloud.ibm.com/exchange/public/entry/view/a9df9c4e022991268fad26117f579b44
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 (https://www.ibm.com/products/ilog-cplex-optimization-studio) or get a formal full version trial from IBM or use the self-serve development subscription available at https://www.ibm.com/products/ilog-cplex-optimization-studio/pricing
The image below shows a very high level overview of steps to build and solve an optimization model using Python API for CPLEX.
A complete sample model with steps and explanation is provided in this publicly available python notebook:
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: https://github.com/IBMDecisionOptimization/docplex-examples
Here is another github page with collection of several code and model samples related to CPLEX https://ibmdecisionoptimization.github.io/#
This page also covers an overview and collection of links for information about Python API for CPLEX called docplex. https://developer.ibm.com/docloud/blog/2015/10/20/cplex-modeling-for-python-technical-preview/
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 DO on WML.
Further documentation of CPLEX Python API is available here https://developer.ibm.com/docloud/documentation/optimization-modeling/modeling-for-python/ https://cdn.rawgit.com/IBMDecisionOptimization/docplex-doc/master/docs/index.html
3. Model with OPL using CPLEX Optimization Studio (COS):
Install CPLEX Optimization Studio developer edition or free community edition.
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.
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:
Here are some resources to learn more about CPLEX Optimization Studio: Basic Introduction, overview and product tour: https://ibm-dte.mybluemix.net/ibm-ilog-cplex
Test drive on a virtual machine with CPLEX Optimization Studio installed. https://www.ibm.com/cloud/garage/dte/tutorial/cplex-optimization-studio-fundamentals-tutorial
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” https://www.youtube.com/results?search_query=CPLEX+OPL
Basic to advanced tutorials and feature documentation is available on IBM Knowledge center website: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.ide.help/OPL_Studio/usroplide/topics/opl_ide_tutorialsTOP.html
Numerous model samples and code assets are also available on this github page of IBM Decision Optimization https://github.com/IBMDecisionOptimization
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: https://towardsdatascience.com/predictive-maintenance-scheduling-with-ibm-data-science-experience-and-decision-optimization-25bc5f1b1b99
Optimization use cases for Retail, Transportation and Energy industries https://www.ibmbigdatahub.com/blog/why-prescriptive-analytics-and-decision-optimization-are-crucial
Solving Resource-Constrained Project Scheduling Problems with CP Optimizer: https://www.linkedin.com/pulse/solving-resource-constrained-project-scheduling-problems-laborie/
Decision Optimization news blog @ IBM Developer: https://developer.ibm.com/docloud/blog/category/cplex/
Decision Optimization Github pages: https://github.com/IBMDecisionOptimization https://github.ibm.com/IBMDecisionOptimization
