Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support evaluate function return nan #738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ def __hash__(self):
return hash(self.wvalues)

def __gt__(self, other):
return not self.__le__(other)
return self.wvalues > other.wvalues

def __ge__(self, other):
return not self.__lt__(other)
return self.wvalues >= other.wvalues

def __le__(self, other):
return self.wvalues <= other.wvalues
Expand Down
4 changes: 3 additions & 1 deletion deap/tools/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,12 @@ def update(self, population):
update the hall of fame with.
"""
for ind in population:
if ind.fitness.values[0] != ind.fitness.values[0]:
continue
if len(self) == 0 and self.maxsize != 0:
# Working on an empty hall of fame is problematic for the
# "for else"
self.insert(population[0])
self.insert(ind)
continue
if ind.fitness > self[-1].fitness or len(self) < self.maxsize:
for hofer in self:
Expand Down