Skip to main content
. 2021 Oct 20;189:116063. doi: 10.1016/j.eswa.2021.116063
Algorithm 2: The proposed BPINF algorithm for implementing FLAT
1: Input SeqA and SeqB; initialize the parameters: t, T, Inf_Rate, Spreed_Rate, Recovery_Rate
2: Initialize the population (X) with (N) search agents, each (xi), i(1,N), locates two positions one in SeqA and the other in SeqB such that xi (Length (SeqA or SeqB) - LF)
3: Cut two fragments starting from the positions of (xi) in the two sequences (SeqA and
SeqB)
4: Apply SW algorithm on each pair of fragments of each search agent (xi), i(1,N).
5: Compute the alignment score (length of near-exact LCCS found) for each search agent based on Eq. (1).
6: While (tT)
7: Update the first (α) and second (β) best solutions from the population (X) based on the alignment score.
8: If (t12T)
9: Update each solution (xi) based on BA's operator using Eqs. (2) - (6).
10: Else
11: Check the infection conditions for each solution (xi):
12: IF ((α-D)<xi<(α+D))
13:  Infection (i) = 1
14: Else IF (rand () > Inf_Rate)
15:  Infection (i) = 1
16: Else
17:  Infection (i) = 0
18: End IF
19: Fori=1:N
20: IF Infection (i) = 1
21:  Update the solution (xi) toward (α) based on Eqs. (11) - (12).
22: Forp=1:3(propagate the infection through three agents)
23:  Select randomly one solution (xj) , j(1:N)
24:  IF (rand () > Spread_Rate):
25:   Update the solution (xj) toward (xi) according to Eqs. (13) - (14).
26:   Infection (j) = 1
27:  End IF
28:  IF (rand () > Recovery_Rate): Infection (j) = 0 End IF
30: End For
31: IF (rand () > Recovery_Rate): Infection (i) = 0 End IF
32: Else
33: Update the solution (xi) toward (β) based on Eq. (15) - (16)
34: End IF
35: End For
36: End IF
37: Cut two fragments starting from the positions of (xi) in the two sequences (SeqA and SeqB)
Compute the alignment score for the search agents based on Eq. (1).
38: t=t+1;
39: End While
40: Output the near-exact LCCS pointed by the first best solution (α) and its length.