User Tools

Site Tools


en:programmation-cplex

How to obtain Cplex

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

https://ibm.onthehub.com/WebStore/ProductSearchOfferingList.aspx?srch=cplex+optimization+studio

Then select the tab <Student> or <Faculty/staff> for professors, research and university staff.

CPLEX Tutorial

This is a home made tutorial for CPLEX (in PDF format) to learn how to implement a mathematical model with CPLEX in C++.

cplex_en.pdf

And here are some examples from the CPLEX distribution used in the tutorial to illustrate some concepts:

exemple3_en.pdf

CPLEX Parameters

Since version 11 of CPLEX, Solver tends to use all processors (CPU, cores, hyperthreads) when it's called. It is then VERY IMPORTANT to specify to CPLEX to use sequential mode in order to avoid interfering with the other programs running on the machine via SUNGRID.

Here are some examples of what should be done to avoid your jobs to be stopped, cause they consume machine ressources

C++ / Concert

cplex.setParam(IloCplex::Threads, 1);

C

CPXsetintparam(env, CPX_PARAM_THREADS, 1);

OPL

execute PARAMS {
  cplex.threads = 1;
}

Cplex interactif

set threads 1

Matlab

  % Initialize the CPLEX object
  cplex = Cplex('lpex1');
  % set maximum number of threads
  cplex.Param.threads.Cur = 1;

In all cases you should put your instruction before starting the program to insure that your job is run in sequential mode.

AMPL

option cplex_options 'threads=1';

Python

In order to use CPLEX with Python, you need to install the module in your account.

module load cplex-studio

mkdir -p /tmp/Your_username

cp -r /home/ibm/cplex-studio/12.10.0.0/CPLEX_Studio/cplex/python/3.7/x86-64_linux /tmp/Your_username

cd /tmp/Your_username/x86-64_linux

python setup.py install --user
en/programmation-cplex.txt · Last modified: 2020/03/23 16:47 by admin