Skip to content

Commit

Permalink
Make solution tuple comparators py3 compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
the-code-magician committed Apr 1, 2015
1 parent 519d35f commit 304ca46
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cameo/strain_design/heuristic/archivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,32 @@ def __cmp__(self, other):
else:
return 1

def __lt__(self, other):
if self.fitness > other.fitness:
return True
elif self.fitness == other.fitness:
if self.improves(other):
return True
elif self == other:
return False
else:
return False
else:
return False

def __gt__(self, other):
if self.fitness > other.fitness:
return False
elif self.fitness == other.fitness:
if self.improves(other):
return False
elif self == other:
return False
else:
return True
else:
return True

def __str__(self):
return "%s - %s" % (list(self.candidate), self.fitness)

Expand Down

0 comments on commit 304ca46

Please sign in to comment.