Skip to main content

An Open-source Python Library for Optimization Benchmark Functions

Project description

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

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

Install from Github:

$ pip install git+https://github.com/ltsim/opfunu-core

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 Permetrics'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.

Official channels


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

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

opfunu_core-1.0.6.tar.gz (12.3 MB view details)

Uploaded Source

Built Distribution

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

opfunu_core-1.0.6-py3-none-any.whl (13.0 MB view details)

Uploaded Python 3

File details

Details for the file opfunu_core-1.0.6.tar.gz.

File metadata

  • Download URL: opfunu_core-1.0.6.tar.gz
  • Upload date:
  • Size: 12.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opfunu_core-1.0.6.tar.gz
Algorithm Hash digest
SHA256 07e99c5e9c10c19f29b12255183229952c1112cf20c675541f02b8991b53473e
MD5 f2cf9a532be438deb9fa777d2e13bfca
BLAKE2b-256 ef586385ac15d428c9e516687645f88f8ace1e49b269129bd472e2a86f63a9c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for opfunu_core-1.0.6.tar.gz:

Publisher: publish.yml on ltsim/opfunu-core

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

File details

Details for the file opfunu_core-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: opfunu_core-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opfunu_core-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b979957218836924020098dbb5ec297c8a84a6939293ce8e192d5aa6ab66845e
MD5 6701e240f2cc85acb0f04cbe8fdb2ca3
BLAKE2b-256 b36633634fc605bcd1a8e3dba3b4cadd020ba1fd6f9dfd295b7e539a1ab95c16

See more details on using hashes here.

Provenance

The following attestation bundles were made for opfunu_core-1.0.6-py3-none-any.whl:

Publisher: publish.yml on ltsim/opfunu-core

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