Getting Started¶
Installation¶
To use BOCoDe, first install it using pip:
(.venv) $ pip install bocode
Quick Start¶
Here’s a simple example of how to use BOCoDe:
import bocode
import torch
# Retrieve all available benchmark problems in BOCoDe by searching with no filters
all_problems = bocode.filter_functions()
print(all_problems)
# Instantiate a synthetic benchmark problem
problem = bocode.Synthetics.Ackley()
# Evaluate at a point
x = torch.Tensor([[0.0] * problem.dim])
values, constraints = problem.evaluate(x)
print(f"Ackley function value at origin: {values[0]}")
Basic Concepts¶
BOCoDe provides a standardized interface for various benchmark problems. Each problem has:
An objective function to be optimized
Input dimension (number of decision variables)
Bounds on the decision variables
Optional constraints that must be satisfied
Known optimum value (for some problems)