fireflyalgorithm


Namefireflyalgorithm JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttps://github.com/firefly-cpp/FireflyAlgorithm
SummaryImplementation of Firefly Algorithm in Python
upload_time2023-12-25 15:47:53
maintainer
docs_urlNone
authorIztok Fister Jr.
requires_python>=3.9,<3.13
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img width="200" src="https://raw.githubusercontent.com/firefly-cpp/FireflyAlgorithm/master/.github/imgs/firefly_logo.png">
</p>

---

# Firefly Algorithm --- Implementation of Firefly algorithm in Python

---

[![PyPI Version](https://img.shields.io/pypi/v/fireflyalgorithm.svg)](https://pypi.python.org/pypi/fireflyalgorithm)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fireflyalgorithm.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/fireflyalgorithm.svg)
[![Downloads](https://pepy.tech/badge/fireflyalgorithm)](https://pepy.tech/project/fireflyalgorithm)
[![AUR package](https://img.shields.io/aur/version/python-fireflyalgorithm?color=blue&label=Arch%20Linux&logo=arch-linux)](https://aur.archlinux.org/packages/python-fireflyalgorithm)
[![GitHub license](https://img.shields.io/github/license/firefly-cpp/FireflyAlgorithm.svg)](https://github.com/firefly-cpp/FireflyAlgorithm/blob/master/LICENSE)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/firefly-cpp/FireflyAlgorithm.svg)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/firefly-cpp/FireflyAlgorithm.svg)](http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/firefly-cpp/FireflyAlgorithm.svg)](http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm "Percentage of issues still open")
![GitHub contributors](https://img.shields.io/github/contributors/firefly-cpp/FireflyAlgorithm.svg)
[![Packaging status](https://repology.org/badge/tiny-repos/python:fireflyalgorithm.svg)](https://repology.org/project/python:fireflyalgorithm/versions)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10430919.svg)](https://doi.org/10.5281/zenodo.10430919)

## About πŸ“‹

This package implements a nature-inspired algorithm for optimization called Firefly Algorithm (FA) in Python programming language. πŸŒΏπŸ”πŸ’»

## Installation πŸ“¦

Install FireflyAlgorithm with pip:
```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:
```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. [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.

## 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": "",
    "docs_url": null,
    "requires_python": ">=3.9,<3.13",
    "maintainer_email": "",
    "keywords": "",
    "author": "Iztok Fister Jr.",
    "author_email": "iztok@iztok-jr-fister.eu",
    "download_url": "https://files.pythonhosted.org/packages/13/9a/8113ea19da6bf20d3c30ebe4476c567daf4985050fe4d22cc793f1683ea3/fireflyalgorithm-0.4.4.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---\n\n# Firefly Algorithm --- Implementation of Firefly algorithm in Python\n\n---\n\n[![PyPI Version](https://img.shields.io/pypi/v/fireflyalgorithm.svg)](https://pypi.python.org/pypi/fireflyalgorithm)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fireflyalgorithm.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/fireflyalgorithm.svg)\n[![Downloads](https://pepy.tech/badge/fireflyalgorithm)](https://pepy.tech/project/fireflyalgorithm)\n[![AUR package](https://img.shields.io/aur/version/python-fireflyalgorithm?color=blue&label=Arch%20Linux&logo=arch-linux)](https://aur.archlinux.org/packages/python-fireflyalgorithm)\n[![GitHub license](https://img.shields.io/github/license/firefly-cpp/FireflyAlgorithm.svg)](https://github.com/firefly-cpp/FireflyAlgorithm/blob/master/LICENSE)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/w/firefly-cpp/FireflyAlgorithm.svg)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/firefly-cpp/FireflyAlgorithm.svg)](http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/firefly-cpp/FireflyAlgorithm.svg)](http://isitmaintained.com/project/firefly-cpp/FireflyAlgorithm \"Percentage of issues still open\")\n![GitHub contributors](https://img.shields.io/github/contributors/firefly-cpp/FireflyAlgorithm.svg)\n[![Packaging status](https://repology.org/badge/tiny-repos/python:fireflyalgorithm.svg)](https://repology.org/project/python:fireflyalgorithm/versions)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10430919.svg)](https://doi.org/10.5281/zenodo.10430919)\n\n## About \ud83d\udccb\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## Installation \ud83d\udce6\n\nInstall FireflyAlgorithm with pip:\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:\n```sh\n$ apk add py3-fireflyalgorithm\n```\n\n## Usage \ud83d\ude80\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## Reference Papers \ud83d\udcda\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## 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.4",
    "project_urls": {
        "Homepage": "https://github.com/firefly-cpp/FireflyAlgorithm",
        "Repository": "https://github.com/firefly-cpp/FireflyAlgorithm"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8661bc3b5531b36989a5b3816a4a073e84f31f58618bc6e1e1522b0f2f5432d8",
                "md5": "5897c5a05281b9e7027e78963fc3c062",
                "sha256": "ffb0a0550e21062bac115816c861755874a40ab9b0f4b467e2f112486b1b2dc3"
            },
            "downloads": -1,
            "filename": "fireflyalgorithm-0.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5897c5a05281b9e7027e78963fc3c062",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<3.13",
            "size": 8342,
            "upload_time": "2023-12-25T15:47:51",
            "upload_time_iso_8601": "2023-12-25T15:47:51.462152Z",
            "url": "https://files.pythonhosted.org/packages/86/61/bc3b5531b36989a5b3816a4a073e84f31f58618bc6e1e1522b0f2f5432d8/fireflyalgorithm-0.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "139a8113ea19da6bf20d3c30ebe4476c567daf4985050fe4d22cc793f1683ea3",
                "md5": "4c30f645b26144e5acfa4385bad8f119",
                "sha256": "e4a596582b6b62d2eb959723caa6722970997f3b330cfd248ca2d777248c6520"
            },
            "downloads": -1,
            "filename": "fireflyalgorithm-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "4c30f645b26144e5acfa4385bad8f119",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<3.13",
            "size": 9070,
            "upload_time": "2023-12-25T15:47:53",
            "upload_time_iso_8601": "2023-12-25T15:47:53.574425Z",
            "url": "https://files.pythonhosted.org/packages/13/9a/8113ea19da6bf20d3c30ebe4476c567daf4985050fe4d22cc793f1683ea3/fireflyalgorithm-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-25 15:47:53",
    "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"
}
        
Elapsed time: 0.19137s