Skip to main content

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 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 precompile (e.g. Ackley01(ndim=10, precompile=False)), and Benchmark.default_precompile 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 2026.0

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 2026.0
File Size Uploaded Provenance Actions
opfunu_core-2026.0.tar.gz 12.4 MB With provenance Details for opfunu_core-2026.0.tar.gz

Built distribution (wheel)

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

Total release size: 25.4 MB

Release files / opfunu_core-2026.0.tar.gz

Download URL opfunu_core-2026.0.tar.gz
Size 12.4 MB
Tags Source
SHA-256 checksum
How to use checksums
dd04e6ce494521996c1ee700f6d918733e99be84e1fc30a811534abac3e3209c
BLAKE2b-256 checksum
How to use checksums
761b3b20faddb15e4c20041fcee13b687e48e493a1c65e33c38a878cdeb45ba1
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 23, 2026.

Transparency log

Release files / opfunu_core-2026.0-py3-none-any.whl

Download URL opfunu_core-2026.0-py3-none-any.whl
Size 13.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
30b2de66987e71b4939517050da7c1238b5f03251fa76be8361c819f2b86d55b
BLAKE2b-256 checksum
How to use checksums
7a3513d325028c7a44a7ffaee05812564729d500341966a364c250e5fc56da14
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 23, 2026.

Transparency log

Security for opfunu-core 2026.0

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-2026.0.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 23, 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