generic-github-user / Caesium

General-purpose AI library with NEAT-style genetic algorithm.
https://generic-github-user.github.io/Caesium/src/versions/javascript/projects/network-visualization/
MIT License
1 stars 1 forks source link

Update function not working #92

Closed generic-github-user closed 5 years ago

generic-github-user commented 5 years ago

Node IDs match.

generic-github-user commented 5 years ago

Cloned networks have the same node IDs.

93

generic-github-user commented 5 years ago

The cloned network connection source and destination properties do not reference nodes from the same network.

generic-github-user commented 5 years ago

These nodes the connections reference and the nodes stored in the network node list may get separated during the cloning process.

generic-github-user commented 5 years ago

Is it too late for an immutable data structure?

generic-github-user commented 5 years ago

The references to the node objects are being divided when JSON.stringify() is used.

generic-github-user commented 5 years ago

We could still use the network constructor to create new clean copies of networks, then fill in their values . . .

generic-github-user commented 5 years ago

Matching the connection source and destinations up to the correct nodes would be extremely painful.

generic-github-user commented 5 years ago

Unfortunately, I think that most cloning methods (including deep cloning) will cause this issue - they aren't meant for complex objects with internal references.

generic-github-user commented 5 years ago

If there were no references, node IDs could be used to store which nodes are connected to which other nodes without storing references to the node object itself in the connections . . . this would probably run somewhat slower, though - and each network's nodes would have to have a different set of UUIDs.

generic-github-user commented 5 years ago

Everything works now, yay.