Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

opfunu-core

License: GPL v3 PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Wheel GitHub Release Date PyPI - Downloads

GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status

This library is a maintenance version, a fork of OPFUNU (Optimization Reference Functions in NUMPy). Is one of the most comprehensive Python libraries of numerical optimization reference functions. It contains all the functions from the CEC competitions of 2005, 2008, 2010, 2013, 2014, 2015, 2017, 2019, 2020, 2021, and 2022. In addition, it implements over 300 traditional functions with varying dimensions.

Citation Request

Please include these citations if you plan to use this library:

LaTeX Style

  @article{Van_Thieu_2024_Opfunu,
      author = {Van Thieu, Nguyen},
      title = {Opfunu: An Open-source Python Library for Optimization Benchmark Functions},
      doi = {10.5334/jors.508},
      journal = {Journal of Open Research Software},
      month = {May},
      year = {2024}
  }

APA Style

Van Thieu, N. (2024). Opfunu: An Open-source Python Library for Optimization Benchmark Functions. Journal of Open Research Software, 12(1), 8. https://doi.org/10.5334/jors.508

Installation and Usage

Install with pip

Install the current PyPI release:

$ pip install opfunu-core

For Numba-based vectorization (CPython only, faster batch evaluation):

$ pip install opfunu-core[numba]

Without the [numba] extra the library runs in pure-Python/NumPy mode, which also works on PyPy. Check which mode is active via opfunu.HAS_NUMBA (problem.numba_compiled reports it per instance).

Compilation stays optional even with the extra installed: every problem accepts prepare (e.g. Ackley01(ndim=10, prepare=False) defers compilation, and problem.prepare() compiles such an instance on demand), and Benchmark.default_prepare sets the policy for a whole session.

Install from Github:

$ pip install git+https://github.com/ltsim/opfunu-core
$ pip install "opfunu-core[numba] @ git+https://github.com/ltsim/opfunu-core"

Or, if you manage the project with uv:

$ uv add opfunu-core
$ uv add "opfunu-core[numba]"

After installation, you can import and check version of Opfunu:

$ python
>>> import opfunu
>>> opfunu.__version__

>>> dir(opfunu)
>>> help(opfunu)

>>> opfunu.FUNC_DATABASE      # List all name_based functions
>>> opfunu.CEC_DATABASE       # List all cec_based functions
>>> opfunu.ALL_DATABASE       # List all functions in this library

>>> opfunu.get_functions_by_classname("MiShra04")
>>> opfunu.get_functions_based_classname("2015")
>>> opfunu.get_functions_by_ndim(2)
>>> opfunu.get_functions_based_ndim(50)

>>> opfunu.get_name_based_functions(ndim=10, continuous=True)
>>> opfunu.get_cec_based_functions(ndim=2)

Let's go through some examples.

Examples

How to get the function and use it

1st way

from opfunu.cec_based.cec2014 import F12014

func = F12014(ndim=30)
func.evaluate(func.create_solution())

## or

from opfunu.cec_based import F102014

func = F102014(ndim=50)
func.evaluate(func.create_solution())

2nd way

import opfunu

funcs = opfunu.get_functions_by_classname("F12014")
func = funcs[0](ndim=10)
func.evaluate(func.create_solution())

## or

all_funcs_2014 = opfunu.get_functions_based_classname("2014")
print(all_funcs_2014)

For more usage examples please look at examples folder.

Contributing

There are lots of ways how you can contribute to opfunu-core's development, and you are welcome to join in! For example, you can report problems or make feature requests on the issues pages. To facilitate contributions, please check for the guidelines in the CONTRIBUTING.md file.

Development

The project is managed with uv:

$ uv sync                # install runtime + dev dependencies
$ uv sync --group docs   # additionally install the docs tooling

Ruff (lint and format):

$ uv run ruff check .            # lint
$ uv run ruff format .           # format
$ uv run ruff format --check .   # verify formatting

Mypy (type-checking):

$ uv run mypy          # type-check the package (config in pyproject.toml)
$ uv run mypy-coverage # report type-annotation coverage

MkDocs (documentation, Material theme):

$ uv run mkdocs serve                # live preview at http://127.0.0.1:8000
$ uv run mkdocs build                # build the static site into site/
$ uv run mkdocs gh-deploy --force    # publish to GitHub Pages

Run the test suite with:

$ uv run pytest

Official channels


  • Maintained by: LTSIM @ 2026
  • Developed by: Thieu @ 2023

Metadata

Release files for opfunu-core 2026b0

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

Source distribution (sdist)

Source distribution for opfunu-core 2026b0
File Size Uploaded Provenance Actions
opfunu_core-2026b0.tar.gz 12.4 MB With provenance Details for opfunu_core-2026b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opfunu-core 2026b0
File Interpreter ABI Platform Actions
opfunu_core-2026b0-py3-none-any.whl Python 3 none any Details for opfunu_core-2026b0-py3-none-any.whl

Total release size: 25.4 MB

Release files / opfunu_core-2026b0.tar.gz

Download URL opfunu_core-2026b0.tar.gz
Size 12.4 MB
Tags Source
SHA-256 checksum
How to use checksums
08e2321bc47f82c22665580041f598b0824cfd30e373fe56e23720247c5204c5
BLAKE2b-256 checksum
How to use checksums
e3b4e2ea1e07281786610ba217d32cadbdc3de8ebc7407eacc83fb0c6c0ed91c
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 Oct 24, 2026.

Transparency log

Release files / opfunu_core-2026b0-py3-none-any.whl

Download URL opfunu_core-2026b0-py3-none-any.whl
Size 13.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bf62b501650e0e3f81369851dd0f6c26a4e1d1be7cd0c49cdd8de92e3444241f
BLAKE2b-256 checksum
How to use checksums
5ced0ce2bd5b93cd7d59f97c8e3f9a68c7f42432b00f4b1a1b3ac553992079b4
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 Oct 24, 2026.

Transparency log

Security for opfunu-core 2026b0

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 opfunu_core-2026b0.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 Oct 24, 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