BOCoDe: Benchmarks for Optimization and Computational Design
BOCoDe is a Python/PyTorch library of optimization benchmark problems for benchmarking optimization algorithms, with a first-class BoTorch/Ax interface for Bayesian optimization research. It collects 307 benchmark problems — 159 engineering, 80 hyperparameter-optimization (HPO), and 68 synthetic — spanning five optimization classes (single-/multi-objective, unconstrained/constrained, and mixed-variable), with an emphasis on real-world engineering, control, materials-science, and HPO problems drawn from the literature and cited to their sources.
[!IMPORTANT] Output objective values are meant to be maximized (the library was designed for Bayesian optimization). For minimization algorithms, negate the objective. Constraints are inequality constraints:
gx <= 0is feasible.
[!NOTE] The library is still under construction. Please open a pull request or an issue to let us know if you run into problems. Thanks!
💡 What is in BOCoDe?
Every problem carries per-problem JSON metadata and a cited source, and is accessed by name through a central registry. The benchmark set covers 307 problems across three domains:
| Domain | Examples | Count |
|---|---|---|
| Engineering | trusses, pressure vessel, speed reducer, Mazda car design, CEC2020 real-world constrained suite, RE/CRE multi-objective suite, MODAct actuators, MuJoCo control, materials-science datasets (AgNP, CrossedBarrel, P3HT, Perovskite, AutoAM) | 159 |
| HPO | Bayesmark, HPO-B, LCBench, LassoBench real datasets (DNA, Leukemia, …) | 80 |
| Synthetic | Ackley, Rosenbrock, ZDT, DTLZ, MW, mixed-variable variants | 68 |
By optimization class: SO-Unconstrained (150), SO-Constrained (48), MO-Unconstrained (26), MO-Constrained (26), SO-Mixed-Variable (57). The registry also ships additional problems beyond this benchmark set (e.g. combinatorial TSP and EPFL logic-synthesis tasks).
See CATEGORIZATION.md for the full per-problem table (dimensions, objectives, constraints, variable types, convexity, NP-hardness) and the NP-hardness assessment methodology.
💻 Installation
Core install (enough to import bocode and run most problems):
pip install bocode
Some problems need heavy or native dependencies, shipped as optional extras. Install only what you need:
pip install "bocode[mujoco]" # MuJoCo control problems
pip install "bocode[truss]" # Truss10D..Truss200D
pip install "bocode[box2d]" # RobotPush
pip install "bocode[modact]" # MODAct suite
pip install "bocode[hpo]" # SVM
pip install "bocode[mazda]" # Mazda car design
pip install "bocode[neorl]" # QPowerModel surrogate
pip install "bocode[tabicl]" # TabICL foundation-model surrogate (tabicl_* methods)
pip install "bocode[tabpfn]" # TabPFN foundation-model surrogate (tfm_* / pfn_cei methods)
pip install "bocode[hebo]" # HEBO optimizer (hebo method)
pip install "bocode[all]" # everything available on PyPI
# bounce (bounce method) is not on PyPI: install from the official source tree with
# pip install --no-deps --no-build-isolation <bounce repo> && pip install gin-config
# Known-good upstream versions (pinned in requirements-lock.txt):
# HEBO : github.com/huawei-noah/HEBO @ ee6112d (v0.3.6, `#subdirectory=HEBO`)
# bounce: github.com/LeoIV/bounce @ 738b9bd (v0.1.0) + gin-config
| Extra | Enables | Backing dependency |
|---|---|---|
mujoco |
MuJoCo locomotion problems | gymnasium[mujoco] |
control |
CartPole / Acrobot | gymnasium |
truss |
Truss10D…Truss200D | slientruss3d |
box2d |
RobotPush | Box2D, pygame, joblib |
modact |
MODAct CS/CT/CTS/CTSE/CTSEI | modact |
hpo |
SVM and the weighted-Lasso (LassoBench) problems | scikit-learn |
mazda |
Mazda | openpyxl |
neorl |
QPowerModel | onnxruntime |
viz |
function visualization | dash, plotly, matplotlib |
The Lasso problems are a clean-room weighted-Lasso reimplementation that needs only
scikit-learn (the hpo extra); their datasets are fetched from OpenML on first use
(network required). See bocode/opt_problems/hpo/_lasso_base.py for how it differs
from upstream LassoBench.
Accessing a problem without its extra installed raises a clear error telling you which extra to install.
Large data files
A few problems use large data (the SVM dataset, the MOPTA08 and Mazda binaries).
These are not shipped in the package; they are downloaded on first use to
~/.cache/bocode (override with BOCODE_CACHE_DIR) and verified by checksum. Set
BOCODE_DATA_BASE_URL to point at a mirror if needed.
🔍 Example Usage
Problems are accessed by name (flat API) or via the registry:
import bocode
import torch
# List and filter problems by metadata
bocode.list_problems(application="Engineering")
bocode.list_problems(num_objectives=2, constrained=True)
# Instantiate by name (both forms are equivalent)
problem = bocode.Car()
problem = bocode.get_problem("Car")()
# Inspect metadata
meta = bocode.get_metadata("Car") # dim, #obj, #constraints, bounds, source, ...
# Evaluate
x = torch.rand(5, problem.dim)
x = problem.scale(x) # map [0, 1] samples into the problem bounds
values, constraints = problem.evaluate(x)
print("feasible:", (constraints <= 0).all(dim=1))
Convenience selectors for algorithm benchmarking:
bocode.get_single_objective_unconstrained()
bocode.get_single_objective_constrained()
bocode.get_multi_objective_unconstrained()
bocode.get_multi_objective_constrained()
Materials problems are discrete dataset-lookup problems — optimize over the measured candidate set:
p = bocode.AgNP()
values, _ = p.evaluate(p.candidates[:10]) # measured objective of those candidates
The old
bocode.Engineering.Carnamespace still works but emits aDeprecationWarning; preferbocode.Car/bocode.get_problem("Car").
🧮 Algorithms
algorithms/ holds 31 single-file, CleanRL-style optimization baselines
(27 Bayesian-optimization algorithms and 4 evolutionary baselines) organized by
optimization class: GP-UCB, GP-LogEI, TuRBO, BAxUS, Vanilla-HD-BO, Standard-GP,
CEI, SCBO, Penalty, CLF-CBO, qNEHVI, qNParEGO, MESMO, DGEMO, NSGA-II, SPEA2 and
their constrained counterparts, mixed-variable methods (PR, Bounce,
Casmopolitan, HEBO, BODi), and surrogate-swapped variants (RF, TabPFN, TabICL)
of the UCB/TuRBO/SCBO families. This is research code, separate from the
installable package. See algorithms/README.md.
🛠️ Development
mamba create -n bocode python=3.12 -y
mamba run -n bocode pip install -e ".[all]" pytest pytest-cov ruff
mamba run -n bocode pytest tests/ # smoke test skips problems whose extra is absent
Regenerate the registry, metadata, and categorization table after adding a problem:
python tools/generate_registry.py
python tools/generate_metadata.py
python tools/render_categorization.py
We welcome contributions! New problems should be real-world problems with a cited
source, one file per problem, following the existing """Sources: ..."""
docstring convention.
Citing
@misc{yu2025bocode,
author={Rosen Ting-Ying Yu, Christophe Hatterer, Advaith Narayanan, Cyril Picard, Faez Ahmed},
title = {{BOCoDe}: Benchmarks for Optimization and Computational Design},
year={2025},
url={https://github.com/rosenyu304/BOCoDe}
}
If you use a BOCoDe problem derived from another library or paper (BoTorch, MODAct, LassoBench, the PV-Lab materials datasets, the CEC2020 / RE suites, …), please also cite that source — each problem records its citation in its docstring and metadata.
License
BOCoDe is MIT licensed, as found in LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bocode-1.0.1.tar.gz.
File metadata
- Download URL: bocode-1.0.1.tar.gz
- Upload date:
- Size: 47.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbaf948fccacaf4d453fdde0add2693a7caa78531b12f494e993feb4d1bb6853
|
|
| MD5 |
da1fe3687afd9e25eee59bcd0eaab8a3
|
|
| BLAKE2b-256 |
66a34e6f5500b92a282c1d21c3b09a32b33e84cfb9776d3f7ab1c5ef70e882ad
|
Provenance
The following attestation bundles were made for bocode-1.0.1.tar.gz:
Publisher:
publish.yaml on rosenyu304/BOCoDe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bocode-1.0.1.tar.gz -
Subject digest:
fbaf948fccacaf4d453fdde0add2693a7caa78531b12f494e993feb4d1bb6853 - Sigstore transparency entry: 2473513142
- Sigstore integration time:
-
Permalink:
rosenyu304/BOCoDe@fb0fcab0193c1d5f5fb29790c1c09b2ca2489cac -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/rosenyu304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@fb0fcab0193c1d5f5fb29790c1c09b2ca2489cac -
Trigger Event:
release
-
Statement type:
File details
Details for the file bocode-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bocode-1.0.1-py3-none-any.whl
- Upload date:
- Size: 45.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d911ebc0f5bc11a64523e83780e3d658b39310d53f3cb0f63dc7da303d14eb7
|
|
| MD5 |
b621d2b06293f2930c380adff45750d9
|
|
| BLAKE2b-256 |
065b5c335e871f70bf173d0ea4485d03fe43d300288375d82eccf970c80d1f34
|
Provenance
The following attestation bundles were made for bocode-1.0.1-py3-none-any.whl:
Publisher:
publish.yaml on rosenyu304/BOCoDe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bocode-1.0.1-py3-none-any.whl -
Subject digest:
4d911ebc0f5bc11a64523e83780e3d658b39310d53f3cb0f63dc7da303d14eb7 - Sigstore transparency entry: 2473513183
- Sigstore integration time:
-
Permalink:
rosenyu304/BOCoDe@fb0fcab0193c1d5f5fb29790c1c09b2ca2489cac -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/rosenyu304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@fb0fcab0193c1d5f5fb29790c1c09b2ca2489cac -
Trigger Event:
release
-
Statement type: