This repository contains the lecture slides, source code, and data used for the workshop.
To get the most out of this workshop, you will need the following:
- Python 3.12 CPLEX does not currently work with more recent Python versions, so please install Python 3.12 specifically.
- Visual Studio Code (VS Code) as your code editor
- IBM CPLEX The free Community Edition is sufficient for the workshop.
- VS Code Python extension for syntax highlighting, code navigation, and debugging
- A dedicated Python virtual environment for the workshop
- IBM Academic license / full CPLEX Optimization Studio If you are eligible through IBM's academic program, you can install a full version of CPLEX Optimization Studio at no cost.
Below is a brief overview of how to install each requirement. For detailed, platform-specific instructions, please refer to the official documentation for each tool.
- Download Python 3.12 from the official Python website.
- Install a 3.12.x release. Do not use Python 3.13 or newer for this workshop.
- If you want a specific installer-based release, Python 3.12.10 is recommended.
- Make sure Python is added to your system PATH.
To verify the installation:
python --versionIf you have multiple Python versions installed, invoke Python 3.12 explicitly.
py -3.12 --version
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1On macOS and Linux, the Python 3.12 executable is usually named python3.12:
python3.12 --version
python3.12 -m venv .venv
source .venv/bin/activateIf python3.12 is not available yet, install Python 3.12 specifically with your package manager or with a version manager such as pyenv, then rerun the commands above.
After the virtual environment is activated, the remaining installation commands in this README are the same on all operating systems.
- Download Visual Studio Code from the official VS Code website.
- Install the Python extension for VS Code.
- In VS Code, select your workshop Python 3.12 interpreter or virtual environment.
The free Community Edition is sufficient for the workshop.
With the virtual environment from Section 1 activated, install cplex and docplex with pip:
python -m pip install cplex docplexNotes:
- According to the DOcplex documentation, the Community Edition has engine limits of 1000 variables or 1000 constraints.
- These limits are sufficient for the workshop material.
If you are eligible through IBM's academic program, you can request a full academic version of CPLEX Optimization Studio.
- Academic program information: IBM Academic Initiative
- Product page: IBM ILOG CPLEX Optimization Studio
- Reference documentation: CPLEX Python API Reference Manual
Install steps:
- Request access through the academic program.
- Download and install IBM ILOG CPLEX Optimization Studio.
- Use the same Python 3.12 virtual environment from Section 1.
Then run:
python -m pip install cplex docplex
docplex config --upgrade "<full path to CPLEX_Studio2212>"This upgrades the Community Edition Python runtimes to the size-unlimited version associated with your local CPLEX Studio installation.
Important note:
- Installing CPLEX Optimization Studio by itself is not enough to update the Python runtime used by the workshop environment.
- The
docplex config --upgrade ...step is what upgrades the installed Community Edition Python runtimes to the full local Studio version.
- Slides: The lecture slides are located in
slides/. - Source Code: The Python scripts and code examples are located in
src/. - Data: The data used in the examples are located in
data/.