Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1015 Bytes

File metadata and controls

37 lines (25 loc) · 1015 Bytes

Firefly Algorithm in Python

INSTALLATION:

pip install FireflyAlgorithm

To install FireflyAlgorithm on Fedora, use:

$ dnf install python-FireflyAlgorithm

CODE EXAMPLE:

from FireflyAlgorithm import *


def Fun(D, sol):
    val = 0.0
    for i in range(D):
        val = val + sol[i] * sol[i]
    return val


Algorithm = FireflyAlgorithm(10, 20, 10000, 0.5, 0.2, 1.0, -2.0, 2.0, Fun)
Best = Algorithm.Run()

print Best

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.