Tutorial: Running a Notebook that uses Decision Optimization in DSX

This tutorial shows you how to run the sample notebooks provided with DSX on Integrated Analytics System (IAS) that use the Decision Optimization service. Decision Optimization gives you access to IBM's world-leading solution engines for mathematical programming and constraint programming.

For more information, see Decision Optimization in DSX.

This tutorial shows you how to carry out the following tasks:

Restriction: If your IAS does not have internet access, you will need to locally install the CPLEX Optimizer library that is used by the Decision Optimization service. That procedure is not covered by this tutorial.

Time required

10 minutes

Scenario

You are a data scientist who wants to create or run an analytics notebook that makes use of the Decision Optimization service.

Difficulty

Beginner

Audience

Data scientists or anyone interested in exploring DSX Decision Optimization on Integrated Analytics System.

Prerequisites

You will need to have a user account on Integrated Analytics System. If you don't have one, contact your Integrated Analytics System system administrator to create one for you. You will also need a user ID and password for DSX on that system as well as internet access and a valid ID for IBM Cloud.

Open a sample notebook involving Decision Optimization

Procedure

  1. Launch and log in to DSX on your Integrated Analytics System.
  2. On the DSX Community page, locate one of the following sample notebooks that make use of Decision Optimization:
    • Maximize oil company profits using decision optimization
    • Use decision optimization to help a sports league schedule its games
    • Golumb Ruler
    • How to make targeted offers to customers?
    • Sudoku
    • The Unit Commitment Problem
    • Balance inhouse and external production of pasta
    • Organize product delivery to customers using Decision Optimization
    • Solve a Generalized Assignment Problem using Lagrangian relaxation
    • Using the Progress Callbacks with CPLEX Optimizer
    • Sched Square
    • Building steel coils
  3. Once the notebook is displayed, click Open Notebook in the upper-right corner of the page.
    Attention: When the notebook opens, if you receive an error indicating that the Python3 kernel was not found, click OK to use the Python2 kernel.
    The notebook is opened for editing.

Register for the Decision Optimization service on IBM Cloud (DOcplexcloud)

You need to have access to a Decision Optimization service in order for the notebook to run successfully. You can register for a free trial of the Decision Optimization service on IBM Cloud.

Procedure

  1. In a new browser window, navigate to the Decision Optimization on Cloud home page.
  2. Scroll down and click Go to DOcplexcloud web site.
  3. Click Register for a Free Trial.
  4. Follow the prompts to register for your free trial of the Decision Optimization on Cloud service.
    After a successful registration, you will receive an email with information on how to access the Decision Optimization on Cloud service.

Get an API key and base URL for the Decision Optimization service and add it to your notebook

Procedure

  1. Click Launch Service in the email from the IBM Decision Optimization on Cloud team.
  2. On the Solve optimization problems online page, click Get API key & base URL to generate an API key and URL for use in your notebook.
  3. Copy the Base URL and API key values.
  4. In your notebook, locate the cell that contains the variables url and key.
  5. Replace the default variable values with the Base URL and API key values obtained from the Decision Optimization on Cloud page.
    Important: Put quotes around the new values, since they are string values.
    Your notebook should now have access to the Decision Optimization on Cloud service.

Run the notebook

Run each notebook cell in consecutive order. If you receive a No module named doclex.mp.environment error, restart the notebook kernel and execute the notebook cells again.

Results

The notebook should return results using the Decision Optimization service.