Skip to content

Commit

Permalink
små oppdateringer
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiancarlenius committed Sep 19, 2024
1 parent 3ca5cc7 commit 96a9f18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def add_node_mutation(self, connection:'ConnectionGene', node_id: int, global_in
node1.add_node_connection(new_node.id)
new_node.add_node_connection(node1.id)
new_node.add_node_connection(node2.id)
new_node.add_connection_connection(connection2)
node1.add_connection_connection(connection1)


def add_connection_mutation(self, node1: 'Node', node2: 'Node', global_innovation_number: int):
Expand All @@ -67,7 +69,7 @@ def add_connection_mutation(self, node1: 'Node', node2: 'Node', global_innovatio
self.add_connection(connection)
node2.add_node_connection(node1.id)
node1.add_node_connection(node2.id)
node1.add_connection(connection)
node1.add_connection_connection(connection)
return True
else:
return False
Expand Down Expand Up @@ -126,7 +128,7 @@ def update_value(self, value: float):
def add_node_connection(self, node:'Node'):
self.connected_nodes.append(node)

def add_connection(self, connection: 'ConnectionGene'):
def add_connection_connection(self, connection: 'ConnectionGene'):
self.connections_to_output.append(connection)

def __repr__(self):
Expand Down
3 changes: 1 addition & 2 deletions src/traverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def traverse(self) -> None:
all its incoming connections traversed before it.
"""
order_of_traversal = self.kahns_algorithm()
print(order_of_traversal)
# print(order_of_traversal)
if not order_of_traversal:
return None
for node in order_of_traversal:
Expand Down Expand Up @@ -95,7 +95,6 @@ def update_out_node_value(self, connection: 'nodes.ConnectionGene') -> None:
weighted_input = self.calculate_weighted_input(connection)
connection.out_node.value += weighted_input
connection.out_node.value = self.activation_function(connection.out_node.value)
print(connection.out_node.value)



Expand Down

0 comments on commit 96a9f18

Please sign in to comment.