CPLEX and CPO file formats with DO Experiments in Cloud Pak for Data

AlainChabrier
5 min readSep 17, 2021

--

Decision Optimization (DO) experiments UI in Watson Studio (WS) in Cloud Pak for Data support the development, debugging and validation of optimization models before they get deployed for production usage.

Data, model and problem — different types of formulation

The experiments UI (initially known as model builder) initially only supported Python docplex optimization models. Then the support for OPL models has been (re-)introduced. These two approaches are similar in the way the model formulation is clearly separated from the data, but we know that different users most times have strong preferences for one approach vs the other. OPL is a specialized language for optimization modelling which might be preferred by Operations Research experts, while docplex is a python package which might be preferred by Data Scientists already familiar with python. There are other pros and cons between these two approaches.

Historically, some other file formats have been used to describe mathematical optimization models, such as LP or MPS file formats. Those formats are in essence different as they allow to represent a complete optimization problem, where data and model have been already combined. While a Python docplex, or an OPL model represents a recurring business problem, and can be reused, with new data, as many times as the constraints definitions do not change, a LP or MPS formulation corresponds to one instance of this problem, with some instance of the data.

Model + Data → Problem

LP and MPS file formats are hence in general the result of using applications or modelling tools which are managing both the model and the data, and used as a media to connect to the optimization engine. These file formats are more or less standards which are understood by different optimization engines on the market. This seems to be the main reason why so many users are still using them.

Until now, while it was possible to use these files formats to create deployments and jobs in DO for WML, they could not be used in the model development tools. It is now possible to run these types of models in the experiments UI in Watson Studio.

How it works: basics.

You will need to log into Cloud Pak for Data as a Service, create a project and a Decision Optimization experiment.

In the experiment import model section, there are now 4 types of model, aligned with the types of deployments in DO for WML: Python, OPL, CPLEX, and CPO.

The 4 types of models.

With CPLEX for example, you can now import an existing .lp file and solve it.

Selecting an LP file to import.

For text file formats, an editor will appear with the imported model, meaning that the model can be edited and rerun!

Editor for my imported LP file.

When using file formats like .lp, .mps or .sav, the data is embedded into the problem formulation so that input data tables in the experiment should not be used.

The model can be solved by clicking on the Run button. The model will be solved exactly as with Python or OPL model, using the associated WML instance with the project and the associated deployment space with the DO experiment.

Results showing the status and objective value.

Depending on the type of model, different type of solution will be proposed. In this case, the solution.xml file can be downloaded to see all variables values but also information on solution and constraints.

The XML solution file can be downloaded.

Instead of downloading the file, you can also preview its content using the corresponding icon on the right.

solution.xml preview

All the statistics from the engine, and the log file are also available.

Engine statistics
Engine log

How it works: more!

Not only the readable LP file format is supported. Other readable CPLEX file formats like MPS are supported and binary file formats like .sav or even compressed such as .sav.gz are supported. In these later case of course, no preview nor edition capabilities are available.

SAV model without preview

Beside the LP file, it is still possible to add additional files, such as a .prm file to set some parameters to be taken into account when solving the model. Other types of additional files are possible such as MIP Starts.

Adding CPLEX parameters file

One main differentiator of IBM Decision Optimization is the availability of an additional optimization engine based on Constraint Programming, known as CP Optimizer. The experiments UI hence offers the possibility to import, view, edit and run CPO models.

CPO example model
CPO solution preview

For more stories about AI and DO, or DO in Cloud Pak for Data follow me on Medium, Twitter or LinkedIn.

--

--

AlainChabrier

Former Decision Optimization Senior Technical Staff Member at IBM Opinions are my own and I do not work for any company anymore.