Examples and samples

Describes the examples presented in this documentation and the samples provided for IBM Watson Studio.

The Decision Optimization GitHub contains a repository of samples for use with IBM Watson Studio. These samples are to be used in the Decision Optimization model builder. This repository also contains Jupyter notebooks which can be imported into Watson Studio.

The following table shows examples provided in this documentation, which show you how to use Decision Optimization for Watson Studio.
Table 1. Decision Optimization documentation examples
  Examples

Learn how to ...

See

Create scheduling models using the Modeling Assistant

House Construction example

  • Create, edit and solve a planning and scheduling model with the Modeling Assistant
  • Create and examine different scenarios

Solving a model using the Modeling Assistant

Create Python optimization models using the Decision Optimization model builder

Diet example

  • Create and solve a Python model generated from an existing scenario
  • Create and examine a new scenario

Solving a Python DOcplex model

Multiple scenarios example

  • Create a Python model from a Python notebook imported into Decision Optimization and solve it
  • Generate multiple scenarios from a Python notebook using randomized data

Working with multiple scenarios

Create or import DOcplex Python notebooks

Decision Optimization notebook examples

  • Download a notebook and add it to a project
  • Run a notebook

Running Decision Optimization notebooks

Decision Optimization model builder samples (Modeling Assistant, Python, OPL)

The following table lists the Decision Optimization Models that are provided in DO-samples in the Decision Optimization GitHub. All these assets use the model builder and contain data.

To use these samples:
  1. Download and unzip the DO-samples from the Decision Optimization GitHub on to your machine.
  2. Create a project in IBM Watson Studio.
  3. Click Add to Project.
  4. Select Decision Optimization.
  5. Select the From file tab in the Decision Optimization model pane that opens.
  6. Click Add file. Then browse and choose your sample zip file from the Model_Builder folder in the DO-samples that you downloaded.
  7. Select a Machine Learning service instance. Or, if you have no service yet, click Associate a Machine Learning service instance with your project, select one and reload the page.
  8. Click Create.
A Decision Optimization model is created with the same name as the sample.

To run models you must associate a Watson Machine Learning instance with your Watson Studio project. To do this, in the Overview tab of your project, scroll to find the Associated deployment space section and click Add a Machine Learning service. In the window that opens, select a Machine Learning service from the drop-down list and click Select. If you have no associated service defined when you try to run a model, you obtain the error "Run FAILED: cannot deploy model to wml".

Table 2. Decision Optimization Models
Models for Decision Optimization Problem type Model type
Diet Blending Python
StaffPlanning Multi-Scenario Planning Python
BridgeScheduling Scheduling Modeling Assistant
HouseConstructionScheduling Scheduling with assignment Modeling Assistant
MarketingCampaignAssignment Resource Assignment (Scenarios 1 - 4)

Selection and Allocation (Scenario 4 - Selection)

Modeling Assistant
SupplyDemandPlanning Supply & Demand Planning Modeling Assistant
PortfolioAllocation Selection & Allocation Modeling Assistant
PastaProduction Production OPL

Python notebook samples

There are also Python notebooks provided in the Decision Optimization GitHub that do not use the model builder. To use these Python notebook samples :
  1. Download and unzip the DO-samples from the Decision Optimization GitHub on to your machine.
  2. Create a project in IBM Watson Studio.
  3. Click Add to Project.
  4. Select Notebook.
  5. Select the From file tab in the New Notebook pane that opens.
  6. Name your notebook and browse to select the notebook from the jupyter folder in the DO-samples that you downloaded.
  7. Click Create Notebook.

Python notebooks on the Watson Studio Community Page

Decision Optimization Python notebooks are available from the Community page of IBM Watson Studio. To use these in an existing project, open a notebook in the Community page, click the Add to project button, select your Project and click Create Notebook.