Giter Site home page Giter Site logo

jonasgrebe / bees-bats-fireflies Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 3.0 290.88 MB

Implementation of three nature-inspired search algorithms: Bees Algorithm, Bat Algorithm, and Firefly Algorithm

Python 2.67% Jupyter Notebook 29.08% HTML 68.26%
metaheuristic-algorithms metaheuristic-optimisation bees-algorithm bat-algorithm firefly-algorithm python

bees-bats-fireflies's Introduction

Nature-inspired Metaheuristics: Bees, Bats, and Fireflies

Implementation of three nature-inspired search algorithms:

How to use the algorithms?

All three algorithms and their variants share a common interface. Basically, all one needs to do in order to use one of the algorithms for optimization, is invoking the search(objective, objective_fct, T) method. The parameters all algorithms have in common (algorithm-independent parameters) are the following:

parameter description domain
objective minimization or maximization problem 'min' or 'max'
objective_fct python function or lambda to optimize f: R^d -> R^1
d dimensionality of solution-space positive integer
n size of the population, i.e. related to amount of bees, bats and fireflies positive integer
range_min lower bound of solution-space in all dimensions real number
range_max upper bound of solution-space in all dimensions real number
T number of iterations positive integer

The Bees Algorithm

parameter description domain
nb number of best patches (smaller than or equal to n) positive integer
ne number of elite patches (smaller than or equal to nb positive integer
nrb number of recruited foragers per best patch (greater than 0) positive integer
nre number of recruited foragers per elite patch (greater than nrb) positive integer

Additional parameters for the Improved Bees Algorithm that includes neighborhood shrinking and site abandonment:

parameter description domain
sf factor for shrinking the patch size (0, 1]
sl stagnation limit positive integer

The Bat Algorithm

parameter description domain
a initial loudness of all bats positive float
r_max maximum pulse rate of bats positive float
alpha loudness decreasing factor (0, 1]
gamma pulse rate increasing factor (0, 1]
f_min minimum sampled frequency positive float
f_max maximum sampled frequency positive float

The Firefly Algorithm

parameter description domain
alpha neighbor sphere radius positive float
beta_max maximum attractivneness positive float
gamma attractiveness descreasing factor positive float

Example Notebooks

You can find exemplary applications of these three implemented metaheuristics in the following few notebooks:

  • notebook_function_test.ipynb: Simples minimization of benchmarking functions
  • notebook_mle_cauchy.ipynb: Maximum Likelihood Estimation for randomly generated cauchy-distributed samples
  • notebook_spring_design.ipynb: Spring weight minimization given some constraints
  • notebook_visualize.ipynb: Example on how to visualize the algorithms in the two-dimensional case
  • notebook_cluster.ipynb: Attempt to cluster iris data set and generated data set with the metaheuristics

bees-bats-fireflies's People

Contributors

jonasgrebe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bees-bats-fireflies's Issues

TypeError: 'numpy.float64' object is not callable

Hi there,

I tried your codes, however got the following errors:

72     def evaluation_count_decorator(self, f, x):
     73         self.evaluation_count += 1
---> 74         return f(x)
     75 
     76 

TypeError: 'numpy.float64' object is not callable

Could you pls guide me on this?

Many thanks,
Thang

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.