Sample models and notebooks for Decision Optimization
Several examples are presented in this documentation as tutorials. You can also use many other examples that are provided in the Decision Optimization GitHub.
Quick links:
Decision Optimization GitHub DO-samples
See Decision Optimization GitHub for a repository of samples for use with IBM watsonx.ai. Select the relevant product and version subfolder. For watsonx on-premises, use samples from the Cloud Pak for Data v5.1.x subfolder.
For Decision Optimization experiment UI samples, see the following section Decision Optimization experiment samples (Python, OPL, Modeling Assistant). The Decision Optimization GitHub repository also contains Jupyter notebook samples that can be imported into watsonx.ai. See Jupyter notebooks.
Java example
See the Java model example provided in the Decision Optimization Java worker boilerplate in the Java™ worker GitHub.
Examples described in this documentation
The following table lists example models that are described in this documentation, and that show you how to use Decision Optimization.
Examples |
Learn how to ... |
See |
|
---|---|---|---|
Create scheduling models by using the Modeling Assistant. |
House Construction example |
|
|
Create Python optimization models by using the Decision Optimization experiment UI. |
Diet example |
|
|
Multiple scenario example |
|
||
Create or import DOcplex Python notebooks. |
Decision Optimization notebook examples |
|
Decision Optimization experiment samples (Python, OPL, Modeling Assistant)
For a step-by-step guide to build, solve and deploy a Decision Optimization model, by using the user interface, see the Quick start tutorial with video.
The following table lists the Decision Optimization samples that are provided in DO-samples in the Decision Optimization GitHub. All these assets use the Decision Optimization experiment UI and contain data.
- Download and extract all the DO-samples on to your computer. You can also download just the one sample, but in this case, do not extract it.
- Open your project or create an empty project.
- Select the Assets tab.
- Select New asset > Solve optimization problems in the Work with models section.
- Click Local file in the Create a Decision Optimization experiment window that opens.
- Browse to the Model_Builder folder in your downloaded DO-samples. Select the relevant product and version subfolder. For watsonx on-premises, use samples from the Cloud Pak for Data v5.1.x subfolder. Choose your sample .zip file and click Open. Alternatively drag the sample into the window.
- Click New deployment space, enter a name, and click Create (or select an existing space from the drop-down menu).
- Click Create.
A Decision Optimization model is created with the same name as the sample.
Models for Decision Optimization | Problem type | Model type |
---|---|---|
BridgeScheduling | Scheduling | Modeling Assistant |
Diet | Blending | Python |
DietLP | Blending | LP (CPLEX) |
EnvironmentAndExtension | Using an environment with an extension that contains a library file and YAML code. | Python |
HouseConstructionScheduling | Scheduling with assignment | Modeling Assistant |
IntermediateSolutions | Enabling intermediate solutions for CPLEX and CPO models | Python |
MarketingCampaignAssignment | Resource Assignment (Scenarios 1 - 4) Selection and Allocation (Scenario 4 - Selection) |
Modeling Assistant |
Multifiles | Using a model with multiple files. | Python and LP |
PastaProduction | Production | OPL |
PortfolioAllocation | Selection & Allocation | Modeling Assistant |
PythonEngineSettings | Geometrical puzzle with customized engine settings | Python |
ShiftAssignment | Resource Assignment with custom decisions and a custom constraint | Modeling Assistant |
StaffPlanning | Multi-Scenario Planning (to be used with CopyAndSolveScenarios.ipynb) |
Python |
SupplyDemandPlanning | Supply & Demand Planning | Modeling Assistant |
TalentCPO | Movie scheduling | CPO (CP Optimizer) |
Jupyter notebook samples
- Download and extract all the DO-samples on to your computer. You can also download just one sample.
- Open your project or create an empty project.
- Select the Assets tab.
- Select New asset > Work with data and models in Python or R in the Work with models section.
- Select the From file tab in the New Notebook pane that opens.
- Name your notebook, click Drag and drop files here or upload, and browse to the notebook in the jupyter folder in your downloaded DO-samples. Select the relevant product and version subfolder. For watsonx on-premises, use samples from the Cloud Pak for Data v5.1.x subfolder.
- Click Create. The notebook is added to your project.