opfunu
A collection of Benchmark functions for numerical optimization problems
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.1%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A collection of Benchmark functions for numerical optimization problems
Basic Info
- Host: GitHub
- Owner: thieu1995
- License: gpl-3.0
- Language: Python
- Default Branch: master
- Homepage: https://opfunu.readthedocs.io
- Size: 20.2 MB
Statistics
- Stars: 154
- Watchers: 4
- Forks: 40
- Open Issues: 7
- Releases: 24
Topics
Metadata Files
README.md

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
Citation Request
Please include these citations if you plan to use this library:
- LaTeX:
bibtex
@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:
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:
sh
$ pip install opfunu
After installation, you can import and check version of Opfunu:
```sh $ python
import opfunu opfunu.version
dir(opfunu) help(opfunu)
opfunu.FUNCDATABASE # List all namebased functions opfunu.CECDATABASE # List all cecbased functions opfunu.ALL_DATABASE # List all functions in this library
opfunu.getfunctionsbyclassname("MiShra04") opfunu.getfunctionsbasedclassname("2015") opfunu.getfunctionsbyndim(2) opfunu.getfunctionsbasedndim(50)
opfunu.getnamebasedfunctions(ndim=10, continuous=True) opfunu.getcecbasedfunctions(ndim=2) ```
Let's go through some examples.
Examples
How to get the function and use it
1st way
```python 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
```python import opfunu
funcs = opfunu.getfunctionsbyclassname("F12014") func = funcs0 func.evaluate(func.createsolution())
or
allfuncs2014 = opfunu.getfunctionsbasedclassname("2014") print(allfuncs_2014) ```
How to draw 2D, 3D
Two ways if you want to draw functions that available in Opfunu.
```python from opfunu.cec_based import F12010 f0 = F12010()
Visualize opfunu function using method in object
f0.plot2d(selecteddims=(2, 3), npoints=300, ctcmap="viridis", ctlevels=30, ctalpha=0.7, fixedstrategy="mean", fixedvalues=None, title="Contour map of the F1 CEC 2010 function", xlabel=None, ylabel=None, figsize=(10, 8), filename="2d-f12010", exts=(".png", ".pdf"), verbose=True)
f0.plot3d(selecteddims=(1, 6), npoints=500, ctcmap="viridis", ctlevels=30, ctalpha=0.7, fixedstrategy="mean", fixedvalues=None, title="3D visualization of the F1 CEC 2010 function", xlabel=None, ylabel=None, figsize=(10, 8), filename="3d-f12010", exts=(".png", ".pdf"), verbose=True)
Visualize opfunu function using utility function
from opfunu import draw2d, draw3d
draw2d(f0.evaluate, f0.lb, f0.ub, selecteddims=(2, 3), npoints=300) draw3d(f0.evaluate, f0.lb, f0.ub, selecteddims=(2, 3), npoints=300) ```
F1-2010 CEC 2D |
F1-2010 CEC 3D |
How to draw Latex
Two ways if you want to draw latex equation.
```python from opfunu.cecbased import F12010 from opfunu.namebased import Ackley02 from opfunu.utils.visualize import draw_latex
f0 = F12010() f1 = Ackley02()
Plot using function inside the object
f0.plotlatex(f0.latexformula, figsize=(8, 3), dpi=500, title="Latex equation", exts=(".png", ".pdf"), verbose=True) f1.plotlatex(f1.latexformulaglobaloptimum, figsize=(8, 3), dpi=500, title="Global optimum", verbose=True)
Plot using module
drawlatex(f0.latexformulabounds, title="Boundary for Function") drawlatex(f1.latexformuladimension, title=None) ```
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
- Official source code repository
- Official document
- Download releases
- Issue tracker
- Notable changes log
- Official discussion group
Developed by: Thieu @ 2023
Owner
- Name: Nguyen Van Thieu
- Login: thieu1995
- Kind: user
- Location: Earth
- Company: AIIR Group
- Website: https://thieu1995.github.io/
- Repositories: 13
- Profile: https://github.com/thieu1995
Knowledge is power, sharing it is the premise of progress in life. It seems like a burden to someone, but it is the only way to achieve immortality.
GitHub Events
Total
- Issues event: 2
- Watch event: 32
- Fork event: 2
Last Year
- Issues event: 2
- Watch event: 32
- Fork event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Thieu Nguyen | n****2@g****m | 468 |
| Travis Silvers | f****d@g****m | 9 |
| SkyLull | j****2@g****m | 3 |
| Thieu Nguyen | 1****1 | 2 |
| mcrimi | m****i@g****m | 1 |
| dependabot[bot] | 4****] | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 22
- Total pull requests: 16
- Average time to close issues: 4 months
- Average time to close pull requests: 3 months
- Total issue authors: 17
- Total pull request authors: 8
- Average comments per issue: 3.36
- Average comments per pull request: 0.75
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 2
Past Year
- Issues: 3
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 3
- Pull request authors: 0
- Average comments per issue: 0.33
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mpvanderschelling (4)
- Gang1024 (2)
- najmehn00 (1)
- SkyLull (1)
- JixiangChen-Jimmy (1)
- plantom007 (1)
- pooriama (1)
- Bardbo (1)
- mlojek (1)
- guoyuejiang (1)
- CircuitCM (1)
- borisalmonacid (1)
- mrsonandrade (1)
- cheng12456 (1)
- RuiZhong961230 (1)
Pull Request Authors
- firestrand (8)
- dependabot[bot] (4)
- SkyLull (3)
- musicinmybrain (2)
- mcrimi (1)
- ElliottP-13 (1)
- firefly-cpp (1)
- HaaLeo (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 14
-
Total downloads:
- pypi 10,168 last-month
-
Total dependent packages: 6
(may contain duplicates) -
Total dependent repositories: 3
(may contain duplicates) - Total versions: 52
- Total maintainers: 2
pypi.org: opfunu
Opfunu: An Open-source Python Library for Optimization Benchmark Functions
- Homepage: https://github.com/thieu1995/opfunu
- Documentation: https://opfunu.readthedocs.io/
- License: GPLv3
-
Latest release: 1.0.4
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.18: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.0-r3
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.0-r3
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.17: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.0-r1
published over 3 years ago
Rankings
Maintainers (1)
alpine-edge: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
alpine-edge: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.2-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.21: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.19: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.1-r0
published over 2 years ago
alpine-v3.21: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.2-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.19: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.1-r0
published over 2 years ago
Rankings
alpine-v3.22: py3-opfunu
A collection of Benchmark functions for numerical optimization problems
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.22: py3-opfunu-pyc
Precompiled Python bytecode for py3-opfunu
- Homepage: https://github.com/thieu1995/opfunu
- License: MIT
-
Latest release: 1.0.4-r0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/cache v1 composite
- actions/checkout v1 composite
- actions/download-artifact v2 composite
- actions/setup-python v1 composite
- actions/upload-artifact master composite
- pypa/gh-action-pypi-publish master composite
- Pillow >=9.1.0
- matplotlib >=3.3.0
- numpy >=1.16.5
- readthedocs-sphinx-search ==0.3.2
- requests >=2.27.0
- sphinx ==4.4.0
- sphinx_rtd_theme ==1.0.0
- Pillow >=9.1.0
- flake8 >=4.0.1
- matplotlib >=3.3.0
- numpy >=1.16.5
- pytest ==7.1.2
- pytest-cov ==4.0.0
- requests >=2.27.0
- numpy >=1.16.5