|
20 | 20 |
|
21 | 21 | # Testing: CMA-ES |
22 | 22 | opts = Evolutionary.Options(rng=rng) |
| 23 | + λ = 14 |
23 | 24 | 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))") |
26 | 27 | @test Evolutionary.converged(result) |
27 | 28 | @test Evolutionary.minimizer(result) ≈ zeros(N) atol=1e-4 |
28 | 29 | @test minimum(result) ≈ 0.0 atol=1e-5 |
29 | 30 |
|
30 | 31 | bounds = Evolutionary.ConstraintBounds(fill(-1.0f0,N),fill(1.0f0,N),[],[]) |
31 | 32 | opts = Evolutionary.Options(store_trace=true, iterations=10, rng=rng) |
32 | 33 | 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))") |
35 | 36 | @test Evolutionary.iterations(result) == 10 |
36 | 37 | @test !Evolutionary.converged(result) |
37 | 38 | @test haskey(Evolutionary.trace(result)[end].metadata, "σ") |
|
0 commit comments