A collection of minimal, self-contained code snippets for evaluating optimization benchmark functions from the OPL library. Each snippet uses uv as the script runner and requires no manual virtual-environment setup.
Every benchmark problem has its own repository containing:
call_<problem>.py— the evaluation script, with inline dependency metadata (PEP 723) souvresolves everything automatically.README.md— problem-specific instructions covering any prerequisites (cloning external repos, running setup scripts, downloading executables, etc.) and the usage example.
Always start by reading the README inside the problem's repository. Some benchmarks need extra setup steps before the snippet will run.
- Install uv if you don't have it yet:
pip install uv-
Navigate to the problem's repository and follow its specific README.
-
Run the snippet:
uv run call_<problem>.py| Repository | Benchmark | Description |
|---|---|---|
cocoex/ |
COCO/BBOB | Evaluates function 1 from the BBOB suite (2-D) |
mf2/ |
mf2 | Evaluates the Branin function at high and low fidelity |
| … | … | See the full list in the OPL Library |
- Create a new repository (or folder) named after the problem.
- Add a
call_<problem>.pyfile with the inline dependency block at the top:
# /// script
# dependencies = [
# "your-package",
# ]
# ///- Write your evaluation code below the dependency block.
- Add a
README.mdthat documents any setup steps a user must complete before running the script (cloning repos, installing non-Python dependencies, downloading data, etc.). - Update the table above to include your new benchmark.