public bool Equals(HomeostaticPlasticityController obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (obj == null)
            {
                return(false);
            }

            if (m_HtmMemory == null)
            {
                if (obj.m_HtmMemory != null)
                {
                    return(false);
                }
            }
            else if (!m_HtmMemory.Equals(obj.m_HtmMemory))
            {
                return(false);
            }
            if (m_RequiredSimilarityThreshold != obj.m_RequiredSimilarityThreshold)
            {
                return(false);
            }
            else if (m_MaxPreviousElements != obj.m_MaxPreviousElements)
            {
                return(false);
            }
            else if (m_Cycle != obj.m_Cycle)
            {
                return(false);
            }
            else if (m_MinCycles != obj.m_MinCycles)
            {
                return(false);
            }
            else if (m_RequiredNumOfStableCycles != obj.m_RequiredNumOfStableCycles)
            {
                return(false);
            }
            else if (!m_NumOfStableCyclesForInput.SequenceEqual(obj.m_NumOfStableCyclesForInput) && !m_NumOfActiveColsForInput.SequenceEqual(m_NumOfActiveColsForInput) && !m_InOutMap.SequenceEqual(m_InOutMap))
            {
                return(false);
            }
            else if (m_IsStable != obj.m_IsStable)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static HomeostaticPlasticityController Deserialize(StreamReader reader)
        {
            HomeostaticPlasticityController ctrl = new HomeostaticPlasticityController();

            HtmSerializer2 ser = new HtmSerializer2();

            //ctrl.m_MaxPreviousElements = ser.ReadIntValue(reader);
            //ctrl.m_MinCycles = ser.ReadIntValue(reader);
            //ctrl.m_RequiredNumOfStableCycles = ser.ReadIntValue(reader);
            ////...

            return(ctrl);
        }
Ejemplo n.º 3
0
 public SpatialPoolerMT(HomeostaticPlasticityController homeostaticPlasticityActivator = null) : base(homeostaticPlasticityActivator)
 {
 }
        public static HomeostaticPlasticityController Deserialize(StreamReader sr)
        {
            HomeostaticPlasticityController ctrl = new HomeostaticPlasticityController();

            HtmSerializer2 ser = new HtmSerializer2();

            while (sr.Peek() >= 0)
            {
                string data = sr.ReadLine();
                if (data == String.Empty || data == ser.ReadBegin(nameof(HomeostaticPlasticityController)))
                {
                    continue;
                }
                else if (data == ser.ReadBegin(nameof(Connections)))
                {
                    ctrl.m_HtmMemory = Connections.Deserialize(sr);
                }
                else if (data == ser.ReadEnd(nameof(HomeostaticPlasticityController)))
                {
                    break;
                }
                else
                {
                    string[] str = data.Split(HtmSerializer2.ParameterDelimiter);
                    for (int i = 0; i < str.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                        {
                            ctrl.m_RequiredSimilarityThreshold = ser.ReadDoubleValue(str[i]);
                            break;
                        }

                        case 1:
                        {
                            ctrl.m_MaxPreviousElements = ser.ReadIntValue(str[i]);
                            break;
                        }

                        case 2:
                        {
                            ctrl.m_Cycle = ser.ReadIntValue(str[i]);
                            break;
                        }

                        case 3:
                        {
                            ctrl.m_MinCycles = ser.ReadIntValue(str[i]);
                            break;
                        }

                        case 4:
                        {
                            ctrl.m_RequiredNumOfStableCycles = ser.ReadIntValue(str[i]);
                            break;
                        }

                        case 5:
                        {
                            ctrl.m_NumOfStableCyclesForInput = ser.ReadDictSIValue(str[i]);
                            break;
                        }

                        case 6:
                        {
                            ctrl.m_NumOfActiveColsForInput = ser.ReadDictSIarray(str[i]);
                            break;
                        }

                        case 7:
                        {
                            ctrl.m_InOutMap = ser.ReadDictSIarray(str[i]);
                            break;
                        }

                        case 8:
                        {
                            ctrl.m_IsStable = ser.ReadBoolValue(str[i]);
                            break;
                        }

                        default:
                        { break; }
                        }
                    }
                }
            }

            return(ctrl);
        }