예제 #1
0
        /**
         * <p>
         * Creates and returns a newly created {@link Synapse} with the specified
         * source cell, permanence, and index.
         * </p><p>
         * IMPORTANT:   <b>This method is only called for Proximal Synapses.</b> For ProximalDendrites,
         *              there are many synapses within a pool, and in that case, the index
         *              specifies the synapse's sequence order within the pool object, and may
         *              be referenced by that index.
         * </p>
         * @param c             the connections state of the temporal memory
         * @param sourceCell    the source cell which will activate the new {@code Synapse}
         * @param pool		    the new {@link Synapse}'s pool for bound variables.
         * @param index         the new {@link Synapse}'s index.
         * @param inputIndex	the index of this {@link Synapse}'s input (source object); be it a Cell or InputVector bit.
         *
         * @return the newly created {@code Synapse}
         * @see Connections#createSynapse(DistalDendrite, Cell, double)
         */
        public virtual Synapse CreateSynapse(Connections c, List <Synapse> syns, Cell sourceCell, Pool pool, int index, int inputIndex)
        {
            Synapse s = new Synapse(c, sourceCell, this, pool, index, inputIndex);

            syns.Add(s);
            return(s);
        }
예제 #2
0
파일: Pool.cs 프로젝트: ArtiDi/HTM.Net
 /**
  * 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();
     }
 }
예제 #3
0
파일: Pool.cs 프로젝트: ArtiDi/HTM.Net
        /**
         * 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);
            //}
        }
예제 #4
0
파일: Pool.cs 프로젝트: ArtiDi/HTM.Net
 /**
  * Sets the specified  permanence value for the specified {@link Synapse}
  * @param s
  * @param permanence
  */
 public void SetPermanence(Connections c, Synapse s, double permanence)
 {
     s.SetPermanence(c, permanence);
 }
예제 #5
0
파일: Pool.cs 프로젝트: ArtiDi/HTM.Net
 /**
  * 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());
 }