Julia interface for the CPLEX optimization software
53 Stars
Updated Last
11 Months Ago
Started In
October 2013


CPLEX.jl is an interface to the IBM® ILOG® CPLEX® Optimization Studio. It provides an interface to the low-level C API, as well as an implementation of the solver-independent MathProgBase and MathOptInterface API's.

You cannot use CPLEX.jl without having purchased and installed a copy of CPLEX Optimization Studio from IBM. However, CPLEX is available for free to academics and students.

This package is available free of charge and in no way replaces or alters any functionality of IBM's CPLEX Optimization Studio product.

Note: This wrapper is maintained by the JuMP community and is not officially supported by IBM. However, we thank IBM for providing us with a CPLEX license to test CPLEX.jl on Travis. If you are a commercial customer interested in official support for CPLEX in Julia, let them know!.


First, you must obtain a copy of the CPLEX software and a license. Then, set the appropriate environment variable and run Pkg.add("CPLEX").

# Linux
ENV["CPLEX_STUDIO_BINARIES"] = "/path/to/cplex/bin/x86-64_linux"

ENV["CPLEX_STUDIO_BINARIES"] = "/path/to/cplex/bin/x86-64_osx"

# Windows
ENV["CPLEX_STUDIO_BINARIES"] = "C:/IBM/CPLEX_Studio128/cplex/bin/x64_win64"

import Pkg

Help! I got LoadError: Unable to locate CPLEX installation

Which version of CPLEX are you trying to install? Currently, CPLEX.jl only supports 12.8, 12.9, and 12.10 given recent changes to the API.

If you want to support newer versions of CPLEX not listed above, file an issue with the version number you'd like to support. Some steps need to be taken (like checking for new or renamed parameters) before CPLEX.jl can support new versions.

Use with JuMP

You can use CPLEX with JuMP via the CPLEX.Optimizer() solver. Set solver parameters using set_optimizer_attribute from JuMP:

model = Model(CPLEX.Optimizer)
set_optimizer_attribute(model, "CPX_PARAM_EPINT", 1e-8)

Parameters match those of the C API in the CPLEX documentation.