public void AddLink(CPPNNetworkNeuron from, CPPNNetworkNeuron to, Complex weight)
 {
     if (Neurons.Contains(from) && Neurons.Contains(to))
     {
         (to as CPPNOutputNeuron).AddChild(from, weight);
     }
 }
Exemple #2
0
 public bool Connect(Neuron neuron, Neuron input, double weight)
 {
     if (!Neurons.Contains(neuron) || !Neurons.Contains(input))
     {
         return(false);
     }
     neuron.Connect(input.Id, weight);
     return(true);
 }
Exemple #3
0
 public bool Disconnect(Neuron neuron, Neuron input)
 {
     if (!Neurons.Contains(neuron) || !Neurons.Contains(input))
     {
         return(false);
     }
     neuron.Disconnect(input.Id);
     if (Output.Contains(neuron))
     {
         Output.Remove(neuron);
     }
     return(true);
 }
Exemple #4
0
        public void AddNeuron(Neuron neuron, IEnumerable <Neuron> inputs)
        {
            if (neuron.Tag == NeuronTag.output)
            {
                Output.Add(neuron);
            }
            if (neuron.Tag == NeuronTag.input)
            {
                Input.Add(neuron);
            }
            var rand = new Random();

            neuron.Id             = Neurons.Count.ToString();
            NeuronsIds[neuron.Id] = neuron;
            Neurons.Add(neuron);
            foreach (var input in inputs)
            {
                if (Neurons.Contains(input))
                {
                    neuron.Connect(input.Id, rand.NextDouble() - 0.5d);//wights generation to fix
                }
            }
        }