Skip to content

Commit

Permalink
Bug fix: IntegerAttribute min/max values should have been ints not fl…
Browse files Browse the repository at this point in the history
…oats.
  • Loading branch information
CodeReclaimers committed May 4, 2022
1 parent 5590604 commit af3b25b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions neat/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class BaseAttribute(object):

def __init__(self, name, **default_dict):
self.name = name
# TODO: implement a mechanism that allows us to detect and report unused configuration items.
for n, default in default_dict.items():
self._config_items[n] = [self._config_items[n][0], default]
for n in self._config_items:
Expand All @@ -27,7 +28,7 @@ def get_config_params(self):

class FloatAttribute(BaseAttribute):
"""
Class for numeric attributes,
Class for floating-point numeric attributes,
such as the response of a node or the weight of a connection.
"""
_config_items = {"init_mean": [float, None],
Expand Down Expand Up @@ -87,14 +88,13 @@ def validate(self, config):

class IntegerAttribute(BaseAttribute):
"""
Class for numeric attributes,
such as the response of a node or the weight of a connection.
Class for integer numeric attributes.
"""
_config_items = {"replace_rate": [float, None],
"mutate_rate": [float, None],
"mutate_power": [float, None],
"max_value": [float, None],
"min_value": [float, None]}
"max_value": [int, None],
"min_value": [int, None]}

def clamp(self, value, config):
min_value = getattr(config, self.min_value_name)
Expand Down

0 comments on commit af3b25b

Please sign in to comment.