IBM ILOG CPLEX Optimizer

Description

Produce precise and logical decisions for planning and resource allocation problems using the powerful algorithms of IBM ILOG CPLEX Optimizer. Take advantage of a distributed parallel algorithm for mixed integer programming and flexible, high-performance mathematical programming solvers for linear programming, mixed integer programming, and more.

Home Page

https://www.ibm.com/analytics/cplex-optimizer

Documentation

https://www.ibm.com/docs/en/icos/22.1.0?topic=cplex-optimizers

License

Academic license

Usage

Use

# module avail CPLEX

to see which versions are available.

Use

# module load CPLEX/version

to get access to the software.

Command Line Version

For the interactive command line version of the programs

# cplex
# oplrun

Compiled Language Example Optimization

Examples can be found in the examples folder, located in the folder (after loading the module)

# cd $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:

  1. $CPLEXDIR/examples/src/c/admipex1.c
  2. $CPLEXDIR/examples/x86-64_linux/static_pic/Makefile
  3. $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. 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:

  1. ./admipex1 mexample.mps
  2. ./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.

CPLEX for Python

The CPLEX Python API is a lightweight wrapper around the C API (CPLEX Callable Library). As such, it provides access to nearly all of the functionality CPLEX has to offer. Variables and constraints are identified by their indices in the matrix. This topic explains how to set up the CPLEX Python API.

DOcplex is an object-oriented modeling Python API that is numpy/pandas friendly. The model can be solved locally (using the CPLEX Python API under the hood), or on the cloud. In addition to providing access to CPLEX for mathematical programming, it can also be used to access the CP Optimizer constraint programming engine. For more information about using the DOcplex Python API with the CPLEX or the CP Optimizer engines, see DOcplex Python Modeling API.

To set up the CPLEX Python API:

# cd $CPLEXPY
# python setup.py install --home <yourPythonPackageshome/cplex>