Giter Site home page Giter Site logo

fireflyalgorithm's Introduction


Firefly Algorithm --- Implementation of Firefly algorithm in Python


PyPI Version PyPI - Python Version PyPI - Downloads Downloads GitHub repo size AUR package GitHub license GitHub commit activity Average time to resolve an issue Percentage of issues still open GitHub contributors Packaging status DOI

About πŸ“‹

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

Installation πŸ“¦

Install FireflyAlgorithm with pip:

pip install fireflyalgorithm

To install FireflyAlgorithm on Fedora, use:

dnf install python-fireflyalgorithm

To install FireflyAlgorithm on Arch Linux, please use an AUR helper:

$ yay -Syyu python-fireflyalgorithm

To install FireflyAlgorithm on Alpine Linux:

$ apk add py3-fireflyalgorithm

Usage πŸš€

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:

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.

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. πŸ”¬

firefly-algorithm -h
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 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. 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

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!

fireflyalgorithm's People

Contributors

carlosal1015 avatar firefly-cpp avatar lahovniktadej avatar lukapecnik avatar rhododendrom avatar zstupan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fireflyalgorithm's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.