Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 79 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# CPLEX.jl

CPLEX.jl is a wrapper for the [IBM® ILOG® CPLEX® Optimization
Studio](https://www.ibm.com/products/ilog-cplex-optimization-studio)
[![Build Status](https://github.com/jump-dev/CPLEX.jl/workflows/CI/badge.svg?branch=master)](https://github.com/jump-dev/CPLEX.jl/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/jump-dev/CPLEX.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/jump-dev/CPLEX.jl)

You cannot use CPLEX.jl without having purchased and installed a copy of CPLEX
Optimization Studio from [IBM](http://www.ibm.com/). However, CPLEX is
available for free to [academics and students](http://ibm.biz/Bdzvqw).
[CPLEX.jl](https://github.com/jump-dev/CPLEX.jl) is a wrapper for the
[IBM® ILOG® CPLEX® Optimization Studio](https://www.ibm.com/products/ilog-cplex-optimization-studio).

CPLEX.jl has two components:
- a thin wrapper around the complete C API
Expand All @@ -15,50 +14,106 @@ The C API can be accessed via `CPLEX.CPXxx` functions, where the names and
arguments are identical to the C API. See the [CPLEX documentation](https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/COS_KC_home.html)
for details.

*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 GitHub. If you are a commercial customer
interested in official support for CPLEX in Julia, let them know!.*
## Affiliation

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 GitHub. If you are a commercial customer interested in official
support for CPLEX in Julia, let them know.

## License

`CPLEX.jl` is licensed under the [MIT License](https://github.com/jump-dev/CPLEX.jl/blob/master/LICENSE.md).

The underlying solver is a closed-source commercial product for which you must
[purchase a license](https://www.ibm.com/analytics/cplex-optimizer).

Free CPLEX licenses are available for [academics and students](http://ibm.biz/Bdzvqw).

## Installation

**Minimum version requirement:** CPLEX.jl requires CPLEX version 12.10, 20.1, or 22.1.
CPLEX.jl requires CPLEX version 12.10, 20.1, or 22.1.

First, obtain a license of CPLEX and install CPLEX solver, following the
instructions on [IBM's website](https://www.ibm.com/analytics/cplex-optimizer). Then, set the
`CPLEX_STUDIO_BINARIES` environment variable as appropriate and run
`Pkg.add("CPLEX")`, then `Pkg.build("CPLEX")`. For example:
instructions on [IBM's website](https://www.ibm.com/analytics/cplex-optimizer).

Once installed, set the `CPLEX_STUDIO_BINARIES` environment variable as
appropriate and run `Pkg.add("CPLEX")`. For example:
```julia
# On Windows, this might be
# On Windows, this might be:
ENV["CPLEX_STUDIO_BINARIES"] = "C:\\Program Files\\CPLEX_Studio1210\\cplex\\bin\\x86-64_win\\"
# On OSX, this might be
# On OSX, this might be:
ENV["CPLEX_STUDIO_BINARIES"] = "/Applications/CPLEX_Studio1210/cplex/bin/x86-64_osx/"
# On Unix, this might be
# On Unix, this might be:
ENV["CPLEX_STUDIO_BINARIES"] = "/opt/CPLEX_Studio1210/cplex/bin/x86-64_linux/"

import Pkg
Pkg.add("CPLEX")
Pkg.build("CPLEX")
```

**Note: your path may differ. Check which folder you installed CPLEX in, and
update the path accordingly.**
!!! note
The exact path may differ. Check which folder you installed CPLEX in, and
update the path accordingly.

## Use with JuMP

Use `CPLEX.jl` with JuMP as follows:

```julia
using JuMP, CPLEX
model = Model(CPLEX.Optimizer)
set_optimizer_attribute(model, "CPX_PARAM_EPINT", 1e-8)
set_attribute(model, "CPX_PARAM_EPINT", 1e-8)
```

Parameters match those of the C API in the [CPLEX documentation](https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/introListAlpha.html).
## MathOptInterface API

The CPLEX optimizer supports the following constraints and attributes.

List of supported objective functions:

* [`MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}`](@ref)
* [`MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}`](@ref)
* [`MOI.ObjectiveFunction{MOI.VariableIndex}`](@ref)
* [`MOI.ObjectiveFunction{MOI.VectorAffineFunction{Float64}}`](@ref)

List of supported variable types:

* [`MOI.Reals`](@ref)

List of supported constraint types:

* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.EqualTo{Float64}`](@ref)
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.GreaterThan{Float64}`](@ref)
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.LessThan{Float64}`](@ref)
* [`MOI.ScalarQuadraticFunction{Float64}`](@ref) in [`MOI.GreaterThan{Float64}`](@ref)
* [`MOI.ScalarQuadraticFunction{Float64}`](@ref) in [`MOI.LessThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.EqualTo{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.GreaterThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Integer`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Interval{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.LessThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Semicontinuous{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Semiinteger{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.ZeroOne`](@ref)
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SOS1{Float64}`](@ref)
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SOS2{Float64}`](@ref)
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SecondOrderCone`](@ref)

List of supported model attributes:

* [`MOI.ConflictStatus()`](@ref)
* [`MOI.HeuristicCallback()`](@ref)
* [`MOI.LazyConstraintCallback()`](@ref)
* [`MOI.Name()`](@ref)
* [`MOI.ObjectiveSense()`](@ref)
* [`MOI.UserCutCallback()`](@ref)

## Options

Options match those of the C API in the [CPLEX documentation](https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/introListAlpha.html).

## Callbacks

Here is an example using CPLEX's solver-specific callbacks.
CPLEX.jl provides a solver-specific callback to CPLEX:

```julia
using JuMP, CPLEX, Test
Expand Down Expand Up @@ -128,7 +183,7 @@ optimize!(model)

## Annotations for automatic Benders' decomposition

Here is an example of using CPLEX's annotation feature for automatic Benders'
Here is an example of using the annotation feature for automatic Benders'
decomposition:
```julia
using JuMP, CPLEX
Expand Down