Skip to content

Commit

Permalink
Corrected the number of peaks used.
Browse files Browse the repository at this point in the history
--HG--
branch : dev
  • Loading branch information
fmder committed Aug 28, 2012
1 parent 31a4e97 commit 895b6b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/de/de_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def brown_ind(iclass, best, sigma):
toolbox.register("evaluate", mpb)

def main(verbose=True):
NPOP = 20
NPOP = 10 # Should be equal to the number of peaks
CR = 0.6
F = 0.4
regular, brownian = 4, 2
Expand Down Expand Up @@ -133,6 +133,10 @@ def main(verbose=True):
# Apply Brownian to the last part of the population
newpop.extend(toolbox.brownian_individual(xbest) for _ in range(brownian))

# Evaluate the brownian individuals
for individual in newpop[-brownian:]:
individual.fitness.value = toolbox.evaluate(individual)

# Replace the population
populations[idx] = newpop

Expand Down

0 comments on commit 895b6b7

Please sign in to comment.