Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPLEX in Python Workshop

This repository contains the lecture slides, source code, and data used for the workshop.

Requirements

To get the most out of this workshop, you will need the following:

Essential

  • 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.

Recommended

  • VS Code Python extension for syntax highlighting, code navigation, and debugging
  • A dedicated Python virtual environment for the workshop

Optional

  • 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.

Installation Overview

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.

1. Python 3.12

  • 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 --version

If you have multiple Python versions installed, invoke Python 3.12 explicitly.

Windows

py -3.12 --version
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1

macOS and Linux

On macOS and Linux, the Python 3.12 executable is usually named python3.12:

python3.12 --version
python3.12 -m venv .venv
source .venv/bin/activate

If 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.

2. VS Code

3. CPLEX Community Edition

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 docplex

Notes:

  • 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.

4. Academic License / Full CPLEX Optimization Studio

If you are eligible through IBM's academic program, you can request a full academic version of CPLEX Optimization Studio.

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.

Repository Contents

  • 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/.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages