Several examples are presented in this documentation as tutorials. You can also use many other examples that are provided in the Decision Optimization GitHub, and in the Resource hub.
Quick links:
Decision Optimization GitHub DO-samples
See Decision Optimization GitHub for a repository of samples for use with IBM watsonx.ai. For Decision Optimization experiment UI samples, see the following section Decision Optimization experiment UI samples. This 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.
To run models, you must associate a watsonx.ai Runtime instance with your Project and associate a deployment space with your Decision Optimization experiment. You must also have the Editor or Admin role in the deployment space.
- 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.
- On the Manage tab of your project, select the Services and integrations section and click Associate service. Then select an existing Machine Learning service instance (or create a new one ) and click Associate. When the service is associated, a success message is displayed, and you can then close the Associate service window.
- Select the Assets tab.
- Select New asset > Solve optimization problems in the Work with models section.
- Click Local file in the Solve optimization problems window that opens.
- Browse to the Model_Builder folder in your downloaded DO-samples. Select the relevant product and version subfolder. Choose your sample .zip file and click Open. Alternatively drag the sample into the window.
- If you haven't already associated a watsonx.ai Runtime service with your project, you must first select Add a Machine Learning service to select or create one before you choose a deployment space for your experiment.
- 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 notebooks in the Work with models section.
- Select the From file tab in the new window that opens.
- Name your notebook, click Drag and drop files or upload and browse to the notebook in the jupyter folder in your downloaded DO-samples. Select the relevant product and version subfolder.
- Click Create. The notebook is added to your project.
Python notebooks in the Resource hub
Decision Optimization Python notebooks are available from the Resource hub. To use these notebooks in an existing project, open a notebook in the Resource hub, click Add to project, select your Project, and click Create.