Skip to main content

A Python Global Optimization Benchmarking Library for Evaluation and Testing (pyGOBLET).

Project description

pyGOBLET: A Python Global Optimization Benchmarking Library for Evaluation and Testing

pyGOBLET is a Python package for benchmarking global optimization algorithms.

Features

  • 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

Installation

Install from source:

pip install pygoblet

Available Problems

pyGOBLET includes standard benchmark problems and real-world inspired problems:

  • Standard benchmark problems: pygoblet.problems.standard
  • FLORIS wind farm optimization problems: pygoblet.problems.floris

Function Classification

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 constraints
  • Multimodal / Unimodal: Number of local/global minima
  • Continuous / Discontinuous: Whether the function is continuous - functions with sharp ridges or drops are classified as discontinuous
  • Differentiable / Non_differentiable: Whether the function is differentiable
  • Separable / Non_separable: Whether the function can be separated into independent subproblems
  • 1D, 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"])

Usage

Accessing Benchmark Functions

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()}")

Benchmarking a Solver

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")

Documentation

Complete documentation is available at https://pages.github.com/NREL/pyGOBLET/.

Contributing

Contributions are welcome! Please open issues or pull requests for bug fixes, new features, or improvements.

License

This project is licensed under the BSD-3-Clause License.


NREL Software Record number: SWR-25-118

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygoblet-0.1.0.tar.gz (42.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygoblet-0.1.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file pygoblet-0.1.0.tar.gz.

File metadata

  • Download URL: pygoblet-0.1.0.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pygoblet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8669af8a6d892cc6f5d6c13f8000e1daad51943a063b1ec1a6c17a1471615261
MD5 2c948a0ecd9df0936473440836611edb
BLAKE2b-256 27dd7d68c1d366a58df8359456978a111b63c5c8c3a28b278b8a1b54df7eb13e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygoblet-0.1.0.tar.gz:

Publisher: python-publish.yml on NREL/pyGOBLET

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygoblet-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pygoblet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pygoblet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 058477928db4b2afc4335c9bffb543bc22545fcfaa05a1bab88904401387f59b
MD5 a4a24855bdf50236702364dbeee86ee6
BLAKE2b-256 24dcdc324519601fa9b745e57bbdb1ae3d42125ba6a2950cfc082dacc5880744

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygoblet-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on NREL/pyGOBLET

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page