Esempio n. 1
0
 /// <summary>
 /// Функция, очищающая все токены из соединений процедуры
 /// </summary>
 public void Flush()
 {
     foreach (var resource in Inputs.Concat(Outputs))
     {
         resource.Tokens.Clear();
     }
 }
Esempio n. 2
0
 public void Update(List <double> inputs)
 {
     for (int i = 0; i < inputs.Count; i++)
     {
         Inputs[i].Value = inputs[i];
     }
     ProcessLayer(Inputs.Concat(Memory).ToList(), HiddenLayers[0], HiddenFunc);
     for (int i = 1; i < HiddenLayers.Count; i++)
     {
         ProcessLayer(HiddenLayers[i - 1], HiddenLayers[i], HiddenFunc);
     }
     ProcessLayer(HiddenLayers[HiddenLayers.Count - 1], Outputs.Concat(Memory).ToList(), HiddenFunc);
 }
Esempio n. 3
0
 private void GenerateRand(int inputs, List <int> hiddenLayers, int outputs, int memory)
 {
     for (int i = 0; i < inputs; i++)
     {
         Inputs.Add(new Neuron());
     }
     for (int i = 0; i < memory; i++)
     {
         Memory.Add(new Neuron(hiddenLayers[hiddenLayers.Count - 1], 0, NeuronType.MEMORY));
     }
     for (int i = 0; i < hiddenLayers.Count; i++)
     {
         for (int j = 0; j < hiddenLayers[i]; j++)
         {
             var value     = GetRandomWeight();
             var prevLayer = i == 0 ? Inputs.Concat(Memory).ToList() : HiddenLayers[i - 1];
             HiddenLayers[i].Add(new Neuron(prevLayer.Count, value, NeuronType.HIDDEN));
         }
     }
     for (int i = 0; i < outputs; i++)
     {
         Outputs.Add(new Neuron(hiddenLayers[hiddenLayers.Count - 1], 0, NeuronType.OUTPUT));
     }
 }
Esempio n. 4
0
 public IEnumerable <Connection> Connections()
 {
     Debug.Assert(useable);
     return(Inputs.Concat(Outputs));
 }