Skip to content

Commit

Permalink
ParallelEvaluator: multi-objective tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Aug 27, 2018
1 parent 59879a6 commit 7e09cb5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test_evaluator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ end
using Distributed

evaluator_tests(() -> BlackBoxOptim.ParallelEvaluator(p, pids=workers()))

@testset "multi-objective problem" begin
schaffer1(x) = (sum(abs2, x), sum(xx -> abs2(xx - 2.0), x))
p = BlackBoxOptim.FunctionBasedProblem(schaffer1, "Schaffer1", ParetoFitnessScheme{2}(is_minimizing=true),
symmetric_search_space(5, (-10.0, 10.0)))
a = EpsBoxArchive(EpsBoxDominanceFitnessScheme(fitness_scheme(p)), max_size=100)

e = BlackBoxOptim.ParallelEvaluator(p, a, pids=workers())
fit1 = fitness([0.0, 1.0, 2.0, 3.0, 4.0], e)
@test BlackBoxOptim.num_evals(e) == 1
@test BlackBoxOptim.last_fitness(e) == fit1.orig

fit2 = fitness([0.0, -1.0, -2.0, -3.0, -4.0], e)
@test BlackBoxOptim.num_evals(e) == 2
@test BlackBoxOptim.last_fitness(e) == fit2.orig

BlackBoxOptim.shutdown!(e)
end
end

end

0 comments on commit 7e09cb5

Please sign in to comment.