IBM ILOG CPLEX Optimization Studio
Introduction
IBM ILOG CPLEX Optimization is a mathematical optimization program designed for enterprise-level decision support.
Running IBM ILOG CPLEX Optimization on RCC Resources: Command Line Version
For the interactive command line version of the program, log in to the HPC and load the module cplex_studio
. To run, simply type cplex
. From here, problem parameters can be specified interactively and solved using a number of the solver routines available in the program. To exit, use the command quit
.
Compiled Language Example Optimization
Examples can be found in the examples folder, located in the folder (after loading the module)
$CPLEXDIR/examples
Various data files are located here in addition to optimization routines written in a number of languages (C, C++, and Java). For this example, a C program, admipex1.c
, found in the src
folder will be used to demonstrate how to properly compile and run an example program that utilizes the cplex library. First create a directory and copy the program, makefile, and example data set into it:
$CPLEXDIR/examples/src/c/admipex1.c
$CPLEXDIR/examples/x86-64_sles10_4.1/static_pic/Makefile
$CPLEXDIR/examples/data/mexample.mps
Open the Makefile and comment out the CPLEXDIR and CONCERTDIR lines, as these are already specified when loading the module cplex_studio
. Compile the program using make admipex1
. Note that just using make
will compile all the C, C++, and Java examples, but will not copy the example data files into the directory. To run the program, the data file must be used as an argument to the executable:
./admipex1 mexample.mps
./admipex1 -r mexample.mps
Either of these will successfully run. More information about the -r
option can be found in the documentation in the admipex1.c file.
GUI IDE Version
For the GUI version, log in to the HPC using the -Y
flag in order to pipe X. After loading the module, the GUI version can be opened with the command oplide
.
GUI IDE Example Optimization
To load one of the examples, go to File > Import > Example
. Under IBM ILOG OPL Examples
, select the Assembly Sequencing example. To run the program, in the window with the folder named sequence
, right click the folder and select Run > Basic Configuration (Default)
. The results from the run will be displayed in the Solutions
tab on the bottom right corner of the GUI. Further explanations on how to use the IDE can be found here.
CPLEX for Matlab
The CPLEX solver library is also available for use in MATLAB. Open MATLAB by first loading the module matlab
, and execute with the command matlab
. The MATLAB solvers are located in the directory
/gpfs/research/software/ibm/CPLEX_Studio125/cplex/matlab
From here, using MATLAB to solve optimization problems is no different than what is described in the available tutorials online. Information on the specifics of the MATLAB implementation can be found on the IBM website or this PDF.
CPLEX for PYTHON
To use the python-cplex wrapper, modify your $PYTHONPATH variable as following:
export PYTHONPATH=/gpfs/research/software/ibm/CPLEX_Studio125/cplex/python/lib/python2.7/site-packages:$PYTHONPATH