Skip to content


How to obtain Cplex

CPLEX Optimization Studio is available for students, in addition to teachers, researchers and university staff. In order to download it, please follow the link:

on the CIRRELT/GERAD Linux computers, cplex is already available and can be accessed by loading the cplex-studio module.

module load cplex-studio


For some programming languages, like python and julia, in addition to installing cplex, you need to add the modules specific to the language.

Here's a procedure to install cplex 22.1.1 with python 3.10. You need to adjust the instructions according to the versions that you use. for cplex, it's important that the version you install matches the version you load with module.

We recommend that you use a virtual environment for your peoject instead of using the --user option.

module load cplex-studio/22.1.1
mkdir -p /tmp/$$
cp -r /home/ibm/cplex-studio/22.1.1/cplex/python/3.10/ /tmp/$$
cd /tmp/$$/3.10/x86-64_linux
python install --user
rm -rf /tmp/$$

Here's an exemple on the installation procedure. We recommend that you use a virtual environment for your project.

import Pkg
ENV["CPLEX_STUDIO_BINARIES"] = "/home/ibm/cplex-studio/22.1.1/cplex/bin/x86-64_linux/"

CPLEX tutorial

Here's a 2 part tutorial to learn how to implement a mathematical model with CPLEX in C++.

You can refer to this reference document that covers the most important notions (classes and methods).

You can also refer to commented examples that come with the CPLEX installation. Those examples cover the notions learned in the reference document.

Cplex parameters

Since version 11, the solver will try to use all processors on the machine to solve the problem. It is therefore really important that you specifiy a limited number of processors so your solve doesn't interfere with other programs that could be running.

You can see in these tabs the parameter to change to use 1 processor.

cplex.setParam(IloCplex::Param::Threads, 1);
CPXsetintparam(env, CPXPARAM_Threads, 1);
execute PARAMS {
  cplex.threads = 1;
set threads 1
  % Initialize the CPLEX object
  cplex = Cplex('lpex1');
  % set maximum number of threads
  cplex.Param.threads.Cur = 1;
option cplex_options 'threads=1';
 set_optimizer_attribute(model, "CPXPARAM_Threads", 1)