opfunu


Nameopfunu JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/thieu1995/opfunu
SummaryOpfunu: An Open-source Python Library for Optimization Benchmark Functions
upload_time2024-06-04 16:43:37
maintainerNone
docs_urlNone
authorThieu
requires_python<3.12,>=3.7
licenseGPLv3
keywords optimization functions test functions benchmark functions mathematical functions cec competitions cec-2008 cec-2009 cec-2010 cec-2011 cec-2012 cec-2013 cec-2014 cec-2015 cec-2017 cec-2019 cec-2020 cec-2021 cec-2022 soft computing stochastic optimization global optimization convergence analysis search space exploration local search computational intelligence performance analysis exploration versus exploitation constrained optimization simulations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<p align="center"><img src=".github/img/logo.png" alt="OPFUNU" title="OPFUNU"/></p>

---


[![GitHub release](https://img.shields.io/badge/release-1.0.4-yellow.svg)](https://github.com/thieu1995/opfunu/releases)
[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/opfunu) 
[![PyPI version](https://badge.fury.io/py/opfunu.svg)](https://badge.fury.io/py/opfunu)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/opfunu.svg)
![PyPI - Status](https://img.shields.io/pypi/status/opfunu.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/opfunu.svg)
[![Downloads](https://pepy.tech/badge/opfunu)](https://pepy.tech/project/opfunu)
[![Tests & Publishes to PyPI](https://github.com/thieu1995/opfunu/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/opfunu/actions/workflows/publish-package.yaml)
![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/opfunu.svg)
[![Documentation Status](https://readthedocs.org/projects/opfunu/badge/?version=latest)](https://opfunu.readthedocs.io/en/latest/?badge=latest)
[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/thieu1995/opfunu.svg)](http://isitmaintained.com/project/thieu1995/opfunu "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/thieu1995/opfunu.svg)](http://isitmaintained.com/project/thieu1995/opfunu "Percentage of issues still open")
![GitHub contributors](https://img.shields.io/github/contributors/thieu1995/opfunu.svg)
[![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3620960.svg)](https://doi.org/10.5281/zenodo.3620960)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)


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. <i>Journal of Open Research Software</i>, <i>12</i>(1), 8. https://doi.org/10.5334/jors.508


# Installation and Usage

### Install with pip

Install the [current PyPI release](https://pypi.python.org/pypi/opfunu):
```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.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

```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.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)
```


### 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.plot_2d(selected_dims=(2, 3), n_points=300, ct_cmap="viridis", ct_levels=30, ct_alpha=0.7,
           fixed_strategy="mean", fixed_values=None, title="Contour map of the F1 CEC 2010 function",
           x_label=None, y_label=None, figsize=(10, 8), filename="2d-f12010", exts=(".png", ".pdf"), verbose=True)

f0.plot_3d(selected_dims=(1, 6), n_points=500, ct_cmap="viridis", ct_levels=30, ct_alpha=0.7,
           fixed_strategy="mean", fixed_values=None, title="3D visualization of the F1 CEC 2010 function",
           x_label=None, y_label=None, figsize=(10, 8), filename="3d-f12010", exts=(".png", ".pdf"), verbose=True)

## Visualize opfunu function using utility function
from opfunu import draw_2d, draw_3d

draw_2d(f0.evaluate, f0.lb, f0.ub, selected_dims=(2, 3), n_points=300)
draw_3d(f0.evaluate, f0.lb, f0.ub, selected_dims=(2, 3), n_points=300)
```

<table>
  <tr>
    <td style="text-align: center;">
      <img src=".github/img/2d-f12010.png" alt="F1-2010 CEC 2D" style="width: 100%;">
      <p style="text-align: center;">F1-2010 CEC 2D</p>
    </td>
    <td style="text-align: center;">
      <img src=".github/img/3d-f12010.png" alt="F1-2010 CEC 3D" style="width: 100%;">
    <p style="text-align: center;">F1-2010 CEC 3D</p>
    </td>
  </tr>
</table>


### How to draw Latex

Two ways if you want to draw latex equation. 

```python
from opfunu.cec_based import F12010
from opfunu.name_based import Ackley02
from opfunu.utils.visualize import draw_latex

f0 = F12010()
f1 = Ackley02()

## Plot using function inside the object
f0.plot_latex(f0.latex_formula, figsize=(8, 3), dpi=500, title="Latex equation", exts=(".png", ".pdf"), verbose=True)
f1.plot_latex(f1.latex_formula_global_optimum, figsize=(8, 3), dpi=500, title="Global optimum", verbose=True)

## Plot using module
draw_latex(f0.latex_formula_bounds, title="Boundary for Function")
draw_latex(f1.latex_formula_dimension, title=None)
```



For more usage examples please look at [examples](/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](/issues) pages. To facilitate contributions, 
please check for the guidelines in the [CONTRIBUTING.md](/CONTRIBUTING.md) file.


# Official channels 

* [Official source code repository](https://github.com/thieu1995/opfunu)
* [Official document](https://opfunu.readthedocs.io/)
* [Download releases](https://pypi.org/project/opfunu/) 
* [Issue tracker](https://github.com/thieu1995/opfunu/issues) 
* [Notable changes log](/ChangeLog.md)
* [Official discussion group](https://t.me/+fRVCJGuGJg1mNDg1)


---

Developed by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=Opfunu_QUESTIONS) @ 2023

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thieu1995/opfunu",
    "name": "opfunu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.7",
    "maintainer_email": null,
    "keywords": "optimization functions, test functions, benchmark functions, mathematical functions, CEC competitions, CEC-2008, CEC-2009, CEC-2010, CEC-2011, CEC-2012, CEC-2013, CEC-2014, CEC-2015, CEC-2017, CEC-2019, CEC-2020, CEC-2021, CEC-2022, soft computing, Stochastic optimization, Global optimization, Convergence analysis, Search space exploration, Local search, Computational intelligence, Performance analysis, Exploration versus exploitation, Constrained optimization, Simulations",
    "author": "Thieu",
    "author_email": "nguyenthieu2102@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/58/85896b99b009be89825a672e2f108b4ee5cbc8d9c3f553fc9e6640ddb97a/opfunu-1.0.4.tar.gz",
    "platform": null,
    "description": "\n<p align=\"center\"><img src=\".github/img/logo.png\" alt=\"OPFUNU\" title=\"OPFUNU\"/></p>\n\n---\n\n\n[![GitHub release](https://img.shields.io/badge/release-1.0.4-yellow.svg)](https://github.com/thieu1995/opfunu/releases)\n[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/opfunu) \n[![PyPI version](https://badge.fury.io/py/opfunu.svg)](https://badge.fury.io/py/opfunu)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/opfunu.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/opfunu.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/opfunu.svg)\n[![Downloads](https://pepy.tech/badge/opfunu)](https://pepy.tech/project/opfunu)\n[![Tests & Publishes to PyPI](https://github.com/thieu1995/opfunu/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/opfunu/actions/workflows/publish-package.yaml)\n![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/opfunu.svg)\n[![Documentation Status](https://readthedocs.org/projects/opfunu/badge/?version=latest)](https://opfunu.readthedocs.io/en/latest/?badge=latest)\n[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/thieu1995/opfunu.svg)](http://isitmaintained.com/project/thieu1995/opfunu \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/thieu1995/opfunu.svg)](http://isitmaintained.com/project/thieu1995/opfunu \"Percentage of issues still open\")\n![GitHub contributors](https://img.shields.io/github/contributors/thieu1995/opfunu.svg)\n[![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3620960.svg)](https://doi.org/10.5281/zenodo.3620960)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\nOPFUNU (OPtimization benchmark FUnctions in NUmpy) is the largest python library for cutting-edge numerical \noptimization benchmark functions. Contains all CEC competition functions from 2005, 2008, 2010, 2013, 2014, 2015, \n2017, 2019, 2020, 2021, 2022. Besides, more than 300 traditional functions with different dimensions are implemented.\n\n* **Free software:** GNU General Public License (GPL) V3 license\n* **Total problems**: > 500 problems\n* **Documentation:** https://opfunu.readthedocs.io\n* **Python versions:** >= 3.7.x\n* **Dependencies:** numpy, matplotlib\n\n\n# Citation Request \n\nPlease include these citations if you plan to use this library:\n\n- LaTeX:\n\n```bibtex\n  @article{Van_Thieu_2024_Opfunu,\n      author = {Van Thieu, Nguyen},\n      title = {Opfunu: An Open-source Python Library for Optimization Benchmark Functions},\n      doi = {10.5334/jors.508},\n      journal = {Journal of Open Research Software},\n      month = {May},\n      year = {2024}\n  }\n```\n\n- APA:\n  \n  Van Thieu, N. (2024). Opfunu: An Open-source Python Library for Optimization Benchmark Functions. <i>Journal of Open Research Software</i>, <i>12</i>(1), 8. https://doi.org/10.5334/jors.508\n\n\n# Installation and Usage\n\n### Install with pip\n\nInstall the [current PyPI release](https://pypi.python.org/pypi/opfunu):\n```sh\n$ pip install opfunu\n```\n\nAfter installation, you can import and check version of Opfunu:\n\n```sh\n$ python\n>>> import opfunu\n>>> opfunu.__version__\n\n>>> dir(opfunu)\n>>> help(opfunu)\n\n>>> opfunu.FUNC_DATABASE      # List all name_based functions\n>>> opfunu.CEC_DATABASE       # List all cec_based functions\n>>> opfunu.ALL_DATABASE       # List all functions in this library\n\n>>> opfunu.get_functions_by_classname(\"MiShra04\")\n>>> opfunu.get_functions_based_classname(\"2015\")\n>>> opfunu.get_functions_by_ndim(2)\n>>> opfunu.get_functions_based_ndim(50)\n\n>>> opfunu.get_name_based_functions(ndim=10, continuous=True)\n>>> opfunu.get_cec_based_functions(ndim=2)\n```\n\nLet's go through some examples.\n\n\n### Examples\n\nHow to get the function and use it\n\n#### 1st way\n\n```python\nfrom opfunu.cec_based.cec2014 import F12014\n\nfunc = F12014(ndim=30)\nfunc.evaluate(func.create_solution())\n\n## or\n\nfrom opfunu.cec_based import F102014\n\nfunc = F102014(ndim=50)\nfunc.evaluate(func.create_solution())\n```\n\n\n#### 2nd way\n\n```python\nimport opfunu\n\nfuncs = opfunu.get_functions_by_classname(\"F12014\")\nfunc = funcs[0](ndim=10)\nfunc.evaluate(func.create_solution())\n\n## or\n\nall_funcs_2014 = opfunu.get_functions_based_classname(\"2014\")\nprint(all_funcs_2014)\n```\n\n\n### How to draw 2D, 3D \n\nTwo ways if you want to draw functions that available in Opfunu.\n\n```python\nfrom opfunu.cec_based import F12010\nf0 = F12010()\n\n# Visualize opfunu function using method in object\nf0.plot_2d(selected_dims=(2, 3), n_points=300, ct_cmap=\"viridis\", ct_levels=30, ct_alpha=0.7,\n           fixed_strategy=\"mean\", fixed_values=None, title=\"Contour map of the F1 CEC 2010 function\",\n           x_label=None, y_label=None, figsize=(10, 8), filename=\"2d-f12010\", exts=(\".png\", \".pdf\"), verbose=True)\n\nf0.plot_3d(selected_dims=(1, 6), n_points=500, ct_cmap=\"viridis\", ct_levels=30, ct_alpha=0.7,\n           fixed_strategy=\"mean\", fixed_values=None, title=\"3D visualization of the F1 CEC 2010 function\",\n           x_label=None, y_label=None, figsize=(10, 8), filename=\"3d-f12010\", exts=(\".png\", \".pdf\"), verbose=True)\n\n## Visualize opfunu function using utility function\nfrom opfunu import draw_2d, draw_3d\n\ndraw_2d(f0.evaluate, f0.lb, f0.ub, selected_dims=(2, 3), n_points=300)\ndraw_3d(f0.evaluate, f0.lb, f0.ub, selected_dims=(2, 3), n_points=300)\n```\n\n<table>\n  <tr>\n    <td style=\"text-align: center;\">\n      <img src=\".github/img/2d-f12010.png\" alt=\"F1-2010 CEC 2D\" style=\"width: 100%;\">\n      <p style=\"text-align: center;\">F1-2010 CEC 2D</p>\n    </td>\n    <td style=\"text-align: center;\">\n      <img src=\".github/img/3d-f12010.png\" alt=\"F1-2010 CEC 3D\" style=\"width: 100%;\">\n    <p style=\"text-align: center;\">F1-2010 CEC 3D</p>\n    </td>\n  </tr>\n</table>\n\n\n### How to draw Latex\n\nTwo ways if you want to draw latex equation. \n\n```python\nfrom opfunu.cec_based import F12010\nfrom opfunu.name_based import Ackley02\nfrom opfunu.utils.visualize import draw_latex\n\nf0 = F12010()\nf1 = Ackley02()\n\n## Plot using function inside the object\nf0.plot_latex(f0.latex_formula, figsize=(8, 3), dpi=500, title=\"Latex equation\", exts=(\".png\", \".pdf\"), verbose=True)\nf1.plot_latex(f1.latex_formula_global_optimum, figsize=(8, 3), dpi=500, title=\"Global optimum\", verbose=True)\n\n## Plot using module\ndraw_latex(f0.latex_formula_bounds, title=\"Boundary for Function\")\ndraw_latex(f1.latex_formula_dimension, title=None)\n```\n\n\n\nFor more usage examples please look at [examples](/examples) folder.\n\n\n\n# Contributing\n\nThere are lots of ways how you can contribute to Permetrics's development, and you are welcome to join in! For example, \nyou can report problems or make feature requests on the [issues](/issues) pages. To facilitate contributions, \nplease check for the guidelines in the [CONTRIBUTING.md](/CONTRIBUTING.md) file.\n\n\n# Official channels \n\n* [Official source code repository](https://github.com/thieu1995/opfunu)\n* [Official document](https://opfunu.readthedocs.io/)\n* [Download releases](https://pypi.org/project/opfunu/) \n* [Issue tracker](https://github.com/thieu1995/opfunu/issues) \n* [Notable changes log](/ChangeLog.md)\n* [Official discussion group](https://t.me/+fRVCJGuGJg1mNDg1)\n\n\n---\n\nDeveloped by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=Opfunu_QUESTIONS) @ 2023\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Opfunu: An Open-source Python Library for Optimization Benchmark Functions",
    "version": "1.0.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/thieu1995/opfunu/issues",
        "Change Log": "https://github.com/thieu1995/opfunu/blob/master/ChangeLog.md",
        "Documentation": "https://opfunu.readthedocs.io/",
        "Forum": "https://t.me/+fRVCJGuGJg1mNDg1",
        "Homepage": "https://github.com/thieu1995/opfunu",
        "Source Code": "https://github.com/thieu1995/opfunu"
    },
    "split_keywords": [
        "optimization functions",
        " test functions",
        " benchmark functions",
        " mathematical functions",
        " cec competitions",
        " cec-2008",
        " cec-2009",
        " cec-2010",
        " cec-2011",
        " cec-2012",
        " cec-2013",
        " cec-2014",
        " cec-2015",
        " cec-2017",
        " cec-2019",
        " cec-2020",
        " cec-2021",
        " cec-2022",
        " soft computing",
        " stochastic optimization",
        " global optimization",
        " convergence analysis",
        " search space exploration",
        " local search",
        " computational intelligence",
        " performance analysis",
        " exploration versus exploitation",
        " constrained optimization",
        " simulations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c8356a5d39c16fcfbd9665afbbf04e4d770bdb93d93a69a08483767efb6e430",
                "md5": "d8a3eb913cbffa413a82e59f71c892d8",
                "sha256": "ca2af1816552cb28ac4eb71519627bc32e8000514b6b7b34a654f70afbbd2240"
            },
            "downloads": -1,
            "filename": "opfunu-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8a3eb913cbffa413a82e59f71c892d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.7",
            "size": 13012221,
            "upload_time": "2024-06-04T16:43:34",
            "upload_time_iso_8601": "2024-06-04T16:43:34.392903Z",
            "url": "https://files.pythonhosted.org/packages/5c/83/56a5d39c16fcfbd9665afbbf04e4d770bdb93d93a69a08483767efb6e430/opfunu-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e05885896b99b009be89825a672e2f108b4ee5cbc8d9c3f553fc9e6640ddb97a",
                "md5": "4c5ec7f3d19b2606bfaf2090c858db52",
                "sha256": "1ae4e83f435c155d6a6ad28f6118d78df8c73d6827a59323167637d6a1d3bf07"
            },
            "downloads": -1,
            "filename": "opfunu-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "4c5ec7f3d19b2606bfaf2090c858db52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.7",
            "size": 12343973,
            "upload_time": "2024-06-04T16:43:37",
            "upload_time_iso_8601": "2024-06-04T16:43:37.074504Z",
            "url": "https://files.pythonhosted.org/packages/e0/58/85896b99b009be89825a672e2f108b4ee5cbc8d9c3f553fc9e6640ddb97a/opfunu-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-04 16:43:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thieu1995",
    "github_project": "opfunu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "opfunu"
}
        
Elapsed time: 0.55184s