ibm-research/WatsonxDocsQARetrieval huggingface dataset:
# Decision Optimization Java models #

You can create and run  Decision Optimization models in Java by using the  Watson Machine Learning REST API\.

You can build your  Decision Optimization models in Java or you can use  Java worker to package CPLEX, CPO, and OPL models\.

For more information about these models, see the following reference manuals\.

<!-- <ul> -->

 *  [Java CPLEX reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cplex.help/refjavacplex/html/overview-summary.html)
 *  [Java CPO reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cpo.help/refjavacpoptimizer/html/overview-summary.html)
 *  [Java OPL reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.ide.help/refjavaopl/html/overview-summary.html)

<!-- </ul> -->

To package and deploy  Java models in  Watson Machine Learning, see [Deploying Java models for Decision Optimization](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployJava.html) and the boilerplate provided in the [Java worker GitHub](https://github.com/IBMDecisionOptimization/cplex-java-worker/blob/master/README.md)\.

<!-- </article "role="article" "> -->
# Decision Optimization notebooks #

You can create and run  Decision Optimization models in Python  notebooks by using  DOcplex, a native Python API for  Decision Optimization\. Several  Decision Optimization notebooks are already available for you to use\.

The  Decision Optimization environment currently supports `Python 3.10`\. The following Python environments give you access to the Community Edition of the CPLEX engines\. The Community Edition is limited to solving problems with up to 1000 constraints and 1000 variables, or with a search space of 1000 X 1000 for Constraint Programming problems\.

<!-- <ul> -->

 *  `Runtime 23.1 on Python 3.10 S/XS/XXS`
 *  `Runtime 22.2 on Python 3.10 S/XS/XXS`

<!-- </ul> -->

To run larger problems, select a runtime that includes the full CPLEX commercial edition\. The  Decision Optimization environment ( DOcplex) is available in the following runtimes (full CPLEX commercial edition):

<!-- <ul> -->

 *  `NLP + DO runtime 23.1 on Python 3.10` with `CPLEX 22.1.1.0`
 *  `DO + NLP runtime 22.2 on Python 3.10` with `CPLEX 20.1.0.1`

<!-- </ul> -->

You can easily change environments (runtimes and Python version) inside a  notebook by using the  Environment tab (see [Changing the environment of a notebook](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/notebook-environments.html#change-env))\. Thus, you can formulate optimization models and test them with small data sets in one environment\. Then, to solve models with bigger data sets, you can switch to a different environment, without having to rewrite or copy the  notebook code\.

Multiple examples of  Decision Optimization notebooks are available in the   Samples, including:

<!-- <ul> -->

 *  The Sudoku example, a Constraint Programming example in which the objective is to solve a 9x9 Sudoku grid\.
 *  The Pasta Production Problem example, a Linear Programming example in which the objective is to minimize the production cost for some pasta products and to ensure that the customers' demand for the products is satisfied\.

<!-- </ul> -->

These and more examples are also available in the **jupyter** folder of the **[DO\-samples](https://github.com/IBMDecisionOptimization/DO-Samples)**

All  Decision Optimization notebooks use  DOcplex\.

<!-- </article "role="article" "> -->
# Supported data sources in  Decision Optimization #

Decision Optimization supports the following relational and nonrelational data sources on \.  watsonx\.ai\.

<!-- <ul> -->

 *  [IBM data sources](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/DOconnections.html?context=cdpaas&locale=en#DOConnections__ibm-data-src)
 *  [Third\-party data sources](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/DOconnections.html?context=cdpaas&locale=en#DOConnections__third-party-data-src)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# OPL models #

You can build OPL models in the  Decision Optimization experiment UI in  watsonx\.ai\.

In this section:

<!-- <ul> -->

 *  [Inputs and Outputs](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/OPLmodels.html?context=cdpaas&locale=en#topic_oplmodels__section_oplIO)
 *  [Engine settings](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/OPLmodels.html?context=cdpaas&locale=en#topic_oplmodels__engsettings)

<!-- </ul> -->

To create an OPL model in the  experiment UI, select  in the model selection window\. You can also import OPL models from a file or import a scenario \.zip file that contains the OPL model and the data\. If you import from a file or scenario \.zip file, the data must be in  \.csv format\. However, you can import other file formats that you have as project assets into the  experiment UI\. You can also import data sets including connected data into your project from the model builder in the [Prepare data view](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__section_preparedata)\.

For more information about the OPL language and engine parameters, see:

<!-- <ul> -->

 *  [OPL language reference manual](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.ide.help/OPL_Studio/opllangref/topics/opl_langref_modeling_language.html)
 *  [OPL Keywords](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/opl_keywords_top.html)
 *  [A list of CPLEX parameters](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cplex.help/CPLEX/Parameters/topics/introListTopical.html)
 *  [A list of CPO parameters](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cpo.help/CP_Optimizer/Parameters/topics/paramcpoptimizer.html)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Sample models and notebooks for  Decision Optimization #

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  Samples\.

Quick links:

<!-- <ul> -->

 *  [Examples used in this documentation](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/docExamples.html?context=cdpaas&locale=en#Examples__docexamples)
 *  [Decision Optimization experiment samples (Modeling Assistant, Python, OPL)](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/docExamples.html?context=cdpaas&locale=en#Examples__section_modelbuildersamples)
 *  [Jupyter notebook samples](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/docExamples.html?context=cdpaas&locale=en#Examples__section_xrg_fdj_cgb)
 *  [Python notebooks in the Samples](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/docExamples.html?context=cdpaas&locale=en#Examples__section_pythoncommunity)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Formulating and running a model: house construction scheduling #

This tutorial shows you how to use the  Modeling Assistant to define, formulate and run a model for a house construction scheduling problem\. The completed model with data is also provided in the **DO\-samples**, see [Importing Model Builder samples](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/docExamples.html#Examples__section_modelbuildersamples)\.

In this section:

<!-- <ul> -->

 *  [Modeling Assistant House construction scheduling tutorial](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/exhousebuild.html?context=cdpaas&locale=en#cogusercase__section_The_problem)
 *  [More about the model view](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/exhousebuild.html?context=cdpaas&locale=en#cogusercase__section_tbl_kdj_t1b)
 *  [Generating a Python notebook from your scenario](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/exhousebuild.html?context=cdpaas&locale=en#cogusercase__section_j2m_xnh_4bb)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Modeling Assistant models #

You can model and solve  Decision Optimization problems using the  Modeling Assistant (which enables you to formulate models in natural language)\. This requires little to no knowledge of Operational Research (OR) and does not require you to write Python code\. The  Modeling Assistant is **only available in English** and is not globalized\.

The basic workflow to create a model with the  Modeling Assistant and examine it under different scenarios is as follows:

<!-- <ol> -->

1.  Create a project\.
2.  Add a Decision Optimization  experiment (a scenario is created by default in the  experiment UI)\.
3.  Add and import your data into the scenario\.
4.  Create a natural language model in the scenario, by first selecting your  decision domain and then using the  Modeling Assistant to guide you\.
5.  Run the model to solve it and explore the solution\.
6.  Create visualizations of solution and data\.
7.  Copy the scenario and edit the model and/or the data\.
8.  Solve the new scenario to see the impact of these changes\.

<!-- </ol> -->

![Workflow showing the previously mentioned steps](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/images/new_overviewcognitive-3.jpg)

This is demonstrated with a simple [planning and scheduling example ](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/exhousebuild.html#cogusercase)\.

For more information about deployment see \.

<!-- </article "role="article" "> -->
# Selecting a Decision domain in the  Modeling Assistant #

There are different  decision domains currently available in the  Modeling Assistant and you can be guided to choose the right  domain for your problem\.

Once you have added and imported your data into your model, the  Modeling Assistant helps you to formulate your optimization model by offering you suggestions in natural language that you can edit\. In order to make intelligent suggestions using your data, and to ensure that the proposed model formulation is well suited to your problem, you are asked to start by selecting a  decision domain for your model\.

If you need a  decision domain that is not currently supported by the  Modeling Assistant, you can still formulate your model as a Python  notebook or as an OPL model in the  experiment UI editor\.

<!-- </article "role="article" "> -->
# Create new scenario #

To solve with different versions of your model or data you can create new scenarios in the  Decision Optimization experiment UI\.

## Procedure ##

To create a new scenario:

<!-- <ol> -->

1.  Click the **Open scenario pane** icon ![Open scenario pane button](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/images/CPDscenariomanage.jpg) to open the **Scenario** panel\. 
2.  Use the  Create Scenario drop\-down menu to create a new scenario from the current one\.
3.  Add a name for the duplicate scenario and click **Create**\.
4.  Working in your new scenario, in the  Prepare data view, open the `diet_food` data table in full mode\.
5.  Locate the entry for *Hotdog* at row 9, and set the `qmax` value to 0 to exclude hot dog from possible solutions\.
6.  Switch to the **Build model** view and run the model again\.
7.  You can see the impact of your changes on the solution by switching from one scenario to the other\.

<!-- </ol> -->

<!-- </article "role="article" "> -->
# Working with multiple scenarios #

You can generate multiple scenarios to test your model against a wide range of data and understand how robust the model is\.

This example steps you through the process to generate multiple scenarios with a model\. This makes it possible to test the performance of the model against multiple randomly generated data sets\. It's important in practice to check the robustness of a model against a wide range of data\. This helps ensure that the model performs well in potentially stochastic real\-world conditions\.

The example is the `StaffPlanning` model in the **DO\-samples**\.

The example is structured as follows:

<!-- <ul> -->

 *  The model `StaffPlanning` contains a default scenario based on two default data sets, along with five additional scenarios based on randomized data sets\.
 *  The Python  notebook`CopyAndSolveScenarios` contains the random generator to create the new scenarios in the `StaffPlanning` model\.

<!-- </ul> -->

For general information about scenario management and configuration, see [Scenario pane](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__scenariopanel) and [Overview](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__section_overview)\.

For information about writing methods and classes for scenarios, see the [ Decision Optimization Client Python API documentation](https://ibmdecisionoptimization.github.io/decision-optimization-client-doc/)\.

<!-- </article "role="article" "> -->
# Generating multiple scenarios #

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\.

## Procedure ##

To create and solve a scenario using a sample:

<!-- <ol> -->

1.  Download and extract all the **[DO\-samples](https://github.com/IBMDecisionOptimization/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\.
2.  Open your project or create an empty project\.
3.  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\. 
4.  Select the    Assets tab\.
5.  Select   New asset > Solve optimization problems in the   Work with models section\.
6.  Click  Local file in the   Solve optimization problems window that opens\.
7.  Browse to choose the  StaffPlanning\.zip file in the **Model\_Builder** folder\.  Select the relevant product and version subfolder in your downloaded  DO\-samples\. 
8.  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\.
9.  Click **Create**\.A  Decision Optimization model is created with the same name as the sample\.
10. 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\.

<!-- </ol> -->

<!-- </article "role="article" "> -->
# Input and output data #

You can access the input and output data you defined in the  experiment UI by using the following dictionaries\.

The data that you imported in the **Prepare data view** in the  experiment UI is accessible from the input dictionary\. You must define each table by using the syntax `inputs['tablename']`\. For example, here food is an entity that is defined from the table called `diet_food`:

    food = inputs['diet_food']

Similarly, to show tables in the  Explore solution  view of the  experiment UI you must specify them using the syntax `outputs['tablename']`\. For example,

    outputs['solution'] = solution_df

defines an output table that is called `solution`\. The entity `solution_df` in the Python model defines this table\.

You can find this Diet example in the  Model\_Builder folder of the [DO\-samples](https://github.com/IBMDecisionOptimization/DO-Samples)\. To import and run (solve) it in the  experiment UI, see [Solving and analyzing a model: the diet problem](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Notebooks/solveModel.html#task_mtg_n3q_m1b)\.

<!-- </article "role="article" "> -->
# Python DOcplex models #

You can solve Python   DOcplex models in a  Decision Optimization experiment\.

The  Decision Optimization environment currently supports Python  3\.10\. The default version is Python  3\.10\. You can modify this default version on the Environment tab of the [Run configuration pane](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__section_runconfig) or from the [Overview](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__section_overview) information pane\.

The basic workflow to create a Python DOcplex model in  Decision Optimization, and examine it under different scenarios, is as follows:

<!-- <ol> -->

1.  Create a project\.
2.  Add data to the project\.
3.  Add a  Decision Optimization experiment (a scenario is created by default in the  experiment UI)\.
4.  Select and import your data into the scenario\.
5.  Create or import your Python model\.
6.  Run the model to solve it and explore the solution\.
7.  Copy the scenario and edit the data in the context of the new scenario\.
8.  Solve the new scenario to see the impact of the changes to data\.

<!-- </ol> -->

![Workflow showing previously mentioned steps](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Mdl_Assist/images/new_overviewcognitive-3.jpg)
<!-- </article "role="article" "> -->
# Solving and analyzing a model: the diet problem #

This example shows you how to create and solve a Python\-based model by using a sample\.

## Procedure ##

To create and solve a Python\-based model by using a sample:

<!-- <ol> -->

1.  Download and extract all the [DO\-samples](https://github.com/IBMDecisionOptimization/DO-Samples) on to your computer\. You can also download just the  diet\.zip file from the  Model\_Builder subfolder for your product and version, but in this case, do not extract it\.
2.  Open your project or create an empty project\.
3.  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\. 
4.  Select the    Assets tab\.
5.  Select   New asset > Solve optimization problems in the   Work with models section\.
6.  Click  Local file in the   Solve optimization problems window that opens\.
7.  Browse to find the  Model\_Builder folder in your downloaded  DO\-samples\.  Select the relevant product and version subfolder\. Choose the  Diet\.zip file and click  Open\. Alternatively use drag and drop\.
8.  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\.
9.  Click  New deployment space, enter a name, and click  Create (or select an existing space from the drop\-down menu)\.
10. Click **Create**\.A  Decision Optimization model is created with the same name as the sample\.
11. In the   Prepare data view, you can see the data assets imported\.These tables represent the min and max values for nutrients in the diet (`diet_nutrients`), the nutrients in different foods (`diet_food_nutrients`), and the price and quantity of specific foods (`diet_food`)\.
    
    ![Tables of input data in Prepare data view](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/images/Cloudpreparedata2.png)
12. Click   Build model in the sidebar to view your model\.The Python model minimizes the cost of the food in the diet while satisfying minimum nutrient and calorie requirements\.
    
    ![Python model for diet problem displayed in Run model view](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/images/newrunmodel3.png)
    
    Note also how the **inputs** (tables in the  Prepare data view) and the **outputs** (in this case the solution table to be displayed in the Explore solution  view) are specified in this model.
13. Run the model by clicking the **Run** button in the   Build model view\.

<!-- </ol> -->

<!-- </article "role="article" "> -->
# Run parameters and Environment #

You can select various run parameters for the optimization solve in the  Decision Optimization experiment UI\.

Quick links to sections:

<!-- <ul> -->

 *  [CPLEX runtime version](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_RunParameters/runparams.html?context=cdpaas&locale=en#RunConfig__cplexruntime)
 *  [Python version](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_RunParameters/runparams.html?context=cdpaas&locale=en#RunConfig__pyversion)
 *  [Run configuration parameters](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_RunParameters/runparams.html?context=cdpaas&locale=en#RunConfig__section_runconfig)
 *  [Environment for scenario](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_RunParameters/runparams.html?context=cdpaas&locale=en#RunConfig__section_runparamenv)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Decision Optimization #

IBM®  Decision Optimization gives you access to IBM's industry\-leading solution engines for mathematical programming and constraint programming\. You can build  Decision Optimization models either with  notebooks or by using the powerful  Decision Optimization experiment UI (Beta version)\. Here you can import, or create and edit models in Python, in OPL or with natural language expressions provided by the intelligent  Modeling Assistant (Beta version)\. You can also deploy models with  Watson Machine Learning\.

Data format
:   Tabular: `.csv`, `.xls`, `.json` files\. See [Prepare data view](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/modelbuilderUI.html#ModelBuilderInterface__section_preparedata)
    
    Data from [Connected data assets](https://dataplatform.cloud.ibm.com/docs/content/wsj/manage-data/connected-data.html)
    
    For deployment see [Model input and output data file formats](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/ModelIOFileFormats.html)

Data size
:   Any

<!-- </article "role="article" "> -->
# Delegating the  Decision Optimization solve to run on  Watson Machine Learning from Java or \.NET CPLEX or CPO models #

You can delegate the  Decision Optimization solve to run on  Watson Machine Learning from your Java or \.NET (CPLEX or CPO) models\.

Delegating the solve is only useful if you are building and generating your models locally\. You cannot deploy models and run jobs  Watson Machine Learning with this method\. For full use of Java models on  Watson Machine Learning use the  Java™ worker Important: To deploy and test models on  Watson Machine Learning, use the  Java worker\. For more information about deploying Java models, see the [Java worker GitHub](https://github.com/IBMDecisionOptimization/cplex-java-worker/blob/master/README.md)\.For the library and documentation for:

<!-- <ul> -->

 *  Java CPLEX or CPO models\. See [Decision Optimization GitHub DOforWMLwithJava](https://github.com/IBMDecisionOptimization/DOforWMLwithJava)\.
 *  \.NET CPLEX or CPO models\. See [Decision Optimization GitHub DOforWMLWith\.NET](https://github.com/IBMDecisionOptimization/DOForWMLWith.NET)\.

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Deployment steps #

With IBM  Watson Machine Learning you can deploy your  Decision Optimization prescriptive model and associated common data once and then submit job requests to this deployment with only the related transactional data\. This deployment can be achieved by using the  Watson Machine Learning REST API or by using the  Watson Machine Learning Python client\.

See [REST API example](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployModelRest.html#task_deploymodelREST) for a full code example\. See [Python client examples](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployPythonClient.html#topic_wmlpythonclient) for a link to a Python  notebook available from the  Samples\.

<!-- </article "role="article" "> -->
# Deploying  Java models for  Decision Optimization #

You can deploy  Decision Optimization Java models in  Watson Machine Learning by using the  Watson Machine Learning REST API\.

With the  Java worker API, you can create optimization models with OPL, CPLEX, and CP Optimizer Java APIs\. Therefore, you can easily create your models locally, package them and deploy them on Watson Machine Learning by using the boilerplate that is provided in the public [Java worker GitHub](https://github.com/IBMDecisionOptimization/cplex-java-worker/blob/master/README.md)\.

The  Decision Optimization[Java worker GitHub](https://github.com/IBMDecisionOptimization/cplex-java-worker/blob/master/README.md) contains a boilerplate with everything that you need to run, deploy, and verify your Java models in  Watson Machine Learning, including an example\. You can use the code in this repository to package your  Decision Optimization Java model in a `.jar` file that can be used as a  Watson Machine Learning model\. For more information about  Java worker parameters, see the [Java documentation](https://github.com/IBMDecisionOptimization/do-maven-repo/blob/master/com/ibm/analytics/optim/api_java_client/1.0.0/api_java_client-1.0.0-javadoc.jar)\.

You can build your  Decision Optimization models in Java or you can use  Java worker to package CPLEX, CPO, and OPL models\.

For more information about these models, see the following reference manuals\.

<!-- <ul> -->

 *  [Java CPLEX reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cplex.help/refjavacplex/html/overview-summary.html)
 *  [Java CPO reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.cpo.help/refjavacpoptimizer/html/overview-summary.html)
 *  [Java OPL reference documentation](https://www.ibm.com/docs/en/SSSA5P_22.1.1/ilog.odms.ide.help/refjavaopl/html/overview-summary.html)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Python client examples #

You can deploy a  Decision Optimization model, create and monitor jobs, and get solutions by using the  Watson Machine Learning Python client\.

To deploy your model, see [Model deployment](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/ModelDeploymentTaskCloud.html)\.

For more information, see [Watson Machine Learning Python client documentation](https://ibm.github.io/watson-machine-learning-sdk/core_api.html#deployments)\.

See also the following sample  notebooks located in the  jupyter folder of the **[DO\-samples](https://github.com/IBMDecisionOptimization/DO-Samples)**\.  Select the relevant product and version subfolder\.\.

<!-- <ul> -->

 *  Deploying a DO model with WML
 *  RunDeployedModel
 *  ExtendWMLSoftwareSpec

<!-- </ul> -->

The  Deploying a DO model with WML sample shows you how to deploy a  Decision Optimization model, create and monitor jobs, and get solutions by using the  Watson Machine Learning Python client\. This  notebook uses the diet sample for the  Decision Optimization model and takes you through the whole procedure without using the  Decision Optimization experiment UI\.

The  RunDeployedModel shows you how to run jobs and get solutions from an existing deployed model\. This  notebook uses a model that is saved for deployment from a  Decision Optimization experiment UI scenario\.

The  ExtendWMLSoftwareSpec notebook shows you how to extend the  Decision Optimization software specification within  Watson Machine Learning\. By extending the software specification, you can use your own pip package to add custom code and deploy it in your model and send jobs to it\.

You can also find in the samples several  notebooks for deploying various models, for example CPLEX, DOcplex and OPL models with different types of data\.

<!-- </article "role="article" "> -->
# Model execution #

Once your model is deployed, you can submit  Decision Optimization jobs to this deployment\.

You can submit jobs specifying the:

<!-- <ul> -->

 *  **Input data**: the transaction data used as input by the model\. This can be inline or referenced
 *  **Output data**: to define how the output data is generated by model\. This is returned as inline or referenced data\.
 *  **Solve parameters**: to customize the behavior of the solution engine

<!-- </ul> -->

For more information see [Model input and output data adaptation](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/ModelIODataDefn.html#topic_modelIOAdapt)

After submitting a job, you can use the job\-id to poll the job status to collect the:

<!-- <ul> -->

 *  Job execution status or error message
 *  Solve execution status, progress and log tail
 *  Inline or referenced output data

<!-- </ul> -->

**Job states** can be : `queued`, `running`, `completed`, `failed`, `canceled`\.

<!-- </article "role="article" "> -->
# Output data definition #

When submitting your job you can define what output data you want and how you collect it (as either inline or referenced data)\.

For more information about output file types and names see [Model input and output data file formats](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/ModelIOFileFormats.html#topic_modelIOFileFormats)\.

Some output data definition examples:

<!-- <ul> -->

 *  To collect solution\.csv output as inline data:
    
        "output_data": [{
             "id":"solution.csv"
        }]
 *  Regexp can be also used as an identifier\. For example to collect all csv output files as inline data:
    
        "output_data": [{
             "id":".*\.csv"
        }]
 *  Similarly for reference data, to collect all csv files in COS/S3 in job specific folder, you can combine regexp and $\{job\_id\} and $\{ attachment\_name \} place holder
    
        "output_data_references": [{
             "id":".*\.csv",
             "type": "connection_asset",
             "connection": {
                      "id" : <connection_guid>
             },
             "location": {
        		"bucket": "XXXXXXXXX",
        		"path": "${job_id}/${attachment_name}"					}
        }]
    
    For example, here if you have a job with identifier <XXXXXXXXX> to generate a solution.csv file, you will have in your COS/S3 bucket, a XXXXXXXXX / solution.csv file.

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Running jobs #

Decision Optimization uses  Watson Machine Learning asynchronous APIs to enable jobs to be run in parallel\.

To solve a problem, you can create a new job from the model deployment and associate data to it\. See [Deployment steps](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployIntro.html#topic_wmldeployintro) and the [REST API example](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployModelRest.html#task_deploymodelREST)\.  You are not charged for deploying a model\. Only the solving of a model with some data is charged, based on the running time\.

To solve **more than one job** at a time, specify more than one node when you create your deployment\. For example in this [REST API example](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment/DeployModelRest.html#task_deploymodelREST__createdeploy), increment the **number of the nodes** by changing the value of the nodes property: `"nodes" : 1`\.

<!-- <ol> -->

1.  The new job is sent to the queue\.
2.  If a POD is started but idle (not running a job), it immediately begins processing this job\.
3.  Otherwise, if the maximum number of nodes is not reached, a new POD is started\. (Starting a POD can take a few seconds)\. The job is then assigned to this new POD for processing\.
4.  Otherwise, the job waits in the queue until one of the running PODs has finished and can pick up the waiting job\.

<!-- </ol> -->

The configuration of PODs of each size is as follows:

<!-- <table "summary="" id="topic_paralleljobs__table_etc_n5v_f5b" class="defaultstyle" "> -->

Table 1\. T\-shirt sizes for Decision Optimization

| Definition        | Name | Description |
| ----------------- | ---- | ----------- |
| 2 vCPU and 8 GB   | S    | Small       |
| 4 vCPU and 16 GB  | M    | Medium      |
| 8 vCPU and 32 GB  | L    | Large       |
| 16 vCPU and 64 GB | XL   | Extra Large |

<!-- </table "summary="" id="topic_paralleljobs__table_etc_n5v_f5b" class="defaultstyle" "> -->

For all configurations, 1 vCPU and 512 MB are reserved for internal use\.

In addition to the solve time, the pricing depends on the selected size through a multiplier\.

In the deployment configuration, you can also set the maximal number of nodes to be used\.

Idle PODs are automatically stopped after some timeout\. If a new job is submitted when no PODs are up, it takes some time (approximately 30 seconds) for the POD to restart\.

<!-- </article "role="article" "> -->
# Decision Optimization #

When you have created and solved your  Decision Optimization models, you can deploy them using  Watson Machine Learning\.

See the [Decision Optimization experiment UI](https://dataplatform.cloud.ibm.com/docs/content/DO/DODS_Introduction/buildingmodels.html#topic_buildingmodels) for building and solving models\. The following sections describe how you can deploy your models\.

<!-- </article "role="article" "> -->
# Visualizations layout and terms #

Canvas
:   The canvas is the area of the   Visualizations dialog where you build the chart\.

Chart type
:   Lists the available chart types\. The graphic elements are the items in the chart that represent data (bars, points, lines, and so on)\.

Details pane
:   The Details pane provides the basic chart building blocks\.
    
    Chart settings
    :   Provides options for selecting which variables are used to build the chart, distribution method, title and subtitle fields, and so on. Depending on the selected chart type, the Details pane options might vary. For more information, see [Chart types](https://dataplatform.cloud.ibm.com/docs/content/dataview/chart_creation_charttypes.html).

Actions
:   Provides options for downloading chart configuration files, downloading charts as image files, resetting charts, and setting the global chart preferences\.

<!-- </article "role="article" "> -->
# Candlestick charts #

Candlestick charts are a style of financial charts that are used to describe price movements of a security, derivative, or currency\. Each candlestick element typically shows one day\. A one\-month chart might show the 20 trading days as 20 candlesticks elements\. Candlestick charts are most often used in the analysis of equity and currency price patterns and are similar to box plots\.

The data set that is used to create a candlestick chart must contain open, high, low, and close values for each time period you want to display\.

<!-- </article "role="article" "> -->
# Dual Y\-axes charts #

A dual Y\-axes chart summarizes or plots two Y\-axes variables that have different domains\. For example, you can plot the number of cases on one axis and the mean salary on another\. This chart can also be a mix of different graphic elements so that the dual Y\-axes chart encompasses several of the different chart types\. Dual Y\-axes charts can display the counts as a line and the mean of each category as a bar\.
<!-- </article "role="article" "> -->
# Evaluation charts #

Evaluation charts are similar to histograms or collection graphs\. Evaluation charts show how accurate models are in predicting particular outcomes\. They work by sorting records based on the predicted value and confidence of the prediction, splitting the records into groups of equal size (quantiles), and then plotting the value of the criterion for each quantile, from highest to lowest\. Multiple models are shown as separate lines in the plot\.

Outcomes are handled by defining a specific value or range of values as a "hit"\. Hits usually indicate success of some sort (such as a sale to a customer) or an event of interest (such as a specific medical diagnosis)\.

Flag
:   Output fields are straightforward; hits correspond to `true` values\.

Nominal
:   For nominal output fields, the first value in the set defines a hit\.

Continuous
:   For continuous output fields, hits equal values greater than the midpoint of the field's range\.

Evaluation charts can also be cumulative so that each point equals the value for the corresponding quantile plus all higher quantiles\. Cumulative charts usually convey the overall performance of models better, whereas noncumulative charts often excel at indicating particular problem areas for models\.

<!-- </article "role="article" "> -->
# Building a chart from the chart type gallery #

Use chart type gallery for building charts\. Following are general steps for building a chart from the gallery\.

<!-- <ol> -->

1.  In the  Chart Type section, select a chart category\. A preview version of the selected chart type is shown on the chart canvas\.
2.  If the canvas already displays a chart, the new chart replaces the chart's axis set and graphic elements\.
    
    <!-- <ol> -->
    
    1.  Depending on the selected chart type, the available variables are presented under a number of different headings in the Details pane (for example,  Category for bar charts,  X-axis and  Y-axis for line charts). Select the appropriate variables for the selected chart type.
    
    <!-- </ol> -->
    
3.  Click the  Save visualization to project control to save the visualization to the project\. You can select to also  Create a new asset from the visualization, provide a visualization asset name, description, and chart name\.
4.  Click  Apply to save the visualization to the project\. The new visualization asset is now available under the  Assets tab\.

<!-- </ol> -->

<!-- </article "role="article" "> -->
# Histogram charts #

A histogram is similar in appearance to a bar chart, but instead of comparing categories or looking for trends over time, each bar represents how data is distributed in a single category\. Each bar represents a continuous range of data or the number of frequencies for a specific data point\.

Histograms are useful for showing the distribution of a single scale variable\. Data are binned and summarized by using a count or percentage statistic\. A variation of a histogram is a frequency polygon, which is like a typical histogram except that the area graphic element is used instead of the bar graphic element\.

Another variation of the histogram is the population pyramid\. Its name is derived from its most common use: summarizing population data\. When used with population data, it is split by gender to provide two back\-to\-back, horizontal histograms of age data\. In countries with a young population, the shape of the resulting graph resembles a pyramid\.

Footnote
:   The chart footnote, which is placed beneath the chart\.

XAxis label
:   The x\-axis label, which is placed beneath the x\-axis\.

YAxis label
:   The y\-axis label, which is placed above the y\-axis\.

<!-- </article "role="article" "> -->
# Line charts #

A line chart plots a series of data points on a graph and connects them with lines\. A line chart is useful for showing trend lines with subtle differences, or with data lines that cross one another\. You can use a line chart to summarize categorical variables, in which case it is similar to a bar chart (see [Bar charts](https://dataplatform.cloud.ibm.com/docs/content/dataview/chart_creation_barcharts.html#chart_creation_barcharts) )\. Line charts are also useful for time\-series data\.
<!-- </article "role="article" "> -->
# Scatter plots and dot plots #

Several broad categories of charts are created with the point graphic element\.

Scatter plots
:   Scatter plots are useful for plotting multivariate data\. They can help you determine potential relationships among scale variables\. A simple scatter plot uses a 2\-D coordinate system to plot two variables\. A 3\-D scatter plot uses a 3\-D coordinate system to plot three variables\. When you need to plot more variables, you can try overlay scatter plots and scatter plot matrices (SPLOMs)\. An overlay scatter plot displays overlaid pairs of X\-Y variables, with each pair distinguished by color or shape\. A SPLOM creates a matrix of 2\-D scatter plots, with each variable plotted against every other variable in the SPLOM\.

Dot plots
:   Like histograms, dot plots are useful for showing the distribution of a single scale variable\. The data are binned, but, instead of one value for each bin (like a count), all of the points in each bin are displayed and stacked\. These graphs are sometimes called density plots\.

Summary point plots
:   Summary point plots are similar to bar charts, except that points are drawn in place of the top of the bars\. For more information, see [Bar charts](https://dataplatform.cloud.ibm.com/docs/content/dataview/chart_creation_barcharts.html#chart_creation_barcharts)\.

Drop\-line charts
:   Drop\-line charts are a special type of summary point plot\. The points are grouped and a line is drawn through the points in each category\. The drop\-line chart is useful for comparing a statistic across categorical variables\.

<!-- </article "role="article" "> -->
# Time plots #

Time plots illustrate data points at successive intervals of time\. The time series you plot must contain numeric values and are assumed to occur over a range of time in which the periods are uniform\. Time plots provide a preliminary analysis of the characteristics of time series data on basic statistics and test, and thus generate useful insights about your data before modeling\. Time plots include analysis methods such as decomposition, augmented Dickey\-Fuller test (ADF), correlations (ACF/PACF), and spectral analysis\.
<!-- </article "role="article" "> -->
# t\-SNE charts #

T\-distributed Stochastic Neighbor Embedding (t\-SNE) is a machine learning algorithm for visualization\. t\-SNE charts model each high\-dimensional object by a two\-or\-three dimensional point in such a way that similar objects are modeled by nearby points and dissimilar objects are modeled by distant points with high probability\.
<!-- </article "role="article" "> -->
# Visualizing your data #

You can discover insights from your data by creating visualizations\. By exploring data from different perspectives with visualizations, you can identify patterns, connections, and relationships within that data and quickly understand large amounts of information\.

Data format
:   Tabular: Avro, CSV, JSON, Parquet, TSV, SAV, Microsoft Excel \.xls and \.xlsx files, SAS, delimited text files, and connected data\.
    
    For more information about supported data sources, see [Connectors](https://dataplatform.cloud.ibm.com/docs/content/wsj/manage-data/conn_types.html).

Data size
:   No limit

You can create graphics similar to the following example that shows how humidity values over time\.

![Example visualization](https://dataplatform.cloud.ibm.com/docs/content/dataview/viz_main.png)

<!-- </article "role="article" "> -->
# IBM Cloud services in the  IBM watsonx services catalog #

You can provision  IBM® Cloud service instances for the  watsonx platform\.

The  IBM watsonx\.ai component provides the following services that provide key functionality, including tools and compute resources:

<!-- <ul> -->

 *  [Watson™ Studio](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/wsl.html)
 *  [Watson Machine Learning](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/wml.html)

<!-- </ul> -->

If you signed up for  watsonx\.ai, you already have these services\. Otherwise, you can create instances of these services from the Services catalog\.

If you signed up for  watsonx\.governance, you already have this service\. Otherwise, you can create an instance of this service from the Services catalog\.

The [IBM Cloud Object Storage](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/cloud-object-storage.html) provides storage for projects and deployment spaces on the  IBM watsonx platform\.

The [Secure Gateway](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/secure-gateway.html) service provides secure connections to on\-premises date sources\.

These services provide databases that you can access in  IBM watsonx by creating connections:

<!-- <ul> -->

 *  [IBM Analytics Engine](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/spark.html)
 *  [Cloudant](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/cloudant.html)
 *  [Databases for Elasticsearch](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/elasticsearch.html)
 *  [Databases for EDB](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/edb.html)
 *  [Databases for MongoDB](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/mongodb.html)
 *  [Databases for PostgreSQL](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/postgresql.html)
 *  [Db2®](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/db2oltp.html)
 *  [Db2 Warehouse](https://dataplatform.cloud.ibm.com/docs/content/svc-welcome/db2wh.html)

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Watson Machine Learning on  IBM watsonx #

Watson Machine Learning is part of  IBM® watsonx\.ai\.  Watson Machine Learning provides a full range of tools for your team to build, train, and deploy Machine Learning models\. You can choose the tool with the level of automation or autonomy that matches your needs\. Watson Machine Learning provides the following tools:

<!-- <ul> -->

 *  AutoAI experiment builder for automatically processing structured data to generate model\-candidate pipelines\. The best\-performing pipelines can be saved as a machine learning model and deployed for scoring\.
 *  Deployment spaces give you the tools to view and manage model deployments\.
 *  Tools to view and manage model deployments\.

<!-- </ul> -->

<!-- </article "role="article" "> -->
# Working with your data #

To see a quick sample of a flow's data, right\-click a node a select  Preview\. To more thoroughly examine your data, use a Charts node to launch the chart builder\.

With the chart builder, you can use advanced visualizations to explore your data from different perspectives and identify patterns, connections, and relationships within your data\. You can also visualize your data with these same charts in a Data Refinery flow\.

Figure 1\. Sample visualizations available for a flow

![Shows four example charts available in Visualizations](https://dataplatform.cloud.ibm.com/docs/content/wsd/images/charts_thumbnail4.png)

For more information, see [Visualizing your data](https://dataplatform.cloud.ibm.com/docs/content/wsj/refinery/visualizations.html)\.

<!-- </article "role="article" "> -->