diff --git a/test/test_evaluator.jl b/test/test_evaluator.jl index ae28a5ae..c925c898 100644 --- a/test/test_evaluator.jl +++ b/test/test_evaluator.jl @@ -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