Ejemplo n.º 1
0
        public void CalcTotalEmphasis()
        {
            float value = 0;

            if (ParallelExecution)
            {
                lock (Layers.SyncObject)
                {
                    value = Layers.AsParallel().Sum(C => C.Neurons.Sum(N => N.Synapses.Sum(S => (float)S.Emphasis)));
                }
            }
            else
            {
                foreach (IBrainLayer layer in Layers)
                {
                    foreach (Neuron neuron in layer.Neurons)
                    {
                        foreach (Synapse s in neuron.Synapses)
                        {
                            value += (float)s.Emphasis;
                        }
                    }
                }
            }

            globals.m_TotalEmphasis = value;
        }
Ejemplo n.º 2
0
        public void CalcConnectionCount()
        {
            int count = 0;

            if (ParallelExecution)
            {
                lock (Layers.SyncObject)
                {
                    count = Layers.AsParallel().Sum(C => C.Neurons.Sum(N => N.Synapses.Count));
                }
            }
            else
            {
                foreach (IBrainLayer layer in Layers)
                {
                    foreach (Neuron neuron in layer.Neurons)
                    {
                        count += neuron.Synapses.Count;
                    }
                }
            }

            globals.m_ConnectionCount = count;
        }