CPLEX Integration
You need to configure your application projects to use a local installation of CPLEX Studio. This configuration is required:
to build and test any library that uses CPLEX
to create the Docker image of any worker using CPLEX
Declare your local CPLEX installation
The generated application provides the gradle/templates/local-cplex.gradle Gradle script.
This file should be included using apply from: in the build scripts of all Gradle projects
that use CPLEX. It should be updated so that
the CPLEX_STUDIO property points to your local installation of CPLEX:
ext {
CPLEX_STUDIO= "C:\\tmp\\cplex_studio" <---- edit this value
CPLEX_ARCHI="x64_win64"
CPO_BIN= CPLEX_STUDIO + "\\cpoptimizer\\bin\\" + CPLEX_ARCHI
CPO_LIB= CPLEX_STUDIO + "\\cpoptimizer\\lib\\ILOG.CP.jar"
CPLEX_BIN= CPLEX_STUDIO + "\\cplex\\bin\\" + CPLEX_ARCHI
CPLEX_LIB= CPLEX_STUDIO + "\\cplex\\lib\\cplex.jar"
}Engine Library Configuration
The processing/engine/build.gradle configuration file already includes the local-cplex.gradle
plugin which means you don't have to do any update for the predefined engine library.
...
// This plugin uses a local installation of CPLEX for compilation and testing
// You need to update the CPLEX_STUDIO variable in that file to point to your local installation
apply from: "${rootDir}/gradle/templates/local-cplex.gradle"
...Worker Docker Configuration
Engine workers are generated with a workers/engine-worker/Dockerfile that is
used to create their Docker image.
The Dockerfile contains commented parts that can be used as a guide to match your local installation. The commented parts assume that you have a zip file that contains a Linux-based runtime distribution of CPLEX (remember that our Docker images are Linux-based).
# copy the zipped library file into the docker image
ENV STUDIO_ZIP=cplex_studio_1210-runtime-linux.zip
COPY ${STUDIO_ZIP} /tmp/
# this is where the libraries will be unzipped
ENV STUDIO_HOME=/cplex_studio1210
# this is where the CPLEX and CP libraries will be located
ENV CP_HOME=${STUDIO_HOME}/cplex_studio/cpoptimizer/bin/x86-64_linux
ENV CPLEX_HOME=${STUDIO_HOME}/cplex_studio/cplex/bin/x86-64_linux
# Runtimes
RUN mkdir -p ${STUDIO_HOME} \
&& cd ${STUDIO_HOME} \
&& unzip /tmp/${STUDIO_ZIP}
# setup the environment variables so that the libraries are found when running
ENV nativePath="${CP_HOME}:${CPLEX_HOME}"
ENV PATH="${nativePath}:${PATH}"
ENV LD_LIBRARY_PATH="${nativePath}:${LD_LIBRARY_PATH}"To use the Dockerfile as-is, you will need to:
create the zip file that contains the CPLEX runtime libraries
copy this file into the same folder as the
Dockerfileuncomment the commented lines
run the
gradlew dockercommand.