public static void MakeConnection(Group sourceGroup, Group destinationGroup, float weight, int delay, ConnectionPatternDelegate connectionPattern, ILearningRule learningRule) { for (int i = 0; i < sourceGroup.Count; i++) { for (int j = 0; j < destinationGroup.Count; j++) { if (connectionPattern(i, j)) { Synapse syn = new Synapse(sourceGroup[i], destinationGroup[j], weight, delay, learningRule.GetCopy()); sourceGroup[i].AddPostSynapse(syn); destinationGroup[j].AddPreSynapse(syn); } } } }
public static void MakeSharedConnection(Group sourceGroup, Group destinationGroup, ConnectionPatternDelegate connectionPattern, List <SynapseCore> synapseCores) { int coreIdx = 0; for (int i = 0; i < destinationGroup.Count; i++) { for (int j = 0; j < sourceGroup.Count; j++) { if (connectionPattern(j, i)) { Synapse syn = new Synapse(sourceGroup[j], destinationGroup[i], synapseCores[coreIdx]); sourceGroup[j].AddPostSynapse(syn); destinationGroup[i].AddPreSynapse(syn); coreIdx++; } } } }
public static void MakeRandomValueConnection(Group sourceGroup, Group destinationGroup, float minWeight, float maxWeight, int minDelay, int maxDelay, ConnectionPatternDelegate connectionPattern, ILearningRule learningRule) { float range = maxWeight - minWeight; for (int i = 0; i < sourceGroup.Count; i++) { for (int j = 0; j < destinationGroup.Count; j++) { if (connectionPattern(i, j)) { float randWeight = (float)rand.NextDouble() * range + minWeight; int randDelay = rand.Next(minDelay, maxDelay + 1); Synapse syn = new Synapse(sourceGroup[i], destinationGroup[j], randWeight, randDelay, learningRule.GetCopy()); sourceGroup[i].AddPostSynapse(syn); destinationGroup[j].AddPreSynapse(syn); } } } }