예제 #1
0
        /// <summary>
        /// Perform the specified connection task. This task will be performed over
        /// all connections.
        /// </summary>
        /// <param name="task">The connection task.</param>
        public void PerformConnectionTask(FreeformConnectionTask task)
        {
            var visited = new HashSet <IFreeformNeuron>();

            foreach (IFreeformNeuron neuron in _outputLayer.Neurons)
            {
                PerformConnectionTask(visited, neuron, task);
            }
        }
예제 #2
0
        /// <summary>
        /// Perform the specified connection task.
        /// </summary>
        /// <param name="visited">The list of visited neurons.</param>
        /// <param name="parentNeuron"></param>
        /// <param name="task"></param>
        private void PerformConnectionTask(HashSet <IFreeformNeuron> visited,
                                           IFreeformNeuron parentNeuron, FreeformConnectionTask task)
        {
            visited.Add(parentNeuron);

            // does this neuron have any inputs?
            if (parentNeuron.InputSummation != null)
            {
                // visit the inputs
                foreach (IFreeformConnection connection in parentNeuron
                         .InputSummation.List)
                {
                    task(connection);
                    IFreeformNeuron neuron = connection.Source;
                    // have we already visited this neuron?
                    if (!visited.Contains(neuron))
                    {
                        PerformConnectionTask(visited, neuron, task);
                    }
                }
            }
        }
        /// <summary>
        /// Perform the specified connection task. 
        /// </summary>
        /// <param name="visited">The list of visited neurons.</param>
        /// <param name="parentNeuron"></param>
        /// <param name="task"></param>
        private void PerformConnectionTask(HashSet<IFreeformNeuron> visited,
            IFreeformNeuron parentNeuron, FreeformConnectionTask task)
        {
            visited.Add(parentNeuron);

            // does this neuron have any inputs?
            if (parentNeuron.InputSummation != null)
            {
                // visit the inputs
                foreach (IFreeformConnection connection in parentNeuron
                    .InputSummation.List)
                {
                    task(connection);
                    IFreeformNeuron neuron = connection.Source;
                    // have we already visited this neuron?
                    if (!visited.Contains(neuron))
                    {
                        PerformConnectionTask(visited, neuron, task);
                    }
                }
            }
        }
        /// <summary>
        /// Perform the specified connection task. This task will be performed over
        /// all connections. 
        /// </summary>
        /// <param name="task">The connection task.</param>
        public void PerformConnectionTask(FreeformConnectionTask task)
        {
            var visited = new HashSet<IFreeformNeuron>();

            foreach (IFreeformNeuron neuron in _outputLayer.Neurons)
            {
                PerformConnectionTask(visited, neuron, task);
            }
        }