Added gene comparison by gene value
This commit is contained in:
@ -3,9 +3,13 @@ from copy import deepcopy
|
|||||||
class Gene:
|
class Gene:
|
||||||
|
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
"""Initialize a gene with fitness of value None and the input value"""
|
"""Initialize a gene with fitness of value None and the input value."""
|
||||||
self.value = deepcopy(value)
|
self.value = deepcopy(value)
|
||||||
self.fitness = None
|
|
||||||
|
|
||||||
|
def __eq__(self, gene):
|
||||||
|
"""Comparing two genes by their value."""
|
||||||
|
return self.value == gene.value
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user