Esempio n. 1
0
        /// <summary>
        /// Creates a new nuron on a given network, with a given activation
        /// function and level depth. An index is required to be able to
        /// refrence the nuron from outside the network.
        /// </summary>
        /// <param name="network">Network on wich to create the nuron</param>
        /// <param name="func">Activation funciton of the nuron</param>
        /// <param name="level">Level of the nuron</param>
        /// <param name="index">Index of the nuron</param>
        internal NuronOld(NetworkCPP network, ActFunc func, int level, int index)
        {
            this.network = network;
            this.func    = func;
            this.level   = level;
            this.index   = index;

            inputs = new VListArray <Axon>();
            value  = 0.0;
        }
Esempio n. 2
0
        /// <summary>
        /// Clears all the data contained in this node. It is nessary to
        /// call this when disposing of the parent network in order to
        /// avoid cyclical refrences and potential memory leaks.
        /// </summary>
        internal void ClearData()
        {
            //desposes of the internal data sturctor
            if (inputs != null)
            {
                inputs.Clear();
            }

            //deletes the network to avoid cyclic refrences
            this.network = null;
            this.inputs  = null;
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a copy of a given nuron for a given network. All of the
        /// refrences to axons in the old network, now point to axons in
        /// the new network. All other values remain the same.
        /// </summary>
        /// <param name="network">The network containing this nuron</param>
        /// <param name="other">Another neuron to copy its values</param>
        internal NuronOld(NetworkCPP network, NuronOld other)
        {
            //sets the network refrence to the new network
            this.network = network;

            //copies the other vlaues
            func  = other.func;
            level = other.level;
            value = other.value;

            inputs = new VListArray <Axon>(other.inputs.Count);

            //makes a deep copy of the list of inputs
            foreach (Axon ax in other.inputs)
            {
                Axon clone = new Axon(ax);
                this.inputs.Add(clone);
            }
        }