Closed jjmaldonis closed 8 years ago
Make __lt__, __gt__, __eq__, etc functions for the Individual class.
__lt__
__gt__
__eq__
Individual
Implement like:
def __lt__(self, other): return self.total_fitness < other.total_fitness
or something similar.
This will allow Population to be sortable very easily.
Population
However, keep in mind that individuals can have a fitness of None, so we need to account for that somehow. We'd probably want to put all those individuals at the end of the sorted list.
None
Make
__lt__
,__gt__
,__eq__
, etc functions for theIndividual
class.Implement like:
or something similar.
This will allow
Population
to be sortable very easily.However, keep in mind that individuals can have a fitness of
None
, so we need to account for that somehow. We'd probably want to put all those individuals at the end of the sorted list.