Solving OPL models on the cloud

IBM Decision Optimization for Watson Machine Learning and IBM Decision Optimization on Cloud make it possible to solve OPL models on the cloud. The preferred method to run models on the cloud is using Watson Machine Learning.

Models available for the cloud

Some of the OPL models can be run on the cloud from the IDE. In the New Example wizard, most of the models are "cloud ready". To work with an example that has been adapted for the cloud, select File > Import > Example, and then IBM ILOG OPL Examples. Click the tab Sorted by Feature, and expand the DOcplexcloud ready list.

Example Wizard showing the "DOcplexcloud ready" option for example models that can be solved in a cloud environment.

The run configuration of a model can contain zero or any number of plain .dat files (that is, a .dat file with no Excel statement, or no DB Link statement). The code in a standalone .mod file must be cloud compliant (it does not require access to your disk).

Setup for Watson Machine Learning

Create a WML service instance to deploy models

Note:

You need to register for an IBM Cloud account before completing these steps.

  1. Log in to https://cloud.ibm.com.
  2. In the search field, enter Machine Learning.
  3. Create an instance of the Machine Learning service using the plan of your choice.
  4. Once you’ve created the instance, click Service credentials.
  5. On the Service credentials page, click New credential.

Keep your web browser open and logged into https://cloud.ibm.com.

Create a Cloud Object Storage instance to store results

  1. Still logged into https://cloud.ibm.com, enter Object Storage in the search field.
  2. Create an instance of Cloud Object Storage using the plan of your choice.
  3. Once you’ve created the instance, click Service credentials.
  4. On the Service credentials pages, click New credential.
  5. Check the box Include HMAC Credential and click Add.

Keep your web browser open and logged into https://cloud.ibm.com.

Set your preferences in CPLEX Optimization Studio

  1. Launch the CPLEX Optimization Studio IDE but keep your browser open and logged in to your IBM Cloud account.
  2. In the IDE, select Window > Preferences > OPL > Watson Machine Learning.
  3. In IBM Cloud, in your Cloud Object Storage instance, click View credentials beside the service credentials that you created earlier.
  4. Click the Copy icon icon showing copyto copy the credentials to the clipboard.
  5. In the CPLEX Optimization Studio IDE, click the underlined link in the sentence “Click here to paste WML or COS JSON credentials” to paste your Object Storage credentials. Your Access Key and Secret Key are added to the Preferences dialog.
  6. Click the underlined link in the sentence “Click here to select Endpoint” and select, for example, the second us-south option from the list then click OK.
  7. Back in IBM Cloud, navigate to your Machine Learning service instance and click Service credentials.
  8. Click View credentials beside the service credentials that you create earlier, then click the icon showing copy copy icon to copy the credentials to the clipboard.
  9. In the CPLEX Optimization Studio IDE, click the underlined link in the sentence “Click here to paste WML or COS JSON credentials” to paste your Watson Machine Learning credentials.

    Your API Key, Base URL, and Instance ID are added to the Preferences dialog.

  10. In the Authentication URL field at the top of the dialog, enter:

    https://iam.bluemix.net

  11. Click Apply and Close.

Running a model in cloud mode

If you select Cloud mode in a settings file, and run a model in your local IDE, all non compliant cloud features will raise an error. This setting helps you develop a model for the cloud on your local machine by checking the local solve more thoroughly. When you run a model with the Watson Machine Learning option, this setting detects OPL statements that are not supported on the cloud although they are supported on premises.

Setting for cloud mode in the IDE

To run a model on the cloud, select the run configuration and right-click to display the menu. Select the option Run this on Watson Machine Learning.

Option for a run configuration: Run this on Watson Machine Learning

Monitoring jobs in the IDE

The Watson Machine Learning tab in the IDE displays the status of an executed run configuration. Only a run configuration containing a tuple set as a post processing structure will provide a report.

Watson Machine Learning job status tab in the IDE

Accessing results or logs

Once you've run a job in the IDE, you can import results or logs by right-clicking the job name in the Watson Machine Learning tab and selecting the appropriate option.

Import results or logs dialog