Decision Optimization model builder views and scenarios

The Decision Optimization model builder is an interface with different views in which you can select data, create models and solve different scenarios and visualize the results. You can also save your scenarios for deployment from the model builder interface.

Note: To create and run Optimization models you must associate a deployment space with your experiment. This 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.

When you click Add to Project and choose Decision Optimization experiment as the asset type, you open the Decision Optimization model builder.

The Decision Optimization model builder allows you to create and solve prescriptive models. Optimization models allow you to focus on a specific business problem that you want to solve.

You can create a Decision Optimization model from scratch by simply entering a name or from a .zip file and then and selecting Create. Scenario 1 opens.

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.

Overview

The overview tab provides a summary information about all your scenarios (see Scenario pane for more information about scenarios). This is particularly useful when you have several scenarios, as it gives you model, data and solution information for all your scenarios at a glance. From this view you can create a scenario from scratch or from a file, or you can select a scenario and click the three dots to perform the following actions:
  • Duplicate a scenario.
  • Rename a scenario.
  • Export the scenario as a .zip file.
  • 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 the deployment).
  • Delete a scenario.

In this view when you click the information icon Information pane icon, the information pane opens showing you details about your experiment and the name of your associated deployment space. Here you can create a Machine Learning service and even add this service to your project if you haven't already done so. You can also create or choose a deployment space for your experiment so that you can use a different space for a particular solve. The creation date and name of the experiment creator is also provided here. This is useful if you are sharing an experiment created by another collaborator.

Overview pane showing 2 scenarios and info pane open

You can also configure this Overview pane by clicking the Settings icon Overview settings icon. This opens a pane where you can select the columns that you want to display in your Overview pane, and change the row height.

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 (Prepare data, Run model, Explore solution) 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 data view, you can see both these views on the same screen.

Prepare data view

When you create a new Decision Optimization experiment in your project, the Prepare data view opens. In this view you can browse and import data sets, including connected data, that you already have in your Project in Cloud Pak for Data. You can also choose to add data that you want to add to your project. Click add data and then Browse in the data pane that opens. Browse and select your files and click open to add them. When you add a data set in this way, it appears listed in the Prepare data view as well as in the Data assets listed in your project.

Select the files you want to import to your Scenario and click Import. You can import files in most formats including .csv, .xls, .json files, as well as connected data . If you are using Excel files with multiple sheets, only the first sheet will be imported. You can, however, export each sheet as a .csv file to import your data into the model builder.

Note: If your .cvs file contains any malicious payload (formulas for example) in an input field, these might be executed.

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 button in the Prepare data view, this will have no impact on your scenario unless you choose to import it into your scenario.

Prepare data view showing diet data

When you have imported your data files in to your scenario, the Prepare data view opens automatically. This view allows you to:
  • Rename or delete a table.
  • Edit the data directly in a table. You can scroll the table to see more rows (or Open the table in full mode to see the whole table and edit it in a new window)
  • 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 to remind you of which tables have been overwritten.

Changes you make in the Prepare data view will be saved in your scenario, but not in the Project Data sets. 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 data view.

You can access your imported data from your Python DOcplex model using the syntax inputs['tablename']. See Input and output data.

Run model view

Run model pane showing Python diet model

This 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 or OPL model in the Decision Optimization 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. Use this option to import a notebook from your project. If your notebook is running on a Jupyter customized environment (see Adding a customisation), when you import the notebook into the model builder, you also import this environment definition. This enables you to make use of additional Python libraries when running models from the model builder. This custom software definition will also be used when you deploy your model in Watson Machine Learning (both when saving your model for deployment and when promoting it to your deployment space).
  • Import and edit a Python optimization model from an external file. Use this option to import a Python file from your local machine.
  • Import and edit an OPL model from a file.
  • 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 Decision Optimization 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 Decision Optimization model builder your content is saved automatically and the Last saved time is displayed.

Once you have created a model, the Replace arrow Replace icon (arrow) appears. If you click this Replace arrow, 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 this view.

When you run a model from the Decision Optimization model builder the do_12.10 runtime is used.

You can also set and modify certain optimization parameters by clicking the Configure run icon next to the Run model button. These parameters will be then applied each time you click Run.

Multiple model files

You can create a Python or OPL model using multiple model files by clicking the + tab next to MODEL and selecting Add new empty or Upload Files... (to add any type of file). The tab named MODEL must always contain your main model. If you try to upload another file with the same name, for example model.py, you are prompted to upload it with new name or replace your main model. You can also replace a model by clicking the Import Import icon icon. See the Multifile example in the Model_Builder folder of the DO-samples.

Run configuration

When you click the Configure run icon next to the Run model button in the Run model view, a window opens showing you the currently set parameter values.

Run configuration pane for scenario 1

Here you can select and edit different run configuration parameters. For more details, see Run parameters.

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.

Explore solution view

Explore solution pane showing results for solved diet model

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 in the Explore solution view.

The Results section contains several tabs. The first tab shows the Objectives and KPIs. The Solutions tables tab shows the resulting (best) values for the decision variables. These solution tables are automatically displayed in alphabetic order. Note that these solution tables are not editable but can be filtered. See Table search and filtering. You can download both the objectives and solution tables

You can define output tables to appear in this view in a Python DOcplex model using the syntax outputs['tablename'], see Input and output data.

The Relaxations and Conflicts tabs show if there have been any conflicting constraints or bounds in the model and, if these options have been chosen, which constraints or bounds were relaxed in order to solve the model.

The Engine statistics tab shows you information about the run status (processed, stopped, or failed), graphical information about the solution, and model statistics.

Engine statistics tab showing solution for diet model.

The Log tab displays the log file from the CPLEX or CP Optimizer engines which you can also download.

Engine log tab showing log for diet model

For multi-objective models formulated with the Modeling Assistant, the solution table also displays the sliders, 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. The scaled weighted value is thus the objective function value multiplied by this weight factor.

Scenario pane

When you create a new Decision Optimization experiment, a scenario is automatically created along with the model. A scenario contains data sets, a model, and a solution.

You can use scenarios to:
  • 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
  • Save a model for deployment

Scenario panel showing 2 scenarios with scenario 2 information expanded.

The Scenario pane allows you to easily manage different scenarios of a Decision Optimization experiment.

To open the Scenario pane, click the Open scenario pane button Open scenario pane button.

In this pane, you can:
  • 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). This can be expanded or collapsed by clicking the arrow next to the scenario.
  • 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 the deployment).
  • Export the scenario as a .zip file.

If you click Generate a notebook from a scenario, the notebook is saved as an asset in your project. If you have used multiple files in the Run model view, these files are automatically referenced in the generated notebook so that you can read them from the notebook.

If you click Export as zip file, a scenario.json file is also included in the archive 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.

Clicking the arrow next to a scenario in this panel also reveals summary information about the data, model and solution.