https://github.com/ibmdecisionoptimization/cplex-java-worker
https://github.com/ibmdecisionoptimization/cplex-java-worker
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ibmdecisionoptimization/cplex-java-worker
- Owner: IBMDecisionOptimization
- License: apache-2.0
- Created: 2023-01-27T10:55:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-20T14:34:02.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T07:47:01.259Z (almost 2 years ago)
- Language: Java
- Size: 43.9 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cplex-java-worker
This project demonstrates the development, testing, deployment and verification of a Decision Optimization Java worker in Watson Machine Learning in the following products:
* Cloud Pak for Data as a Service,
* Watsonx.ai,
* Cloud Pak for Data 4.8.x or later.
## 1. Install the development environment:
- [Install JAVA 17 JDK](https://developer.ibm.com/languages/java/semeru-runtimes/downloads).
- [Install Apache Maven](https://maven.apache.org/install.html) for mvn command.
- [Install Conda or any Python](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) and add the Python executable file name to your PATH.
- [Install IBM watsonx.ai Python client](https://ibm.github.io/watsonx-ai-python-sdk/install.html) with `pip install ibm-watsonx-ai`.
- [Install IBM ILOG CPLEX Optimization Studio](https://www.ibm.com/products/ilog-cplex-optimization-studio) (The compilation and modeling can be done with the [Community Edition of CPLEX](https://www.ibm.com/account/reg/us-en/signup?formid=urx-20028) that is freely available.)
## 2. Set up the development environment:
This section describes how you will configure your maven pom.xml and settings.
- Set up the cplex_version property that you target in the pom.xml file and install the corresponding CPLEX or CP jar in your local maven repository. For example, if you target `cplex_version=22.1`, to install the cplex-jar in your maven local repository, use the following command:
```
mvn install:install-file "-Dfile=%CPLEX_STUDIO_DIR%\cplex\lib\cplex.jar" -DgroupId=com.ibm.ilog.optim -DartifactId=cplex-jar -Dversion=22.1 -Dpackaging=jar
```
and to install the cpo-jar in your maven local repository:
```
mvn install:install-file "-Dfile=%CPLEX_STUDIO_DIR%\cpoptimizer\lib\ILOG.CP.jar" -DgroupId=com.ibm.ilog.optim -DartifactId=cpo-jar -Dversion=22.1 -Dpackaging=jar
```
- Accordingly, set up the cplex_library_path property to target the CPLEX or CPO native library for your OS.
- Now you can execute the commands `mvn compile` or `mvn test` in your project directory.
## 3. Set up your integration test environment:
If you want to verify the deployment to a Watson Machine Learning cluster, you must specify the Watson Machine Learning environment that you want to target during your tests.
- Update the profiles in your pom.xml or settings.xml file for your needs ([environment authentication details](https://ibm.github.io/watsonx-ai-python-sdk/setup.html)):
```
wml_test_environment_cloud
CLOUD_WML_CLUSTER
MY_APY_KEY
MY_SPACE_ID
S
wml_test_environment_cp4d
CP4D_WML_CLUSTER
MY_USERNAME
MY_PASSOWRD
MY_SPACE_ID
S
```
- Now you can execute the commands `mvn -P verify` or `mvn -P install` in your project, where `` is `wml_test_environment_cloud` or `wml_test_environment_cp4d`.