Skip to content

Commit

Permalink
remove enable_parallel_evaluators check
Browse files Browse the repository at this point in the history
since Julia 0.5 is mature
  • Loading branch information
alyst committed Aug 30, 2016
1 parent 1848419 commit 62b777c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 17 deletions.
8 changes: 0 additions & 8 deletions src/BlackBoxOptim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ module BlackBoxOptim
using Distributions, StatsBase, Compat
using Compat: String, view

# selectively enable parallel evaluation:
# - Julia v0.3: no RemoteChannel
# + Julia v0.4
# - Julia v0.5: incompatible changes in parallel API
enable_parallel_methods = VERSION >= v"0.4.0" && VERSION < v"0.5.0-"

export Optimizer, AskTellOptimizer, SteppingOptimizer, PopulationOptimizer,
bboptimize, bbsetup, compare_optimizers,

Expand Down Expand Up @@ -110,9 +104,7 @@ include("archives/epsbox_archive.jl")
include("genetic_operators/genetic_operator.jl")

include("evaluator.jl")
if enable_parallel_methods
include("parallel_evaluator.jl")
end

include("population.jl")
include("optimizer.jl")
Expand Down
6 changes: 1 addition & 5 deletions src/opt_controller.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ function make_evaluator(problem::OptimizationProblem, archive=nothing, params::P
archive = TopListArchive(fitness_scheme(problem), numdims(problem), archiveCapacity)
end
if length(workers) > 0
if BlackBoxOptim.enable_parallel_methods
return ParallelEvaluator(problem, archive, pids=workers)
else
throw(SystemError("Parallel evaluation disabled"))
end
return ParallelEvaluator(problem, archive, pids=workers)
else
return ProblemEvaluator(problem, archive)
end
Expand Down
2 changes: 0 additions & 2 deletions test/test_evaluator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ facts("Evaluator") do
@fact sortperm(candidates, by = fitness) --> collect(1:10)
end

if BlackBoxOptim.enable_parallel_methods
context("ParallelEvaluator") do
evaluator_tests(() -> BlackBoxOptim.ParallelEvaluator(p, pids=workers()))
end
end

end
2 changes: 0 additions & 2 deletions test/test_toplevel_bboptimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ facts("Top-level interface") do
@fact numdims(xpop) --> 2
end

if BlackBoxOptim.enable_parallel_methods
context("using population optimizer and parallel evaluator") do
opt = bbsetup(rosenbrock; Method=:adaptive_de_rand_1_bin,
SearchRange = (-5.0, 5.0), NumDimensions = 2,
MaxSteps = 2000, TraceMode = :silent, Workers=workers())
res = bboptimize(opt)
@fact isa(BlackBoxOptim.evaluator(lastrun(opt)), BlackBoxOptim.ParallelEvaluator) --> true
end
end

end

Expand Down

0 comments on commit 62b777c

Please sign in to comment.