Skip to content

Commit 96bf096

Browse files
committed
improved schwefel test
1 parent d06c713 commit 96bf096

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/schwefel.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@
2020

2121
# Testing: CMA-ES
2222
opts = Evolutionary.Options(rng=rng)
23+
λ = 14
2324
Random.seed!(rng, 42)
24-
result = Evolutionary.optimize(schwefel, ()->rand(rng, N), CMAES(mu = 3, lambda = 12, c_1=0.05), opts)
25-
println("(3/3,12)-CMA-ES => F: $(minimum(result)), C: $(Evolutionary.iterations(result))")
25+
result = Evolutionary.optimize(schwefel, ()->rand(rng, N), CMAES(lambda=λ, c_1=0.05), opts)
26+
println("($(λ>>1),)-CMA-ES => F: $(minimum(result)), C: $(Evolutionary.iterations(result))")
2627
@test Evolutionary.converged(result)
2728
@test Evolutionary.minimizer(result) zeros(N) atol=1e-4
2829
@test minimum(result) 0.0 atol=1e-5
2930

3031
bounds = Evolutionary.ConstraintBounds(fill(-1.0f0,N),fill(1.0f0,N),[],[])
3132
opts = Evolutionary.Options(store_trace=true, iterations=10, rng=rng)
3233
Random.seed!(rng, 42)
33-
result = Evolutionary.optimize(schwefel, bounds, CMAES(mu = 3, lambda = 12, weights=zeros(Float32,12)), opts)
34-
println("(3/3,12)-CMA-ES [bounds] => F: $(minimum(result)), C: $(Evolutionary.iterations(result))")
34+
result = Evolutionary.optimize(schwefel, bounds, CMAES(lambda=λ, weights=zeros(Float32,λ)), opts)
35+
println("($(λ>>1),)-CMA-ES [bounds] => F: $(minimum(result)), C: $(Evolutionary.iterations(result))")
3536
@test Evolutionary.iterations(result) == 10
3637
@test !Evolutionary.converged(result)
3738
@test haskey(Evolutionary.trace(result)[end].metadata, "σ")

0 commit comments

Comments
 (0)