@@ -7,46 +7,23 @@ function ranklinear(sp::Float64)
77 @assert 1.0 <= sp <= 2.0 " Selective pressure has to be in range [1.0, 2.0]."
88 function rank (fitness:: Vector{Float64} , N:: Int )
99 λ = length (fitness)
10- <<<<<< < Updated upstream
1110 rank = sortperm (fitness)
1211
1312 prob = Vector {Float64} (undef, λ)
14- ====== =
15- idx = sortperm (fitness)
16-
17- ranks = Vector {Float64} (undef, λ)
18- >>>>>> > Stashed changes
1913 for i in 1 : λ
2014 prob[i] = ( 2.0 - sp + 2.0 * (sp - 1.0 )* (rank[i] - 1.0 ) / (λ - 1.0 ) ) / λ
2115 end
2216
23- <<<<<< < Updated upstream
2417 return pselection (prob, N)
25- ====== =
26- return pselection (ranks, N)
27- >>>>>> > Stashed changes
2818 end
2919 return rank
3020end
3121
32- # (μ, λ)-uniform ranking selection
33- function uniformranking (μ:: Int )
34- function uniformrank (fitness:: Vector{Float64} , N:: Int )
35- λ = length (fitness)
36- <<<<<< < Updated upstream
37- @assert μ < λ " μ should be less then $(λ) "
38-
39- prob = fill (1 / μ, μ)
40- return pselection (prob, N)
41- ====== =
42- @assert μ < λ " μ should equal $(λ) "
43-
44- ranks = fill (1 / μ, μ)
45-
46- return pselection (ranks, N)
47- >>>>>> > Stashed changes
48- end
49- return uniformrank
22+ # uniform ranking selection
23+ function rankuniform (fitness:: Vector{Float64} , N:: Int )
24+ μ = length (fitness)
25+ prob = fill (1 / μ, μ)
26+ return pselection (prob, N)
5027end
5128
5229# Roulette wheel (proportionate selection) selection
0 commit comments