Skip to content

Commit

Permalink
Reduced the change detection precision to account for float imprecision
Browse files Browse the repository at this point in the history
--HG--
branch : dev
  • Loading branch information
fmder committed Aug 28, 2012
1 parent 895b6b7 commit 4663337
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/de/de_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def main(verbose=True):
while mpb.nevals < 5e5:
# Detect a change and invalidate fitnesses if necessary
bests = [toolbox.best(subpop)[0] for subpop in populations]
if any(b.fitness.values != toolbox.evaluate(b) for b in bests):
if any(abs(b.fitness.values - toolbox.evaluate(b)) > 1e-12 for b in bests):
for individual in itertools.chain(*populations):
del individual.fitness.values

Expand Down

0 comments on commit 4663337

Please sign in to comment.