Skip to main content

banana-bench

PyPI version Python Downloads License: MIT Build Status Docs Ruff

A comprehensive collection of 70+ standard mathematical benchmark functions for testing and evaluating optimization algorithms.

Why "banana-bench"? Rosenbrock's function — one of the most famous test functions in optimization, and part of this suite (rosenbrock) — is nicknamed the "banana function" for its curved, banana-shaped valley. This is the bench you run your optimizer through.

📚 Documentation

Full documentation is published at banana-bench.readthedocs.io, built from the sources in the docs/ directory:

🎯 Features

  • 70+ Benchmark Functions: Multimodal, Unimodal, and Special functions.
  • Constrained Suites: The complete CEC2006 G-suite (g01-g24) and four classic engineering design problems (spring_design, pressure_vessel, welded_beam, gear_train), plus Deb's feasibility rule (feasibility_compare) for ranking constrained results.
  • Multi-Objective Suite: ZDT1-4 and ZDT6 with analytic Pareto fronts, IGD and hypervolume scoring via MOBenchmarkRunner.
  • Rich Metadata: Access bounds, dimensions, known minima programmatically, and query functions by property (query_functions(separable=False, unimodal=False)).
  • Wrappers & CEC-Style Composition: Noise, shift, rotation, and CEC 2017/2020-style composition on any callable, including your own functions.
  • Benchmarking Tools: Automated testing with BenchmarkRunner, serial or parallel, and side-by-side ranking with compare_algorithms.
  • Visualization: 2D/3D plots, convergence tracking, and heatmaps (Matplotlib or Plotly).
  • Command-Line Interface: banana-bench --list, --info, and --function across every suite.
  • Minimal Core Dependencies: Only NumPy is required; everything else is optional.

📦 Installation

From PyPI

pip install banana-bench

From Source

git clone https://github.com/ak-rahul/banana-bench.git
cd banana-bench
pip install -e .

Optional extras:

pip install "banana-bench[viz]"          # Matplotlib plotting
pip install "banana-bench[interactive]"  # Plotly plotting
pip install "banana-bench[parallel]"     # parallel benchmarking (joblib)
pip install "banana-bench[progress]"     # progress bars (tqdm)
pip install "banana-bench[all]"          # everything above, plus SciPy and Optuna

🚀 Quick Start

import numpy as np
from bananabench import ackley, BenchmarkRunner

# 1. Use a single function
x = np.zeros(5)
print(f"Ackley(0) = {ackley(x)}")

# 2. Run a benchmark suite
def my_optimizer(func, bounds):
    # Your optimization logic here...
    return np.zeros(len(bounds)), 0.0

runner = BenchmarkRunner(my_optimizer, "MyAlgo", n_runs=5)
results = runner.run_suite(functions=['sphere', 'ackley'])

For detailed usage, see the User Guide.

Metadata

Release files for banana-bench 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for banana-bench 0.3.0
File Size Uploaded Provenance Actions
banana_bench-0.3.0.tar.gz 134.4 kB With provenance Details for banana_bench-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for banana-bench 0.3.0
File Interpreter ABI Platform Actions
banana_bench-0.3.0-py3-none-any.whl Python 3 none any Details for banana_bench-0.3.0-py3-none-any.whl

Total release size: 200.8 kB

Release files / banana_bench-0.3.0.tar.gz

Download URL banana_bench-0.3.0.tar.gz
Size 134.4 kB
Tags Source
SHA-256 checksum
How to use checksums
93250f7d89d11c27aee1ee942d312d208a49bc6824fc7421d3e84fae4b743114
BLAKE2b-256 checksum
How to use checksums
72101b80d30fbffe567db9e3be43174d9ef938a803717a2e85ff6fbb58a98784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / banana_bench-0.3.0-py3-none-any.whl

Download URL banana_bench-0.3.0-py3-none-any.whl
Size 66.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccf09646732a491328b0eca1ef7dde31d0c9e59164d6d63bb46b2b4bc3b41ca1
BLAKE2b-256 checksum
How to use checksums
a2d9f9968dc38853a5fb88881c2bee30b588c35decfffeda69fa35ed95744dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for banana-bench 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for banana_bench-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page