Skip to content

Commit

Permalink
separate out definition of oneplus_populate
Browse files Browse the repository at this point in the history
  • Loading branch information
d9w committed Sep 5, 2020
1 parent 145857b commit c10bbe4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/oneplus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ function OnePlusEvo{T}(cfg::NamedTuple, fitness::Function;
OnePlusEvo(cfg, logger, population, fitness, 0)
end

evaluate(e::OnePlusEvo) = fitness_evaluate(e, e.fitness)

function populate(e::OnePlusEvo)
function oneplus_populate(e::OnePlusEvo)
p1 = max_selection(e.population)
e.population[1] = p1
for i in 2:e.config.n_population
e.population[i] = mutate(p1)
end
end

evaluate(e::OnePlusEvo) = fitness_evaluate(e, e.fitness)
populate(e::OnePlusEvo) = oneplus_populate(e)

0 comments on commit c10bbe4

Please sign in to comment.