Skip to main content
. 2020 Apr 30;20(9):2566. doi: 10.3390/s20092566
Algorithm 3 Pseudocode of the crossover operator.
function Crossover(Q,Pc)
  Q
  for all {x,y}Q do           ▹ all the individuals in Q, taken in pairs
   x=x
   y=y
   if rnd()<Pc then                    ▹ crossover probability
    prandInt(1,L)    ▹ crossing point p, L is the length of the solution vector
    for ip,L do                      ▹i goes from p to L
     if is_an_int_parameter(i)then        ▹ type of the i-th parameter
      x[i]=y[i]
      y[i]=x[i]
     else
      MrandInt(1,10)
      Δxx[i]/M
      Δyy[i]/M
      x[i]=x[i]+ΔyΔx
      y[i]=y[i]Δy+Δx
     end if
    end for
   end if
   QQ{x,y}
  end for
  return Q
end function