Skip to main content
. 2024 Nov 1;9(11):664. doi: 10.3390/biomimetics9110664
Algorithm 2: Level-based learning and knowledge transfer
  Input: the source task particle swarm Ps, the target task particle swarm Pt, number of levels L, random mating probability rmp, level size LS, control parameter ϕ.
  /* Initialization */
  1. OP = {}

  2. For i = {L, …, 2} do

  3. For j = {1, …, LS} do

  4. xnew = xi,j;

  5. vnew = vi,j;

  6. If i ! = 1 then

  7. Select two level from top (i−1) levels: l1, l2;

  8. Else

  9. l1 = l2 = 1;

  10. End If

  11. If l1 > l2 then

  12. Swap (l1, l2);

  13. End If

  14. If rand < rmp then

  15. Select two particles from l1, l2 respectively in Pt: xl1, xl2;

  16. Else

  17. Select two particles from l1, l2 respectively in Ps: xl1, xl2;

  18. End If

  19. Update vnew and xnew according to Equations (3) and (4);

  20. particlenew = {vnew, xnew,};

  21. OP = OPparticlenew;

  Output: OP