Quick start: Build, run, and deploy a Decision Optimization model
Last updated: Nov 27, 2024
Quick start: Build, run, and deploy a Decision Optimization model
You can build and run Decision Optimization models to help you make the best decisions to solve business problems based on your objectives. Read about Decision Optimization, then watch a video and take a tutorial that’s suitable for users with
some knowledge of prescriptive analytics, but does not require coding.
Required services
watsonx.ai Studio
watsonx.ai Runtime
Your basic workflow includes these tasks:
Open your sandbox project. Projects are where you can collaborate with others to work with data.
Add a Decision Optimization Experiment to the project. You can add compressed files or data from sample files.
Associate a watsonx.ai Runtime Service with the project.
Create a deployment space to associate with the project's watsonx.ai Runtime Service.
Review the data, model objectives, and constraints in the Modeling Assistant.
Run one or more scenarios to test your model and review the results.
Deploy your model.
Read about Decision Optimization
Copy link to section
Decision Optimization can analyze data and create an optimization model (with the Modeling Assistant) based on a business problem. First, an optimization model is derived by converting a business problem into a mathematical formulation that
can be understood by the optimization engine. The formulation consists of objectives and constraints that define the model that the final decision is based on. The model, together with your input data, forms a scenario. The optimization engine
solves the scenario by applying the objectives and constraints to limit millions of possibilities and provides the best solution. This solution satisfies the model formulation or relaxes certain constraints if the model is infeasible. You
can test scenarios using different data, or by modifying the objectives and constraints and re-running them and viewing solutions. Once satisfied you can deploy your model.
Watch a video about creating a Decision Optimization model
Copy link to section
Watch this video to see how to run a sample Decision Optimization experiment to create, solve, and deploy a Decision Optimization model
with watsonx.ai Studio and watsonx.ai Runtime.
Video disclaimer: Some minor steps and graphical elements in this video might differ from your platform. The user interface is frequently improved.
This video provides a visual method to learn the concepts and tasks in this documentation.
Try a tutorial to create a model that uses Decision Optimization
This tutorial will take approximately 30 minutes to complete.
Expand all sections
Tips for completing this tutorial Here are some tips for successfully completing this tutorial.
Use the video picture-in-picture
Copy link to section
Tip: Start the video, then as you scroll through the tutorial, the video moves to picture-in-picture mode. Close the video table of contents for the best experience with picture-in-picture. You can use picture-in-picture
mode so you can follow the video as you complete the tasks in this tutorial. Click the timestamps for each task to follow along.
The following animated image shows how to use the video picture-in-picture and table of contents features:
For the optimal experience completing this tutorial, open Cloud Pak for Data in one browser window, and keep this tutorial page open in another browser window to switch easily between the two applications. Consider arranging the two browser
windows side-by-side to make it easier to follow along.
Tip: If you encounter a guided tour while completing this tutorial in the user interface, click Maybe later.
Task 1: Open a project
You need a project to store the data and the AutoAI experiment. You can use your sandbox project or create a project.
From the Navigation Menu, choose Projects > View all projects
Open your sandbox project. If you want to use a new project:
Click New project.
Select Create an empty project.
Enter a name and optional description for the project.
To preview this task, watch the video beginning at 00:20.
Now, follow these steps to create the Decision Optimization experiment in your project:
From your new project, click New asset > Solve optimization problems.
Select Local file.
Click Get sample files to view the GitHub repository containing the sample files.
In the DO-Samples repository, open the watsonx.ai and Cloud Pak for Data as a Service folder.
Click the HouseConstructionScheduling.zip file containing the house construction sample files.
Click Download to save the zip file to your computer.
Return to the Create a Decision Optimization experiment page, and click Browse.
Select the HouseConstructionScheduling.zip file from your computer.
Click Open.
If you don't already have a watsonx.ai Runtime service associated with this project, click Add a Machine Learning service.
Review your watsonx.ai Runtime service instances. You can use an existing service, or create a new service instance from here: click New service, select watsonx.ai Runtime, and click Create.
Select your watsonx.ai Runtime instance from the list, and click Associate.
If necessary, click Cancel to return to the Services & integrations page.
Choose a deployment space to associate with this experiment. If you do not have an existing deployment space, create one:
In the Select deployment space section, click New deployment space.
In the Name field, type House sampleCopied to clipboard to provide a name for the deployment space.
Click Create.
When the space is ready, and click Close to return to the Create a Decision Optimization experiment page. Your new deployment space is selected.
Click Create to open the Decision Optimization experiment.
Check your progress
Copy link to section
The following image shows the experiment with the sample files.
Task 3: Build a model and visualize a scenario result
To preview this task, watch the video beginning at 01:47.
Follow these steps to build a model and visualize the result using the Decision Optimization Modeling Assistant.
In the left pane, click Build model to open the Modeling Assistant. This model was built with the Modeling Assistant so you can see that the objectives and constraints are in natural language, but you can also formulate
your model in Python, OPL or import CPLEX and CPO models.
Click Run to run the scenario to solve the model and wait for the run to complete.
When the run completes, the Explore solution view displays. Under the Results tab, click Solution assets to see the resulting (best) values for the decision variables. These solution tables are displayed
in alphabetical order by default.
In the left pane, select Visualization.
Under the Solutions tab, select Gantt to view the scenario with the optimal schedule.
Check your progress
Copy link to section
The following image shows the Visualization page with a Gantt chart.
Task 4: Change model objectives and constraints
To preview this task, watch the video beginning at 03:01.
Now, you want to make a change to your model formulation to consider an additional objective. Follow these steps to change the model objectives and constraints:
Click Build model.
In the left pane, click the Overflow menu next to Scenario 1, and select
Duplicate.
For the name, type Scenario 2Copied to clipboard, and click Create.
For Scenario 2, add an objective to the model to optimize the quality of work based on the expertise of each contractor.
Under Add to model, in the search field, type overall qualityCopied to clipboard, and press Enter.
Expand the Objective section.
Click Maximize overall quality of Subcontractor-Activity assignments according to table of assignment values to add it as an objective. This new objective is now listed under the Objectives section along
with the Minimize time to complete all Activities objective.
For the objective that you just added, click table of assignment values, and select Expertise. A list of Expertise parameters displays.
From this list, click definition to change the field that defines contractor expertise, and select Skill Level.
Click Run to run the scenario to build the model and wait for the run to complete.
Return to the Explore solution page to view the Objectives and Solution assets.
In the left pane, select Visualization.
Under the Solutions tab, select Gantt to view the scenario with the optimal schedule.
Click Overview in the left pane to compare statistics between Scenario 1 and Scenario 2.
Check your progress
Copy link to section
The following image shows the Visualization page with the new Gantt chart.
Task 5: Deploy the model
To preview this task, watch the video beginning at 04:07.
Next, follow these steps to promote the model to a deployment space, and create a deployment:
Click the Overflow menu next to Scenario 1, and select Save for deployment.
In the Model name field, type House ConstructionCopied to clipboard, and click Next.
Review the model information, and click Save.
After the model is successfully saved, a notification bar displays with a link to the model. Click View in project.
If you miss the notification, then click the project name in the navigation trail.
Click the Assets tab in the project.
Click the House Construction model.
Click the Promote to deployment space icon .
For the Target space, select House sample (or your deployment space) from the list.
Check the option to Check Go to the model in the space after deploying it.
Click Promote.
After the model is successfully promoted, the House Construction model displays in the deployment space.
Click New deployment.
For the deployment name, type House deploymentCopied to clipboard.
For the Hardware definition, select 2 CPU and 8 GB RAM from the list.
Click Create.
Wait for the deployment status to change to Deployed.
Check your progress
Copy link to section
The following image shows the House deployment.
Task 6: Test a model
To preview this task, watch the video beginning at 04:55.
To test the model with a scenario, you must upload data files from your computer to the deployment space. Follow these steps to test the model by creating a job using the CSV files included with the sample zip file:
Click House sample (or your deployment space) in the navigation trail to return to the deployment space.
Click the Assets tab.
In the HouseConstructionScheduling.zip file on your computer, you will find several CSV files in the .containers > Scenario 1 folder.
Click the Upload asset icon to open the Data panel.
Drag the Subcontractor.csv, Activity.csv, and Expertise.csv files into the Drop files here or browse for files to upload area in the Data panel.
Click the Deployments tab.
Click House deployment.
Now to submit a job to score the model, click New job.
For the job name, type House construction jobCopied to clipboard.
Click Next.
Select the default values on the Configure page, and click Next.
Select the default values on the Schedule page, and click Next.
Select the default values on the Notify page, and click Next.
On the Choose data page, in the Input section, select the corresponding data assets that you previously loaded into your space for each input ID.
In the Output section, you will provide the name for each solution table to be created.
For Output ID ScheduledActivities.csv, click Select data source > Create new, type ScheduledActivities.csvCopied to clipboard for the name, and click Confirm.
For Output ID NotScheduledActivities.csv, click Select data source > Create new, type NotScheduledActivities.csvCopied to clipboard for the name, and click Confirm.
For Output ID stats.csv, click Select data source > Create new, type stats.csvCopied to clipboard for the name, and click Confirm.
For Output ID kpis.csv, click Select data source > Create new, type kpis.csvCopied to clipboard for the name, and click Confirm.
For Output ID solution.json, click Select data source > Create new, type solution.jsonCopied to clipboard for the name, and click Confirm.
For Output ID log.txt, click Select data source > Create new, type log.txtCopied to clipboard for the name, and click Confirm.
Review the information on the Choose data page, and then click Next.
Review the information on the Review and create page, and then click Create and run.
From the House deployment model page, click the job that you created named House construction job to see its status.
After the job run completes, click House sample (or your deployment space) to return to the deployment space.
On the Assets tab, you will see the output files:
ScheduledActivities.csv
NotScheduledactivities.csv
stats.csv
kpis.csv
solution.json
log.txt
For each of these assets, click the Download icon, and then view each of these files.
Check your progress
Copy link to section
The following image shows the completed batch job.
Next steps
Copy link to section
Now you can use this data set for further analysis. For example, you or other users can do any of these tasks:
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.