I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve the stage-wise problem instances using the CPLEX solver within SDDiP algorithm using the SDDP.jl package in Julia.
The installation instructions for CPLEX.jl are here: jump-dev/CPLEX.jl · JuMP
I haven’t tried installing CPLEX on colab, so I don’t have any other advice, sorry.
Got it, no problem at all.
I see that you have posted at https://or.stackexchange.com/questions/13152/using-cplex-in-the-julia-environment-of-google-colaboratory.
What have you tried? Have you installed CPLEX locally? Do you have a license?
You’ll likely need to download the installer locally, upload it to Colab, and then run the installer in Colab. Once installed you then need to set the correct environment variable and run Pkg.add("CPLEX")
. I can’t test this because I don’t have a license.
I have tried to install CPLEX using the CPLEX Studio executable with .bin extension inside Colab. I am getting the following error.
I need guidance regarding the installation location and where to past the .bin file and then install CPLEX and the wrapper cplex.jl.
Did you run the CPLEX installer? You need to do more than just copy-paste the installer file.
Once installed, you need to find the path of where it was installed to. The most common location is listed in the error message, /opt/CPLEX_Studio221/cplex/bin/x86-64_linux
, but I’m not sure if this is where it will be on Colab.
I don’t have the CPLEX installer so I cannot test, but:
- there may be an option like
-y
that allows all defaults - you could use the terminal built-in to colab, but I think this requires a pro subscription
- you could pipe in the arguments via something like:
run(`echo -e "2\n" | $path`)
I have installed the CPLEX solver by first uploading the executable (.bin) file to a directory of choice (I chose “/root”, which is the home directory in Google Colaboratory). Develop a file, named “installer.properties,” with the following contents in the same directory.
INSTALLER_UI=silent
LICENSE_ACCEPTED=TRUE
USER_INSTALL_DIR=/root
Then execute the following lines of code.
chmod("/root/cplex_studio2212.linux_x86_64.bin", 777)
run(`/root/cplex_studio2212.linux_x86_64.bin -f /root/installer.properties`)
ENV["CPLEX_STUDIO_BINARIES"] = "/root/cplex/bin/x86-64_linux"
After this, install CPLEX.jl, and you are all set to use the CPLEX solver in Julia.
Note: “/root” directory, mentioned above, can be replaced with any directory of choice.
Glad to hear you got it working: )