Skip to main content

Opfunu: An Open-source Python Library for Optimization Benchmark Functions

Project description

OPFUNU


GitHub release Wheel PyPI version PyPI - Python Version PyPI - Status PyPI - Downloads Downloads Tests & Publishes to PyPI GitHub Release Date Documentation Status Chat Average time to resolve an issue Percentage of issues still open GitHub contributors GitTutorial DOI License: GPL v3

OPFUNU (OPtimization benchmark FUnctions in NUmpy) is the largest python library for cutting-edge numerical optimization benchmark functions. Contains all CEC competition functions from 2005, 2008, 2010, 2013, 2014, 2015, 2017, 2019, 2020, 2021, 2022. Besides, more than 300 traditional functions with different dimensions are implemented.

  • Free software: GNU General Public License (GPL) V3 license
  • Total problems: > 500 problems
  • Documentation: https://opfunu.readthedocs.io
  • Python versions: >= 3.7.x
  • Dependencies: numpy, matplotlib

Installation and Usage

Install with pip

Install the current PyPI release:

$ pip install opfunu

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("CEC2014")
>>> opfunu.get_functions_based_classname("2015")
>>> opfunu.get_functions_by_ndim(30)
>>> opfunu.get_functions_based_ndim(2)
>>> opfunu.get_all_named_functions()
>>> opfunu.get_all_cec_functions()
>>> opfunu.get_functions()
>>> opfunu.get_cecs()

Lib's structure

docs
examples
opfunu
    cec_based
        cec.py
        cec2005.py
        cec2008.py
        ...
        cec2021.py
        cec2022.py
    name_based
        a_func.py
        b_func.py
        ...
        y_func.py
        z_func.py
    utils
        operator.py
        validator.py
        visualize.py
    __init__.py
    benchmark.py
README.md
setup.py

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.

Get helps (questions, problems)

Cite Us

If you are using opfunu in your project, we would appreciate citations:

@software{thieu_nguyen_2020_3711682,
  author       = {Nguyen Van Thieu},
  title        = {Opfunu: An Open-source Python Library for Optimization Benchmark Functions},
  year         = 2020,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.3620960},
  url          = {https://doi.org/10.5281/zenodo.3620960.}
}

References

1. http://benchmarkfcns.xyz/fcns
2. https://en.wikipedia.org/wiki/Test_functions_for_optimization
3. https://www.cs.unm.edu/~neal.holts/dga/benchmarkFunction/
4. http://www.sfu.ca/~ssurjano/optimization.html
5. A Literature Survey of Benchmark Functions For Global Optimization Problems (2013)
6. Problem Definitions and Evaluation Criteria for the CEC 2014 Special Session and Competition on Single Objective Real-Parameter Numerical Optimization 

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-1.0.2.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-1.0.2-py3-none-any.whl (13.0 MB view details)

Uploaded Python 3

File details

Details for the file opfunu-1.0.2.tar.gz.

File metadata

  • Download URL: opfunu-1.0.2.tar.gz
  • Upload date:
  • Size: 12.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for opfunu-1.0.2.tar.gz
Algorithm Hash digest
SHA256 afd0202bc0cb91178888720d740e6a3051bfdf73c83293404f187606315adb27
MD5 afc78ee68abbe670d9a31a662e7c19f5
BLAKE2b-256 33c82f49120ad317342d7e0df002097527f608bcc1409127f8272a258a60fb81

See more details on using hashes here.

File details

Details for the file opfunu-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: opfunu-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for opfunu-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 326bdec6c0d0f677cdc6e2c86e78d028861708c48bce273331f764e3a5680c66
MD5 837aea9609bed5801a0012277b8220e0
BLAKE2b-256 6ea3d19e55b7217f2cd879b66706f2af64a35d220a862c2a9748211ad1171195

See more details on using hashes here.

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