docplex
The IBM Decision Optimization CPLEX Modeling for Python
What it is and what it does
Docplex is IBM's Python modeling library for building optimization problems that can be solved by IBM ILOG CPLEX Optimization Studio. It provides two main modules: docplex.mp for linear and quadratic programming, and docplex.cp for constraint programming. The library lets you define decision variables, constraints, and objectives in Python, then submit them to a CPLEX solver for execution.
The package is designed for developers who need to add optimization capabilities to applications—scheduling, resource allocation, planning, or other decision-making problems. It requires only six as a runtime dependency but mandates that CPLEX Optimization Studio be installed separately on your system to actually solve models. Recent versions add support for running OPL models directly from Python and work with modern Python versions including 3.13 and 3.14.
Use it for:
- Build linear and quadratic programming models in Python and solve them with CPLEX without writing solver-specific syntax
- Embed constraint programming problems into Python applications for scheduling, sequencing, or resource optimization tasks
- Run OPL (Optimization Programming Language) models from Python using native integration instead of external .dat files
- Extract and process optimization results (variables, objectives, solution pools) in Python-friendly formats like dictionaries and pandas DataFrames
- Develop end-to-end optimization pipelines that combine data preparation, model building, solving, and result analysis in a single Python workflow
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Modeling library for building and solving mathematical optimization problems using IBM CPLEX and CP Optimizer solvers, with two namespaces for linear/quadratic and constraint programming respectively.
Yes, with conditions. Install docplex if you have IBM ILOG CPLEX Optimization Studio already deployed or can obtain it, and you need to model optimization problems in Python. The library is actively maintained, permissively licensed, and well-integrated with Python data tools. Without CPLEX Studio installed separately, the package alone cannot solve models—it is a modeling layer only. The high install friction reflects this external dependency, not the package quality.
Install
docplex on PyPI
pip
pip install docplexuv
uv add docplexpoetry
poetry add docplexInstalling docplex
Before you install
High install friction: the package itself is straightforward, but solving models requires IBM ILOG CPLEX Optimization Studio V12.8 or later to be installed separately on your machine. Maintenance is active with recent releases.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects that can meet the external CPLEX solver dependency.
Quickstart
pip install docplex
from docplex.mp.model import Model
mdl = Model(name='example')
x = mdl.continuous_var(name='x')
y = mdl.continuous_var(name='y')
mdl.maximize(x + y)
mdl.add_constraint(x + y <= 10)
solution = mdl.solve()
IBM ILOG CPLEX Optimization Studio V12.8 or later must be installed on your machine to solve models; the package alone only provides modeling capabilities.
Verify before relying
- Whether numpy 2.0 compatibility mentioned in changelog applies to current version 2.32.264
- Specific Python version support (requires_python is unspecified in metadata)
- Whether OPL model support in 2.32.264 requires additional CPLEX Studio features or configuration
Package facts
| License | Apache 2.0 (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | 1 — six |
| Maintenance | actively maintained — 135 days since the last release |
| First released | |
| Downloads | 78,447/month — #14,442 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docplex-2.32.264.tar.gz
Keywords: optimization, cplex, cpo
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
cplexProvides a Python interface to IBM CPLEX's…
unclear · top 15,000 on PyPI
optlangOptlang formulates and solves linear,…
permissive · top 15,000 on PyPI
PuLPPuLP is a linear and mixed-integer programming…
permissive · top 5,000 on PyPI
pyomoPyomo is a Python framework for formulating and…
permissive · top 5,000 on PyPI
mipPython MIP models and solves mixed-integer…
copyleft · top 15,000 on PyPI
xpressPython interface to the FICO Xpress Optimizer…
unclear · top 15,000 on PyPI
nloptNLopt provides Python bindings to the NLopt…
permissive · top 5,000 on PyPI
cvxpyCVXPY is a Python modeling language for…
permissive · top 5,000 on PyPI
linopylinopy builds linear, integer, and quadratic…
permissive · top 15,000 on PyPI
aimmspyaimmspy provides Python bindings to run AIMMS…
permissive · top 15,000 on PyPI