Synthetic Benchmarks

The Synthetic benchmark collection includes classic mathematical test functions commonly used in optimization research.

Available Problems

  • bocode.Synthetics.Ackley

  • bocode.Synthetics.Bukin

  • bocode.Synthetics.DixonPrice

  • bocode.Synthetics.Goldstein

  • bocode.Synthetics.Goldstein_Discrete

  • bocode.Synthetics.Griewank

  • bocode.Synthetics.Levy

  • bocode.Synthetics.Michalewicz

  • bocode.Synthetics.Powell

  • bocode.Synthetics.Rastrigin

  • bocode.Synthetics.Rosenbrock

  • bocode.Synthetics.Styblinski-Tang

  • bocode.Synthetics.Beale

  • bocode.Synthetics.Cosine8

  • bocode.Synthetics.DropWave

  • bocode.Synthetics.EggHolder

  • bocode.Synthetics.Hartmann3D

  • bocode.Synthetics.Hartmann6D

  • bocode.Synthetics.HolderTable

  • bocode.Synthetics.Shekelm5

  • bocode.Synthetics.Shekelm7

  • bocode.Synthetics.Shekelm10

  • bocode.Synthetics.Shekel

  • bocode.Synthetics.SixHumpCamel

  • bocode.Synthetics.ThreeHumpCamel

  • bocode.Synthetics.ConstrainedGramacy

  • bocode.Synthetics.ConstrainedHartmann

  • bocode.Synthetics.ConstrainedHartmannSmooth

  • bocode.Synthetics.PressureVessel

  • bocode.Synthetics.WeldedBeamSO

  • bocode.Synthetics.TensionCompressionString

  • bocode.Synthetics.SpeedReducer

  • bocode.Synthetics.SVM

Example Usage

import bocode
import torch

# Create a synthetic benchmark problem
problem = bocode.Synthetics.Goldstein_Discrete()

# Evaluate at a point
x = torch.Tensor([[0.0] * problem.dim])
values, constraints = problem.evaluate(x)

print(f"Goldstein Discrete function value at origin: {values[0]}")

Output:

Goldstein Discrete function value at origin: tensor([-600.])