pyGOBLET is a Python package for benchmarking global optimization algorithms.
- A large collection of standard benchmark functions
- Benchmark functions inspired by real-world energy applications
- Tools for running solvers on benchmark problems
- Postprocessing tools for analyzing benchmark results
- Example scripts and tutorials demonstrating library usage
Install from source:
pip install pygobletpyGOBLET includes standard benchmark problems and real-world inspired problems:
- Standard benchmark problems:
pygoblet.problems.standard - FLORIS wind farm optimization problems:
pygoblet.problems.floris
Each standard benchmark function is tagged with one or more classification tags, which are used to organize and filter the available functions. The tags include:
Unconstrained/Constrained: Whether the function has constraintsMultimodal/Unimodal: Number of local/global minimaContinuous/Discontinuous: Whether the function is continuous - functions with sharp ridges or drops are classified as discontinuousDifferentiable/Non_differentiable: Whether the function is differentiableSeparable/Non_separable: Whether the function can be separated into independent subproblems1D,2D,nD: Dimensionality of the function
You can access groups of functions by tag using the get_standard_problems function:
import pygoblet
# All 2D functions
problems = pygoblet.get_standard_problems(["2D"])
# All problems that are multimodal, unconstrained, and n-Dimensional
problems = pygoblet.get_standard_problems(["Multimodal", "Unconstrained", "nD"])The pygoblet.problems.standard module provides standard benchmark functions for testing solvers. For example:
import pygoblet
# Create an Ackley function instance in 2D
ackley = pygoblet.problems.standard.Ackley(2)
# Evaluate at a point
x = [0.5, -0.3]
result = ackley.evaluate(x)
print(f"f({x}) = {result}")
# Get problem information
print(f"Minimum value: {ackley.min()}")
print(f"Minimizer: {ackley.argmin()}")
print(f"Bounds: {ackley.bounds()}")import scipy.optimize as opt
import pygoblet
from pygoblet.optimizer import BaseOptimizer, OptimizationResult
# Select test problems
problems = pygoblet.get_standard_problems(["2D", "Unconstrained"])
# Define solver to benchmark
class DualAnnealing(BaseOptimizer):
deterministic = False
n_points = 0
def optimize(self, func, bounds, x0=None, constraints=None, **kwargs):
result = opt.dual_annealing(func, bounds, **kwargs)
return OptimizationResult(result.x, result.fun, algorithm="Dual Annealing")
solvers = [DualAnnealing()]
# Run benchmark and generate COCO data
pygoblet.run_solvers(solvers, problems, test_dimensions=[2, 4, 5, 8, 10, 12], n_iters=5)
# Run postprocessing
pygoblet.postprocessing.postprocess_data(["output_data/DualAnnealing"], energy_file="output_data/energy_data.csv")Complete documentation is available here.
Contributions are welcome! Please open issues or pull requests for bug fixes, new features, or improvements.
This project is licensed under the BSD-3-Clause License.
NLR Software Record number: SWR-25-118