decision_optimization_client.Client

class decision_optimization_client.Client

Bases: object

The class to access Experiments in Decision Optimization.

To use the client in Cloud Pak For Data:

from decision_optimization_client import Client
client = Client()

To use the client in Cloud Pak For Data as a Service:

from decision_optimization_client import Client
client = Client(pc=pc) # with pc being the project context

or if you want to access another project:

from decision_optimization_client import Client
client = Client(project_id="project id string",
                authorization="bearer authorization token")

Then use the following method to retrieve one or more experiments:

Example

To return the list of experiments:

from decision_optimization_client import Client

client = Client()
# get list of available experiments
containers = client.get_experiments()
__init__(api_url=None, authorization=None, refresh_token=None, project_id=None, max_retries=3, proxies=None, cognitive_url=None, pc=None, apikey=None, verify=None)

Creates a new Decision Optimization scenario client.

Parameters
  • authorization (str, optional) – The authorization key.

  • max_retries (int, optional) – maximum number of retries. Default is 3.

  • proxies (dict, optional) – Optional dictionary mapping protocol to the URL of the proxy.

  • pc (object, mandatory only in Cloud Pak for Data as a Service) – Project context

  • apikey (str, optional) – IAM api key

  • verify (boolean, optional) – override http’s verify property

get_experiment(name=None, id=None)

Returns the decision Experiment metadata.

Parameters

name (optional) – The name of the Experiment to look for

Returns

an Experiment

get_experiments(name=None)

Returns the list of decision Experiments.

Parameters

name – An optional parameter. If given, only the Experiments for which names match name are returned.

Returns

a list of Experiment

stop_solve(container)

Stops the solve for a scenario.