The Decision Optimizaiton for IBM Cloud service was retired in September 2020. There is a replacement service available on IBM Watson Machine Learning. You can read about this replacement here: https://www.ibm.com/cloud/blog/announcements/decision-optimization-now-available-in-watson-machine-learning-service
Decision Optimization for IBM Cloud (DOcplexcloud) allows to solve optimization problems on the cloud.
This sample shows how you can build a simple Node.js application that uses the Decision Optimization for IBM Cloud service. It demonstrates how to use the Node.js Client to submit a problem to the optimization solver engine (CPLEX), get the results and monitor your jobs.
There are two ways to deploy the sample to Bluemix, automatically in one click or by cloning the sample to your local environment
Note that you need to have an IBM Cloud account. Sign up for Bluemix, or use an existing account.
Click the button below:
Then just follow IBM Cloud instructions during & after deployment
Note that you need to have a IBM Cloud account. Sign up for IBM Cloud, or use an existing account.
Download and install the Cloud-foundry CLI tool
Clone the app to your local environment from your terminal using the following command
git clone https://github.com/IBM-Cloud/docplexcloud-helloworld-nodejs.git
cd into this newly created directory
Edit the manifest.yml
file and change the <application-name>
and <application-host>
from DOcplexcloud-app
to something unique.
applications:
- name: DOcplexcloud-app
host: DOcplexcloud-app
memory: 256M
- services:
- DOcplexcloud-service
The host you use will determinate your application url initially, e.g. <application-host>.mybluemix.net
.
Note: If you use a name other than DOcplexcloud-service
for the service name, you need to update this in the app.js
file.
Connect to Bluemix in the command line tool and follow the prompts to log in.
cf api https://api.ng.bluemix.net
cf login
Create the Decision Optimization for IBM Cloud service.
cf create-service docplexcloud ODSTRIAL DOcplexcloud-service
Push the application to Bluemix.
cf push
To work locally on your machine, copy the file vcap-local.template.json
to vcap-local.json
:
cp vcap-local.template.json vcap-local.json
Replace the credentials with values from your service
{
"docplexcloud" : [ {
"name" : "DOcplexcloud-service",
"label" : "docplexcloud",
"plan" : "ODSTRIAL",
"credentials" : {
"url" : "YOUR_BASE_URL",
"client_id" : "XXX",
"subscriptionId" : "YYY"
}
} ]
}
Install the server dependencies
npm install
Start the server
node app.js
The server starts locally, for instance on
This sample is delivered under the Apache License Version 2.0. See License.txt.
The DOcplexcloud NodeJS Sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:
Application Name (application_name)
Space ID (space_id)
Application Version (application_version)
Application URIs (application_uris)
This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.
Deployment tracking can be disabled by removing require("cf-deployment-tracker-client").track(); from the beginning of the app.js file.