The Model Builder interface
Introduction to the Decision Optimization for Watson Studio interface.
In this section:
When you add a new model to a project, you can choose between creating a Machine Learning model or a Decision Optimization model.
The Decision Optimization model builder allows you to create prescriptive models. Optimization models allow you to focus on a specific business problem that you want to solve.
With the Decision Optimization model builder, you can create several scenarios, using different data sets and optimization models. This allows you to create and compare different scenarios and see how big an impact changes can have on a given problem.
For each of the following views, you can organize your screen as full-screen or as a split-screen. To do this, hover over one of the view tabs (Select Data, Prepare, Run Model, Explore Solution) on the left, for a second or two. A menu then appears where you can select Full Screen, Left or Right. For example if you choose Left for the Select Data view, and then choose Right for the Prepare Input Data view, you can see both these views on the same screen.
Select Data view
When you create a new Decision Optimization model in your project, the Select Data view opens. In this view you can see data sets that you already have
in your Project in Watson Studio. You can also
choose to add data that you want to add to your model. Click add data set to browse and select
your files and click open. Note that only
csv files can be imported in
Decision Optimization for Watson Studio. When you add a data set in this
way, it appears listed in the Select Data view
as well as in the Data sets listed in your Project Assets. If you repeat this action at any time and
choose to upload a file with the same name as one already loaded in your project, you will replace
the current version of this file with the latest version you have added.
You can preview a table by clicking on it. This opens the table in a window, click either the Close or Select this data set buttons underneath the table (re-size your window if necessary) to close this window. Select the files you want to import to your Scenario and click Import.
If you subsequently modify, replace or delete a data set in your Project, or re-upload a new version of a table using the add data set button in the Select Data view, this will have no impact on your scenario unless you choose to import it into your scenario.
Prepare Input Data view
- Rename or delete a table.
- Edit the data directly in a table (in full or expanded table mode). First expand the table and then click the cell to edit it.
- Rename column names.
- Re-size columns.
- Add or remove rows.
- Search and filter table values. See Table search and filtering.
If you re-import a file at any time you can choose to import it with a new name. This can be useful if you want to use different versions of the same data table. You can also choose to update and overwrite the current table in your Scenario. If you choose to re-import and update a table, a notification message will appear at the top of the screen to remind you of which tables have been overwritten.
Changes you make in the Prepare Input Data view will be saved in your scenario, but not in the Project Data sets that are displayed in the Select Data view. Similarly if you make changes to the Project Data sets, unless you import these changes into your scenario, they will not appear in the Prepare Input Data view.
The Model view allows you to formulate or import optimization models and run them.
There are several options to create a model:
- Create and edit a Python model in the Model Builder.
- Use the Modeling Assistant to formulate models in natural language. See Formulating and running a model: house construction scheduling for a tutorial on formulating models with the Modeling Assistant.
- Import and edit a Python optimization model from an existing Notebook or from an external file. Use this option to import a Notebook from your local machine or to use a Notebook you have already imported into Decision Optimization for Watson Studio.
- Import an OPL model from a file. The OPL model cannot be edited in this version of the Model Builder, but if changes are needed you can download the file locally, edit it and re-import it.
- Import a scenario zip file (which contains both model and data). This can be a new scenario or one that you have previously exported from the Model Builder and edited locally.
- Generate a Python model from your current scenario (Python and Modeling Assistant models only). This will create a Python notebook optimization model in your project.
When you edit your model formulation in the Model Builder your content is saved automatically and the Last save time is displayed on the top of the page.
Once you have created a model, the Reinitialize option appears in the upper-left of the window. If you click Reinitialize, you return to the Model wizard. Note that if you create a new model, the previous one is deleted.
When you have finished editing your model, you can solve it by clicking the Run button in the Model view. You can also set and modify certain optimization parameters by clicking the Run Configuration icon next to the Run button. These parameters will be then applied each time you click Run.
When you click the Run Configuration icon next to the Run button in the Model view, a window opens showing you the currently set parameter values.
Here you can select and edit different run configuration parameters. For more details, see Run parameters and Decision Optimization environment.
Once you have set the run configuration parameters they will be used with those values for all subsequent runs for that scenario.
You can remove set parameters by hovering over the parameter and clicking the remove button.
The run configuration parameters are saved together with the model when you select Save as model for deployment from the Scenario panel. These parameters are subsequently used in the deployment service.
During the run, a graphical display shows the feasible solutions obtained until the optimal solution is found.
When your run completes successfully, the solution is displayed in one or several tables. The result tables are automatically displayed in alphabetic order. Note that the result tables are not editable but can be filtered. See Table search and filtering.
For multi-objective models formulated with the Modeling Assistant, the solution table also displays the slider weights and scale factors that were set in the model. The combined objective is the sum of all the objective values (positive additions for minimize objectives and negative for maximize objectives) multiplied by the scale factor (1 by default) and the weight factor. The weight factor is 2 to the power of the slider weight minus 1. For example, a slider weight of 5, the weight factor is 25-1= 24= 16.
In the Solution view, you can also find information about the run status (processed, stopped, or failed) and download run logs.
When you create a new Decision Optimization model, a scenario is automatically created along with the model. A scenario contains data sets, a model, and a solution.
- Make sure a specific model works with a variety of data
- See how different data sets impact the solution to a given problem
- See how a model formulation impacts the solution to a given problem
The Scenario panel allows you to easily manage scenarios in a Decision Optimization model.
To open the Scenario panel, click the Scenario button .
- Create new scenarios (create a new scenario from scratch, duplicate your current scenario or import a new scenario from a file).
- Select the scenario you want to work in.
- See existing scenarios and their details (input data, model, solution).
- Manage existing scenarios (duplicate, rename, delete).
- Generate a Python Notebook from a scenario.
- Save the scenario as a model for deployment ( any run configuration parameters that you might have set for that scenario will also be saved in deployment).
- Export the scenario as a zip file.
If you export the scenario as a zip file, a scenario.json file is also included in the zip which describes the exported model. If you make changes locally to this scenario (for example you add a table to your model), you can then edit this json file to include these changes and then re-import your scenario and these changes will appear in your scenario.
New scenarios can be imported by choosing From file in the Create Scenario menu and then selecting the zip file containing your new scenario.
You can also use this method to create a new scenario from a debug zip file that you have generated (see Custom Parameters) and downloaded. The debug zip file will provide you with a scenario containing data, model, solution and the run configuration parameters.
You can switch scenarios while running a model and see in the scenario pane which scenarios are running or are queued.
By default, when running a scenario all CPU core and
memory is used. To change this for a particular scenario use the run configuration parameters
oaas.jobMemoryMbytes from the Select
Parameters drop-down menu of the Run configuration window. This might enable you to run more
than one model at the same time. You can thus set different run configurations for each
scenario. See Run parameters and Decision Optimization environment for more
The Dashboard allows you to configure the graphical representation of input data and solutions for one or several scenarios. The Dashboard is common to all scenarios in a Decision Optimization model.
The Dashboard helps you compare the different scenarios you have created in order to validate models and business decisions.
The following widgets are available:
Add simple text notes to the Dashboard.
Present input data and solution in tables, with a search and filtering feature. See Table search and filtering.
Charts Widget and Vega Charts Widget
Present input data and solution in charts.
Display the solution to a scheduling problem in a Gantt chart.
This widget is only suitable for scheduling problems modeled with the Modeling Assistant. Apart from its title, this widget is not currently editable.
You can edit the widgets in the Dashboard Editor by clicking the Configure Widget (pencil) icon in a widget. You can then customize it either in the Editor or by editing the JSON code. The Editor allows you to easily change the name of your widget and select the source of the data you want to display in your dashboard. The JSON editor gives you more advanced editing possibilities. As you make changes to a widget in the Dashboard Editor, a preview is also displayed showing you your changes. You can then choose to save your changes by clicking OK which will close the Dashboard Editor. Or you can select Cancel to abandon your changes.
For more information about the JSON widget syntax, refer to the following section: Dashboard widgets syntax.
You can download your dashboard as a JSON file, containing the dashboard definition and the data, making it easier for you to share your findings with your collaborators.
You can create different dashboard pages for different scenarios or combine scenarios on the same page.
You can add pages to your dashboard by double-clicking the plus sign. You can then customize what is displayed on each page. To edit a page, click the Edit Dashboard (pencil) icon in the upper-right of the dashboard. In the Dashboard Editor you can edit the page name, reorder and add pages. Clicking OK in the Dashboard Editor saves your updates and closes the editor. Or you can select Cancel to abandon your changes. To delete a page, click the page tab and a delete button appears in the tab.
Table search and filtering
You can filter tables (in both Prepare Input Data view and the Dashboard) by clicking the search
icon and entering a value to search on. You can also specify a column name, colon and a value. For
example, if you enter
food:hot in the
search field, the table will be filtered to display only the rows that contain the food "hot". In
this example you will obtain just one row that contains the food
Hotdog. You can
also enter the prefix of a column name, for example
fo:hot will obtain the same
food:hot. The column name is optional, so you can also just enter
hot in this case. If the column name is not specified, all columns are searched and
the corresponding rows are obtained. For example if you enter 0, in the
diet_food_nutrients table you obtain 4 rows which contain this value in one of the
columns. You can also filter using numeric values as follows:
|Enter in search field||Result: rows displayed containing column values|
|column_name:12||equal to 12|
|column_name:10..||greater than or equal to 10|
|column_name:..10||less than or equal to 10|
|column_name:15..25||between 15 and 25|