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 Nov 13, 2017
1 parent fe0d60b commit 96244aa
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 @@ -77,6 +77,24 @@ end

@testset "ParallelEvaluator" begin
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(convert(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 96244aa

Please sign in to comment.