@@ -68,8 +68,7 @@ function DE(;
68
68
)
69
69
70
70
71
- parameters =
72
- DE (N, promote (F, CR, CR_min, CR_max, F_min, F_max)... , strategy)
71
+ parameters = DE (N, promote (F, CR, CR_min, CR_max, F_min, F_max)... , strategy)
73
72
74
73
Algorithm (parameters; kargs... )
75
74
@@ -85,21 +84,15 @@ function update_state!(
85
84
args... ;
86
85
kargs...
87
86
)
88
- population = status. population
89
-
90
- F = parameters. F
91
- CR = parameters. CR
92
87
93
88
94
- rng = options. rng
95
89
# stepsize
96
90
if parameters. F_min < parameters. F_max
97
- F = parameters. F_min + (parameters. F_max - parameters. F_min) * rand (rng)
91
+ parameters . F = parameters. F_min + (parameters. F_max - parameters. F_min) * rand (options . rng)
98
92
end
99
93
100
94
if parameters. CR_min < parameters. CR_max
101
- CR =
102
- parameters. CR_min + (parameters. CR_max - parameters. CR_min) * rand (rng)
95
+ parameters. CR = parameters. CR_min + (parameters. CR_max - parameters. CR_min) * rand (options. rng)
103
96
end
104
97
105
98
new_vectors = reproduction (status, parameters, problem)
@@ -192,25 +185,25 @@ end
192
185
193
186
194
187
function reproduction (status, parameters:: AbstractDifferentialEvolution , problem)
195
- @assert ! isempty (status. population)
188
+ population = status. population
189
+ @assert ! isempty (population)
196
190
197
191
N = parameters. N
198
- D = length (get_position (status . population[1 ]))
192
+ D = length (get_position (population[1 ]))
199
193
200
194
strategy = parameters. strategy
201
195
xBest = get_position (status. best_sol)
202
- population = status. population
203
196
F = parameters. F
204
197
CR = parameters. CR
205
198
206
- X = zeros (eltype (xBest), N,D)
199
+ X = zeros (eltype (xBest), N, D)
207
200
208
201
for i in 1 : N
209
202
x = get_position (population[i])
210
203
u = DE_mutation (population, F, strategy, 1 )
211
204
v = DE_crossover (x, u, CR)
212
205
evo_boundary_repairer! (v, xBest, problem. search_space)
213
- X[i,:] = _fix_type (v, problem. search_space)
206
+ X[i,:] . = _fix_type (v, problem. search_space)
214
207
end
215
208
216
209
X
0 commit comments