/// <summary> /// Creates a new connection from this node to target node via a new link /// </summary> /// <param name="target">TWEANNNode to link to</param> /// <param name="weight">Synaptic weight between the nodes</param> /// <param name="innovation">Innovation number of new link</param> /// <param name="recurrent">Whether or not the link is recurrent</param> /// <param name="frozen">Whether or not the link can be changed</param> public void Connect(TWEANNNode target, float weight, long innovation, bool recurrent, bool frozen) { TWEANNLink link = new TWEANNLink(target, weight, innovation, recurrent, frozen); //Debug.Log("Adding link from " + GetInnovationID() + " to " + target.GetInnovationID()); outputs.Add(link); }
public TWEANNLink GetLinkToTargetNode(TWEANNNode targetNode) { TWEANNLink result = null; foreach (TWEANNLink link in outputs) { if (link.GetTarget() == targetNode) { result = link; } else { throw new System.ArgumentException("No link to node found!"); } } return(result); }