How to run Cplex throught Julia

In my last post I talk about how to run Gurobi throught Julia.
To do a benchmarking, now I going to explain how to run Cplex.
First, you need to register here to download cplex



chmod +x cplex_studio128.linux-x86-64.bin 
 ./cplex_studio128.linux-x86-64.bin 

By default, cplex use /opt/ibm/ILOG/CPLEX_Studio128 to install it

After, you need to add the binaries to your PATH or create symbolic links to the executables:

sudo ln -s /opt/ibm/ILOG/CPLEX_Studio128/cplex/bin/x86-64_linux/cplex /usr/bin/cplex
sudo ln -s /opt/ibm/ILOG/CPLEX_Studio128/cplex/bin/x86-64_linux/cplexamp /usr/bin/cplexamp

cd /opt/ibm/ILOG/CPLEX_Studio128/cplex/python/3.6/x86-64_linux
sudo python3 setup.py install

Now, add Cplex package to Julia:

julia> Pkg.add("CPLEX")
INFO: Cloning cache of CPLEX from https://github.com/JuliaOpt/CPLEX.jl.git
INFO: Installing CPLEX v0.3.2
INFO: Building CPLEX
================================[ ERROR: CPLEX ]================================

LoadError: Unable to locate CPLEX installation. Note this must be downloaded separately. See the CPLEX.jl README for further instructions.
while loading /home/dragonx/.julia/v0.6/CPLEX/deps/build.jl, in expression starting on line 67

================================================================================

================================[ BUILD ERRORS ]================================

WARNING: CPLEX had build errors.

 - packages with build errors remain installed in /home/dragonx/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("CPLEX")`
 - build a single package by running its `deps/build.jl` script

================================================================================
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of CPLEX
INFO: Use `Pkg.update()` to get the latest versions of your packages

We need to setup the library path in ~/.bashrc:
export LD_LIBRARY_PATH="/opt/ibm/ILOG/CPLEX_Studio128/cplex/bin/x86-64_linux/":$LD_LIBRARY_PATH

And now, setup cplex path in julia:
CPLEX_STUDIO_BINARIES=/opt/ibm/ILOG/CPLEX_Studio128/cplex/bin/x86-64_linux/ julia -e 'Pkg.add("CPLEX"); Pkg.build("CPLEX")'

Enjoy it!

Comments

Popular posts from this blog

How to fix Android when developer options are not available for this user

Exception: Could not find a default OpenFlow controller in Mininet

v4l2: open /dev/video0: Permission denied