0 / 0
Deploying a Decision Optimization model
Last updated: Nov 28, 2024
Decision Optimization model deployment

To deploy a Decision Optimization model, create a model ready for deployment in your deployment space and then upload your model as an archive. When deployed, you can submit jobs to your model and monitor job states.

Before you begin

You must have an IBM Cloud account. See https://www.ibm.com/cloud/.
  1. Log in to IBM Cloud.
  2. Create your API key. Copy or download it from the API key successfully created open window (you cannot access it again when you close this window).

  3. Optional: Create a watsonx.ai Runtime service.
  4. Select a watsonx.ai Runtime instance from the list of AI/Machine Learning services in the IBM Cloud Resource list view.

    Copy the Name, GUID, and CRN from the information pane for your watsonx.ai Runtime instance. (To open the information pane, click anywhere in the row next to your watsonx.ai Runtime service name, but not on the name itself. The information pane then opens in the same window.)

  5. Optional: Create a Cloud Object Storage.
  6. Select a Cloud Object Storage instance from the list of Storage resources in the IBM Cloud Resource list view.

    Copy the Name and CRN from the information pane for your storage instance.

  7. Optional: Create a deployment space, from the https://dataplatform.cloud.ibm.com user interface. You can also create a deployment space by using the REST API. See Creating a deployment space using the REST API.
  8. Select a deployment space from the list of Deployments.

    Copy the Space GUID from the Manage > General tab. For more information, see Deployment spaces.

About this task

These instructions assume that you have already built your Decision Optimization model.

Procedure

To deploy a Decision Optimization model:

  1. Package your Decision Optimization model formulation, with any settings or master data files, ready for deployment as a tar.gz, .zip, or .jar file.
    Your archive can include the following optional files:
    1. Your model files

      For Python or OPL models, these files usually contain your model formulation. However, you can also choose to omit these files, especially when your model and data are integrated in the same file. For example, for CPLEX (.lp files), CPO (.cpo files), and mps format models, to avoid resolving the same mode, you can send these files later in the job.

    2. Settings files

      For more information, see Run parameters.

    3. Master data

      These files contain any data that can be reused by all jobs. Including such data files can make deployment jobs more efficient. For example, you can include a data file for values that remain constant, such as distances between towns. You can include this data file in the deployment so that you provide it only once and not at each job request.

    Note: For Python models with multiple .py files, put all files in the same folder in your archive. The same folder must contain a main file called main.py. Do not use subfolders.
  2. Create a model ready for deployment and provide the following information:
    • watsonx.ai Runtime service instance
    • Deployment space instance
    • the hardware specification for the available configuration sizes (small S, medium M, large L, extra large XL). See configurations.
    • Software specification (Decision Optimization runtime version):
      • do_22.1 runtime is based on CPLEX 22.1.1.0
      • do_20.1 runtime is based on CPLEX 20.1.0.1

      You can extend the software specification that is provided by the watsonx.ai Runtime service. See the ExtendWMLSoftwareSpec notebook in the jupyter folder of the DO-samples.

      Updating CPLEX runtimes:

      If you previously deployed your model with a CPLEX runtime that is no longer supported, you can update your existing deployed model by using either the REST API or the UI.

    • The model type:
      • opl (do-opl_<runtime version>)
      • cplex (do-cplex_<runtime version>)
      • cpo (do-cpo_<runtime version>)
      • docplex (do-docplex_<runtime version>) using Python 3.11 or 3.10 (deprecated)

      (The runtime version can be one of the available Decision Optimization runtime versions so, for example, an opl model with runtime 22.1 has the model type do-opl_22.1.)

    You obtain a MODEL-ID.

    Your model can be used in one or multiple deployments.

  3. Upload your model archive (tar.gz, .zip, or .jar file). See Model input and output data file formats for Decision Optimization for information about input file types.
  4. Deploy your model by using the MODEL-ID, SPACE-ID, and the hardware specification for the available configuration sizes (small S, medium M, large L, extra large XL). See configurations. You can also specify the number of nodes to be used (the default value is 1).
    You obtain a DEPLOYMENT-ID.
  5. Monitor the deployment by using the DEPLOYMENT-ID. Deployment states can be: initializing, updating, ready, or failed.

Results

You are ready to submit and monitor jobs to your deployment. For more information, see Decision Optimization batch deployment and model execution.

Example

See the Deploying a DO model with WML sample for an example of how to deploy a Decision Optimization model, create and monitor jobs, and get solutions by using the watsonx.ai Runtime 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. This sample and the RunDeployedModel and ExtendWMLSoftwareSpec notebooks are located in the jupyter folder of the DO-samples. Select the relevant product and version subfolder. When downloaded, you can add these Jupyter notebooks to your project.

See also the REST API example.

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more