CPLEX and CPO file formats with DO Experiments in Cloud Pak for Data
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.
With CPLEX for example, you can now import an existing .lp file and solve it.
For text file formats, an editor will appear with the imported model, meaning that the model can be edited and rerun!
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.
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.
Instead of downloading the file, you can also preview its content using the corresponding icon on the right.
All the statistics from the engine, and the log file are also available.
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.
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.
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.
For more stories about AI and DO, or DO in Cloud Pak for Data follow me on Medium, Twitter or LinkedIn.