Sample models and notebooks for Decision
Optimization
Last updated: Nov 21, 2024
Decision Optimization sample models and notebooks
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.
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
Optimizationexperiment UI and contain data.
Note:
To run models, you must associate a watsonx.ai Runtime instance with your Project
and associate a deployment space with your Decision
Optimizationexperiment. You must also have the Editor or
Adminrole in the deployment space.
To use these samples:
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.
Table 2. Decision
Optimization
Models
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
Copy link to section
Jupyter notebooks are also provided in the
Decision Optimization GitHub that do not use the experiment UI. To use these Python 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
Copy link to section
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.