Регистрация | Вход
{ /// <summary> /// Description of Neurons. /// </summary> public class Neurons { public Boolean ActiviteNeuron; public byte Activite; public byte Tact; public List<sbyte> chenge = new List<sbyte>(); public List<short> Communications = new List<short>(); private List<int> SelectedLinks = new List<int>(); public List<Byte> sensor = new List<Byte>(); private int qt; private int Res; private int Summ; public int Link; private byte AttemptOfSeparation; public bool torn; public bool torn_record; private int nomLayer; private int nomLayerTact; public Neurons(int a, int b) { nomLayer = b; SelectedLinks.Add(a); for (int i = 0; i <= a; i++) { if (i == a) Communications.Add(10000); else Communications.Add(0); } ActiviteNeuron = false; Activite = 0; Tact = 0; Link = a; AttemptOfSeparation = 0; torn = false; torn_record = false; } public void NextTakt() { // sw.Start(); if (ActiviteNeuron) { if (Tact > 8) { if (Communications[Link] > 0) AttemptOfSeparation = 0; if (chenge.Count() > 0) for (int i = 0; i < chenge.Count(); i++) { if (Communications.Count() > i) { if (chenge[i] != 0) { if (Communications[i] != 0) Communications[i] = (short)(Communications[i] + (Math.Sqrt(Communications[i])/Communications[i])*(chenge[i]* 100)); else Communications[i] = (short)(chenge[i]*100); } } else { Communications.Add((short)(chenge[i]*100)); } if (Communications[i] < 0) Communications[i] = 0; if (Communications[i] > 10000) Communications[i] = 10000; } if (nomLayerTact == 0) { if (Communications[Link] == 0 && SelectedLinks.Count() > 30 && torn_record == false && torn == false) { if (AttemptOfSeparation > 10 && Activite > 0) { torn = true; torn_record = true; } if (qt > 10) AttemptOfSeparation++; } SelectedLinks.Clear(); for (int i = 0; i < Communications.Count(); i++) if (Communications[i] > 5500) {//порог активности сенсора SelectedLinks.Add(i); if (SelectedLinks.Count > 100) break; } ActiviteNeuron = false; Activite = 0; Tact = 0; } else { nomLayerTact--; Tact = 1; } } else { Tact++; } } else { qt = 0; Summ = 0; Res = 0; if (SelectedLinks.Count() > 0) { for (int i = 0; i < SelectedLinks.Count(); i++) { if (sensor[SelectedLinks[i]] > 0) { Summ = Summ + sensor[SelectedLinks[i]]; qt++; } } if (qt > 0) { Res = (int)(Summ / qt); if (Res > 1) { //порог активности нейрона ActiviteNeuron = true; if (qt > 10)//порог количества связий для регистрации активности нейрона Activite = (byte)(Res); Tact = 1; nomLayerTact = nomLayer; } } } } chenge.Clear(); } }}
{ /// <summary> /// Description of Neurons. /// </summary> public class Neurons {..............................................................