Last updated: Oct 09, 2024
This tutorial shows you how to generate multiple scenarios from a notebook using randomized data. Generating multiple scenarios lets you test a model by exposing it to a wide range of data.
About this task
The files used in this example are in the DO-samples project. The model concerned is
StaffPlanning
and the notebook is
CopyAndSolveScenarios
.
Note: To create and run Optimization models, you must have
both a Machine Learning service added to your project and a
deployment space that is associated with your experiment:
- Add a Machine Learning service to your project. You can either add this service at the project level (see Creating a Watson Machine Learning Service instance), or you can add it when you first create a new Decision Optimization experiment: click Add a Machine Learning service, select, or create a New service, click Associate, then close the window.
- Associate a deployment space with your Decision Optimization experiment (see Deployment spaces). A deployment space can be created or selected when you first create a new Decision Optimization experiment: click Create a deployment space, enter a name for your deployment space, and click Create. For existing models, you can also create, or select a space in the Overview information pane.
Procedure
To create and solve a scenario using a sample:
- Download and extract all the DO-samples on to your machine. You can also download just the StaffPlanning.zip file from the Model_Builder subfolder for your product and version, 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 task > Solve optimization problems in the Work with models section.
- Click Local file in the Solve optimization problems window that opens.
- Browse to choose the StaffPlanning.zip file in the Model_Builder folder. Select the relevant product and version subfolder in your downloaded DO-samples. For watsonx select the folder Watson Studio Public.
- If you haven't already associated a Machine Learning 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 Create. A Decision Optimization model is created with the same name as the sample.
-
Working in Scenario 1 of the
StaffPlanning
model, you can see that the solution contains tables to identify which resources work which days to meet expected demand.If there is no solution displayed, or to rerun the model, click Build model in the sidebar, then click Run to solve the model.