Hafta.
Hafta.
Firefly Algorithm
Gözde Alp
Content
• Firefly algorithm
• How to generate population for Firefly?
• How to computer light intensity value?
• How to update position for each Firefly?
• An application
• Preparing Weekly Lecture Schedule with the Firefly
Algorithm
• Cardiac Arrhythmia Diagnosis Using Firefly Algorithm
2
Firefly algorithm
• Firefly algorithm is a
swarm-based
metaheuristic algorithm
that was introduced by
Xin-She Yang.
• Firefly Algorithm is
inspired by the
FLASHING Behavior of
Fireflies.
3
Firefly algorithm
Assumptions:
• Fireflies are attracted to each other.
• Attractiveness is proportional to
BRIGHTNESS.
• Less Brighter Firefly is attracted to the
Brighter Firefly.
4
Firefly algorithm
Assumptions:
• Attractiveness decrease as the
distance between 2 fireflies increase.
• If brightness for both is the same,
fireflies move randomly.
• New Solutions are generated by
Random walks & the Attraction of
fireflies.
5
Firefly algorithm
Inspired Behaviour Corresponding Action in
Algorithm
1. Random locations of 1. Random population is
fireflies are determined and initialized each has
their brightness are particular number of
calculated. parameters.
2. Fireflies move to brighter 2. The light intensity and the
fireflies. position of fireflies are
updated.
3. The process is repeated 3. The process is repeated
during a period. until the maximum iteration
number.
6
Firefly Optimization
Algorithm Steps
1. Initialize Parameters.
2. Generate Population of n Fireflies.
3. Calculate Fitness Value for Each Firefly.
4. Check stopping criteria
if (CurrentIteration := 1 to MaximumIteration ).
1. Update Position and Light Intensity for Each Firefly.
2. Report the Best Solution.
7
Firefly Algorithm
8
Firefly Algorithm
9
Firefly Algorithm
10
Firefly Algorithm
11
Firefly Algorithm
• Light intensity for first 6 firefly
12
Firefly Algorithm
13
Firefly Algorithm
14
Firefly Algorithm
15
Firefly Algorithm
16
Firefly Algorithm
17
Firefly Algorithm
18
Firefly Algorithm
19
Firefly Algorithm
20
Firefly Algorithm
21
Firefly Algorithm
22
Firefly Algorithm
23
Firefly Algorithm
24
Firefly Algorithm
25
Firefly Algorithm
26
Firefly Algorithm
27
Firefly Algorithm
28
Firefly Algorithm
29
Firefly Algorithm
30
Firefly Algorithm
31
Firefly Algorithm
An Application
• Preparing Weekly Lecture
Schedule with the Firefly
Algorithm
• According to the table, 35
hours of lecture are prepared
for 5 days a week, with 7 hours
per day.
• Lectures and hours of a class:
32
Firefly Algorithm
Screenshots from the application
33
Firefly Algorithm
Screenshots from the application.
The best result is measured by the closeness of the teacher's occupied
hours to each other.
34
Firefly Algorithm
An Application
Cardiac Arrhythmia Diagnosis Using Firefly
Algorithm
• In this study, ECG arrhythmias are classified with
the K-Nearest Neighborhood (K-EYK) method
using Firefly Algorithm and Fuzzy C-Means
(FCM) algorithms for data clustering.
• The results of the Firefly algorithm were
compared with the success results of the Fuzzy
C-Mean algorithm.
• Using Firefly and Fuzzy C-Mean algorithms, the
classification accuracy rate was found to be
99.47% and 99.54%, respectively.
35
Firefly Algorithm
An Application
Cardiac Arrhythmia Diagnosis Using Firefly
Algorithm
• The electrical activity of the heart is called an
electrocardiogram (ECG).
• Automatic and automatic detection of
arrhythmias in an ECG recording computer-
based analysis system is still a subject of active
research work.
36
Firefly Algorithm
An Application
Cardiac Arrhythmia Diagnosis Using Firefly
Algorithm
• K-Nearest Neighbor algorithm is used for
classification.
37
Firefly Algorithm
An Application
38
References
• [1]https://codebypixy.blogspot.com/2021/08/firefly-
optimization-algorithm.html
• [2] https://www.youtube.com/watch?v=DbfXjuBrpg0
• [3] https://www.youtube.com/watch?v=QvpEMR-
Jp0U&list=PLVLAu9B7VtkaX0P_m7u8R1_eMqv6hLv0l&inde
x=78
• [4] Karaarslan, E., & Zengin, K. (2016). Ateş böceği
algoritması ile haftalık ders programı hazırlama. EEB 2016
Elektrik-Elektronik ve Bilgisayar Sempozyumu, 11-13.
• [5] KOÇYİĞİT, Y., & DİLMAÇ, S. (2018). Ateş Böceği
Algoritmasını Kullanarak Kardiyak Aritmi
Teşhisi. Kahramanmaraş Sütçü İmam Üniversitesi
Mühendislik Bilimleri Dergisi, 21(3), 226-234.
39