Decision Optimization

 View Only

OPL Connector for Python (DOopl) available on GitHub

By Vincent Beraudier posted Wed June 22, 2022 09:39 AM

OPL Connector for Python (DOopl) available on GitHub

The OPL Connector for Python

The OPL Connector for Python (DOopl) is now available on the IBM Decision Optimization GitHub on

This very popular connector, available so far on the standard Python delivery channels ( and with previous CPLEX/CP Optimizer versions (up to 12.10), gives a simple access to Python inputs and outputs for an Operations Research (OR) expert using OPL.
With this connector, it is very simple to feed an OPL model with Python tuple lists or pandas dataframes and then to get the reporting tables, also as Python structures.

Until now, this connector was delivered on demand on a selected list of Python versions, CPLEX versions, and OS platforms.
To remove these limits in terms of supported platforms and capabilities, we have decided to expose the code and give it to the community.
You are free to fork/copy the code, and modify it according to the terms of the Apache license.

With this Apache V2 contribution, anyone will be able to modify the connector to use with any CPLEX Optimization Studio version on any platform.
We have provided instructions to build this connector with a Python interpreter and a CPLEX Optimization Studio installation.

DOopl capabilities

As a reminder, here is short summary of the capabilities:
  •  Inputs can be tuple lists, Pandas' dataframe, SQLAlchemy fetch statements (OPL inputs limited to tuplesets).
  • Generate, solve, and get output tuplesets as pandas' dataframes.
  • Get the CPLEX problem statistics and quality metrics for the solution.
  • Convert all integer variables to floating point variables and vice-versa.
  • Run the conflict/relaxation mechanism.
  • Call the 'run seeds' diagnosis for CPLEX and CP Optimizer problems.

Supported platforms

Current delivered code was validated with the 20.1 and 22.1 CPLEX Studio version on Windows, Mac OS and Linux with the latest active 3.x Python versions.

Deploy to the OPL model Cloud Pak for Data as a Service

Note also, that if your model runs fine with DOopl, then deploying it in Decision Optimization for Watson Machine Learning will be nearly straightforward and will enable you to use all the IBM Cloud Pak for Data capabilities.
Indeed, DOopl and DOforWML both accept OPL models with inputs/outputs limited to tabular input.
Moving from DOopl to CPDaaS will provide for example the following benefits:
  • Decision Optimization experiment UI
  • AI lifecycle components (datasources, data cleansing, machine learning...)