<p align="center">
<img width="200" src="https://raw.githubusercontent.com/firefly-cpp/FireflyAlgorithm/master/.github/imgs/firefly_logo.png">
</p>
<h1 align="center">
Firefly Algorithm --- Implementation of Firefly algorithm in Python
</h1>
<p align="center">
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/fireflyalgorithm.svg" href="https://pypi.python.org/pypi/fireflyalgorithm">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/fireflyalgorithm.svg">
<img alt="Downloads" src="https://img.shields.io/pypi/dm/fireflyalgorithm.svg">
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/firefly-cpp/FireflyAlgorithm">
<img alt="AUR package" src="https://img.shields.io/aur/version/python-fireflyalgorithm?color=blue&label=Arch%20Linux&logo=arch-linux" href="https://aur.archlinux.org/packages/python-fireflyalgorithm">
<img alt="GitHub license" src="https://img.shields.io/github/license/firefly-cpp/FireflyAlgorithm.svg" href="https://github.com/firefly-cpp/FireflyAlgorithm/blob/master/LICENSE">
<img alt="build" src="https://github.com/firefly-cpp/FireflyAlgorithm/actions/workflows/test.yml/badge.svg">
</p>
<p align="center">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/w/firefly-cpp/FireflyAlgorithm.svg">
<img alt="Average time to resolve an issue" src="http://isitmaintained.com/badge/resolution/firefly-cpp/FireflyAlgorithm.svg" href="http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm">
<img alt="Percentage of issues still open" src="http://isitmaintained.com/badge/open/firefly-cpp/FireflyAlgorithm.svg" href="http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/firefly-cpp/FireflyAlgorithm.svg">
<img alt="Packaging status" src="https://repology.org/badge/tiny-repos/python:fireflyalgorithm.svg" href="https://repology.org/project/python:fireflyalgorithm/versions">
</p>
<p align="center">
<img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.10430919.svg" href="https://doi.org/10.5281/zenodo.10430919">
</p>
<p align="center">
<a href="#-about">π About</a> β’
<a href="#-installation">π¦ Installation</a> β’
<a href="#-usage">π Usage</a> β’
<a href="#-reference-papers">π Reference Papers</a> β’
<a href="#-cite-us">π Cite us</a> β’
<a href="#-license">π License</a>
</p>
## π About
This package implements a nature-inspired algorithm for optimization called Firefly Algorithm (FA) in Python programming language. πΏππ»
## π¦ Installation
To install FireflyAlgorithm with pip, use:
```sh
pip install fireflyalgorithm
```
To install FireflyAlgorithm on Fedora, use:
```sh
dnf install python-fireflyalgorithm
```
To install FireflyAlgorithm on Arch Linux, please use an [AUR helper](https://wiki.archlinux.org/title/AUR_helpers):
```sh
$ yay -Syyu python-fireflyalgorithm
```
To install FireflyAlgorithm on Alpine Linux, use:
```sh
$ apk add py3-fireflyalgorithm
```
## π Usage
```python
from fireflyalgorithm import FireflyAlgorithm
from fireflyalgorithm.problems import sphere
FA = FireflyAlgorithm()
best = FA.run(function=sphere, dim=10, lb=-5, ub=5, max_evals=10000)
print(best)
```
### Test functions π
In the `fireflyalgorithm.problems` module, you can find the implementations of 33 popular optimization test problems. Additionally, the module provides a utility function, `get_problem`, that allows you to retrieve a specific optimization problem function by providing its name as a string:
```python
from fireflyalgorithm.problems import get_problem
# same as from fireflyalgorithm.problems import rosenbrock
rosenbrock = get_problem('rosenbrock')
```
For more information about the implemented test functions, [click here](Problems.md).
### Command line interface π₯οΈ
The package also comes with a simple command line interface which allows you to evaluate the algorithm on several popular test functions. π¬
```shell
firefly-algorithm -h
```
```text
usage: firefly-algorithm [-h] --problem PROBLEM -d DIMENSION -l LOWER -u UPPER -nfes MAX_EVALS [-r RUNS] [--pop-size POP_SIZE] [--alpha ALPHA] [--beta-min BETA_MIN] [--gamma GAMMA] [--seed SEED]
Evaluate the Firefly Algorithm on one or more test functions
options:
-h, --help show this help message and exit
--problem PROBLEM Test problem to evaluate
-d DIMENSION, --dimension DIMENSION
Dimension of the problem
-l LOWER, --lower LOWER
Lower bounds of the problem
-u UPPER, --upper UPPER
Upper bounds of the problem
-nfes MAX_EVALS, --max-evals MAX_EVALS
Max number of fitness function evaluations
-r RUNS, --runs RUNS Number of runs of the algorithm
--pop-size POP_SIZE Population size
--alpha ALPHA Randomness strength
--beta-min BETA_MIN Attractiveness constant
--gamma GAMMA Absorption coefficient
--seed SEED Seed for the random number generator
```
**Note:** The CLI script can also run as a python module (python -m fireflyalgorithm ...).
## π Reference Papers
I. Fister Jr., X.-S. Yang, I. Fister, J. Brest, D. Fister. [A Brief Review of Nature-Inspired Algorithms for Optimization](http://www.iztok-jr-fister.eu/static/publications/21.pdf). ElektrotehniΕ‘ki vestnik, 80(3), 116-122, 2013.
I. Fister Jr., X.-S. Yang, I. Fister, J. Brest. [Memetic firefly algorithm for combinatorial optimization](http://www.iztok-jr-fister.eu/static/publications/44.pdf) in Bioinspired Optimization Methods and their Applications (BIOMA 2012), B. Filipic and J.Silc, Eds.
Jozef Stefan Institute, Ljubljana, Slovenia, 2012
I. Fister, I. Fister Jr., X.-S. Yang, J. Brest. [A comprehensive review of firefly algorithms](http://www.iztok-jr-fister.eu/static/publications/23.pdf). Swarm and Evolutionary Computation 13 (2013): 34-46.
## π Cite us
Fister Jr., I., PeΔnik, L., & Stupan, Ε½. (2023). firefly-cpp/FireflyAlgorithm: 0.4.3 (0.4.3). Zenodo. [https://doi.org/10.5281/zenodo.10430919](https://doi.org/10.5281/zenodo.10430919)
## π License
This package is distributed under the MIT License. This license can be found online at <http://www.opensource.org/licenses/MIT>.
## Disclaimer
This framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!
Raw data
{
"_id": null,
"home_page": "https://github.com/firefly-cpp/FireflyAlgorithm",
"name": "fireflyalgorithm",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.9",
"maintainer_email": null,
"keywords": "computational intelligence, firefly algorithm, swarm intelligence, optimization",
"author": "Iztok Fister Jr.",
"author_email": "iztok@iztok-jr-fister.eu",
"download_url": "https://files.pythonhosted.org/packages/94/5f/4a768db4574cb6a12e793dd7d2a73a6263617b52bc3722ad471f59e628ea/fireflyalgorithm-0.4.5.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img width=\"200\" src=\"https://raw.githubusercontent.com/firefly-cpp/FireflyAlgorithm/master/.github/imgs/firefly_logo.png\">\n</p>\n\n<h1 align=\"center\">\nFirefly Algorithm --- Implementation of Firefly algorithm in Python\n</h1>\n\n<p align=\"center\">\n <img alt=\"PyPI Version\" src=\"https://img.shields.io/pypi/v/fireflyalgorithm.svg\" href=\"https://pypi.python.org/pypi/fireflyalgorithm\">\n <img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/fireflyalgorithm.svg\">\n <img alt=\"Downloads\" src=\"https://img.shields.io/pypi/dm/fireflyalgorithm.svg\">\n <img alt=\"GitHub repo size\" src=\"https://img.shields.io/github/repo-size/firefly-cpp/FireflyAlgorithm\">\n <img alt=\"AUR package\" src=\"https://img.shields.io/aur/version/python-fireflyalgorithm?color=blue&label=Arch%20Linux&logo=arch-linux\" href=\"https://aur.archlinux.org/packages/python-fireflyalgorithm\">\n <img alt=\"GitHub license\" src=\"https://img.shields.io/github/license/firefly-cpp/FireflyAlgorithm.svg\" href=\"https://github.com/firefly-cpp/FireflyAlgorithm/blob/master/LICENSE\"> \n <img alt=\"build\" src=\"https://github.com/firefly-cpp/FireflyAlgorithm/actions/workflows/test.yml/badge.svg\">\n</p>\n\n<p align=\"center\">\n <img alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/w/firefly-cpp/FireflyAlgorithm.svg\">\n <img alt=\"Average time to resolve an issue\" src=\"http://isitmaintained.com/badge/resolution/firefly-cpp/FireflyAlgorithm.svg\" href=\"http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm\">\n <img alt=\"Percentage of issues still open\" src=\"http://isitmaintained.com/badge/open/firefly-cpp/FireflyAlgorithm.svg\" href=\"http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm\">\n <img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/firefly-cpp/FireflyAlgorithm.svg\">\n <img alt=\"Packaging status\" src=\"https://repology.org/badge/tiny-repos/python:fireflyalgorithm.svg\" href=\"https://repology.org/project/python:fireflyalgorithm/versions\">\n</p>\n\n<p align=\"center\">\n <img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.10430919.svg\" href=\"https://doi.org/10.5281/zenodo.10430919\">\n</p>\n\n<p align=\"center\">\n <a href=\"#-about\">\ud83d\udccb About</a> \u2022\n <a href=\"#-installation\">\ud83d\udce6 Installation</a> \u2022\n <a href=\"#-usage\">\ud83d\ude80 Usage</a> \u2022\n <a href=\"#-reference-papers\">\ud83d\udcda Reference Papers</a> \u2022\n <a href=\"#-cite-us\">\ud83d\udcc4 Cite us</a> \u2022\n <a href=\"#-license\">\ud83d\udd11 License</a>\n</p>\n\n## \ud83d\udccb About\n\nThis package implements a nature-inspired algorithm for optimization called Firefly Algorithm (FA) in Python programming language. \ud83c\udf3f\ud83d\udd0d\ud83d\udcbb\n\n## \ud83d\udce6 Installation\n\nTo install FireflyAlgorithm with pip, use:\n```sh\npip install fireflyalgorithm\n```\nTo install FireflyAlgorithm on Fedora, use:\n```sh\ndnf install python-fireflyalgorithm\n```\nTo install FireflyAlgorithm on Arch Linux, please use an [AUR helper](https://wiki.archlinux.org/title/AUR_helpers):\n```sh\n$ yay -Syyu python-fireflyalgorithm\n```\nTo install FireflyAlgorithm on Alpine Linux, use:\n```sh\n$ apk add py3-fireflyalgorithm\n```\n\n## \ud83d\ude80 Usage\n\n```python\nfrom fireflyalgorithm import FireflyAlgorithm\nfrom fireflyalgorithm.problems import sphere\n\nFA = FireflyAlgorithm()\nbest = FA.run(function=sphere, dim=10, lb=-5, ub=5, max_evals=10000)\n\nprint(best)\n```\n\n### Test functions \ud83d\udcc8\n\nIn the `fireflyalgorithm.problems` module, you can find the implementations of 33 popular optimization test problems. Additionally, the module provides a utility function, `get_problem`, that allows you to retrieve a specific optimization problem function by providing its name as a string:\n\n```python\nfrom fireflyalgorithm.problems import get_problem\n\n# same as from fireflyalgorithm.problems import rosenbrock\nrosenbrock = get_problem('rosenbrock')\n```\n\nFor more information about the implemented test functions, [click here](Problems.md).\n\n### Command line interface \ud83d\udda5\ufe0f\n\nThe package also comes with a simple command line interface which allows you to evaluate the algorithm on several popular test functions. \ud83d\udd2c\n\n```shell\nfirefly-algorithm -h\n```\n\n```text\nusage: firefly-algorithm [-h] --problem PROBLEM -d DIMENSION -l LOWER -u UPPER -nfes MAX_EVALS [-r RUNS] [--pop-size POP_SIZE] [--alpha ALPHA] [--beta-min BETA_MIN] [--gamma GAMMA] [--seed SEED]\n\nEvaluate the Firefly Algorithm on one or more test functions\n\noptions:\n -h, --help show this help message and exit\n --problem PROBLEM Test problem to evaluate\n -d DIMENSION, --dimension DIMENSION\n Dimension of the problem\n -l LOWER, --lower LOWER\n Lower bounds of the problem\n -u UPPER, --upper UPPER\n Upper bounds of the problem\n -nfes MAX_EVALS, --max-evals MAX_EVALS\n Max number of fitness function evaluations\n -r RUNS, --runs RUNS Number of runs of the algorithm\n --pop-size POP_SIZE Population size\n --alpha ALPHA Randomness strength\n --beta-min BETA_MIN Attractiveness constant\n --gamma GAMMA Absorption coefficient\n --seed SEED Seed for the random number generator\n```\n\n**Note:** The CLI script can also run as a python module (python -m fireflyalgorithm ...).\n\n\n## \ud83d\udcda Reference Papers\n\nI. Fister Jr., X.-S. Yang, I. Fister, J. Brest, D. Fister. [A Brief Review of Nature-Inspired Algorithms for Optimization](http://www.iztok-jr-fister.eu/static/publications/21.pdf). Elektrotehni\u0161ki vestnik, 80(3), 116-122, 2013.\n\nI. Fister Jr., X.-S. Yang, I. Fister, J. Brest. [Memetic firefly algorithm for combinatorial optimization](http://www.iztok-jr-fister.eu/static/publications/44.pdf) in Bioinspired Optimization Methods and their Applications (BIOMA 2012), B. Filipic and J.Silc, Eds.\nJozef Stefan Institute, Ljubljana, Slovenia, 2012\n\nI. Fister, I. Fister Jr., X.-S. Yang, J. Brest. [A comprehensive review of firefly algorithms](http://www.iztok-jr-fister.eu/static/publications/23.pdf). Swarm and Evolutionary Computation 13 (2013): 34-46.\n\n## \ud83d\udcc4 Cite us\n\nFister Jr., I., Pe\u010dnik, L., & Stupan, \u017d. (2023). firefly-cpp/FireflyAlgorithm: 0.4.3 (0.4.3). Zenodo. [https://doi.org/10.5281/zenodo.10430919](https://doi.org/10.5281/zenodo.10430919)\n\n## \ud83d\udd11 License\n\nThis package is distributed under the MIT License. This license can be found online at <http://www.opensource.org/licenses/MIT>.\n\n## Disclaimer\n\nThis framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Implementation of Firefly Algorithm in Python",
"version": "0.4.5",
"project_urls": {
"Homepage": "https://github.com/firefly-cpp/FireflyAlgorithm",
"Repository": "https://github.com/firefly-cpp/FireflyAlgorithm"
},
"split_keywords": [
"computational intelligence",
" firefly algorithm",
" swarm intelligence",
" optimization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef74671611987d702f43fbebe770706691eac48ba7fb90c9fd824f885f3b8b57",
"md5": "4d5090d907966b3ce19ef3563616d98d",
"sha256": "3473dd2fe30d9d4789a7c4eb78b09c528e2a87b4a9ca7af543c4f1ac00ac27c1"
},
"downloads": -1,
"filename": "fireflyalgorithm-0.4.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4d5090d907966b3ce19ef3563616d98d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 8663,
"upload_time": "2024-08-08T12:05:11",
"upload_time_iso_8601": "2024-08-08T12:05:11.161846Z",
"url": "https://files.pythonhosted.org/packages/ef/74/671611987d702f43fbebe770706691eac48ba7fb90c9fd824f885f3b8b57/fireflyalgorithm-0.4.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "945f4a768db4574cb6a12e793dd7d2a73a6263617b52bc3722ad471f59e628ea",
"md5": "df9f91c4b46c0e4d56ef30433a98b176",
"sha256": "f0175e8281d31790a586bba04c4e0bb91769bd03dae3de74a4bfefba6c05eddc"
},
"downloads": -1,
"filename": "fireflyalgorithm-0.4.5.tar.gz",
"has_sig": false,
"md5_digest": "df9f91c4b46c0e4d56ef30433a98b176",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 9488,
"upload_time": "2024-08-08T12:05:12",
"upload_time_iso_8601": "2024-08-08T12:05:12.355360Z",
"url": "https://files.pythonhosted.org/packages/94/5f/4a768db4574cb6a12e793dd7d2a73a6263617b52bc3722ad471f59e628ea/fireflyalgorithm-0.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-08 12:05:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "firefly-cpp",
"github_project": "FireflyAlgorithm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fireflyalgorithm"
}