Skip to content

Commit 7e09cb5

Browse files
committed
ParallelEvaluator: multi-objective tests
1 parent 59879a6 commit 7e09cb5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/test_evaluator.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ end
7979
using Distributed
8080

8181
evaluator_tests(() -> BlackBoxOptim.ParallelEvaluator(p, pids=workers()))
82+
83+
@testset "multi-objective problem" begin
84+
schaffer1(x) = (sum(abs2, x), sum(xx -> abs2(xx - 2.0), x))
85+
p = BlackBoxOptim.FunctionBasedProblem(schaffer1, "Schaffer1", ParetoFitnessScheme{2}(is_minimizing=true),
86+
symmetric_search_space(5, (-10.0, 10.0)))
87+
a = EpsBoxArchive(EpsBoxDominanceFitnessScheme(fitness_scheme(p)), max_size=100)
88+
89+
e = BlackBoxOptim.ParallelEvaluator(p, a, pids=workers())
90+
fit1 = fitness([0.0, 1.0, 2.0, 3.0, 4.0], e)
91+
@test BlackBoxOptim.num_evals(e) == 1
92+
@test BlackBoxOptim.last_fitness(e) == fit1.orig
93+
94+
fit2 = fitness([0.0, -1.0, -2.0, -3.0, -4.0], e)
95+
@test BlackBoxOptim.num_evals(e) == 2
96+
@test BlackBoxOptim.last_fitness(e) == fit2.orig
97+
98+
BlackBoxOptim.shutdown!(e)
99+
end
82100
end
83101

84102
end

0 commit comments

Comments
 (0)