/** * Destroys any references this {@code Pool} maintains on behalf * of the specified {@link Synapse} * * @param synapse */ public void DestroySynapse(Synapse synapse) { _synapseConnections.Remove(synapse.GetInputIndex()); _synapsesBySourceIndex.Remove(synapse.GetInputIndex()); if (synapse.GetSegment() is DistalDendrite) { Destroy(); } }
/** * Updates this {@code Pool}'s store of permanences for the specified {@link Synapse} * @param c the connections memory * @param s the synapse who's permanence is recorded * @param permanence the permanence value to record */ public void UpdatePool(Connections c, Synapse s, double permanence) { int inputIndex = s.GetInputIndex(); //Synapse foundSynapse; lock (_synapsesBySourceIndex) { if (!_synapsesBySourceIndex.ContainsKey(inputIndex)) // TryGetValue(inputIndex, out foundSynapse) { _synapsesBySourceIndex.Add(inputIndex, s); } } lock (_synapseConnections) { if (permanence >= c.GetSynPermConnected()) { _synapseConnections.Add(inputIndex); } else { if (_synapseConnections.Count > inputIndex) { _synapseConnections.RemoveAt(inputIndex); } } } //int inputIndex = s.GetInputIndex(); //if (_synapsesBySourceIndex.Get(inputIndex) == null) //{ // _synapsesBySourceIndex[inputIndex] = s; //} //if (permanence >= c.GetSynPermConnected()) //{ // _synapseConnections.Add(inputIndex); //} //else //{ // _synapseConnections.Remove(inputIndex); //} }
/** * Returns the permanence value for the {@link Synapse} specified. * * @param s the Synapse * @return the permanence */ public double GetPermanence(Synapse s) { return(_synapsesBySourceIndex.Get(s.GetInputIndex()).GetPermanence()); }