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 Sep 22, 2016
1 parent e3c5639 commit b7b714d
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) = (sumabs2(x), sumabs2(x .- 2.0))
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 b7b714d

Please sign in to comment.