CPLEX¶
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:
https://www.ibm.com/academic/home
on the CIRRELT/GERAD Linux computers, cplex is already available and can be accessed by loading the cplex-studio
module.
module load cplex-studio
Installation¶
For some programming languages, like python and julia, in addition to installing cplex, you need to add the modules specific to the language.
To use cplex with python, you need to use version 22.1.2 or newer. For this version, it's possible to install the packages for python up to 3.12.
Here's an installation procedure.
Creation and activation of a virtual environment.
Upgrade pip and installe the cplex packages
This will install the free version of cplex that has size limitations. To remove the restrictions, we use the script provided by ibm: https://www.ibm.com/support/pages/does-cplex-optimization-studio-2211-support-python-311
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.