Exemple #1
0
        public TBox(TBox TB)
        {
            NN = TB.NN;
            N  = TB.N;
            B  = new int[N];

            for (int n = 0; n < N; n++)
            {
                B[n] = TB[n];
            }
        }
Exemple #2
0
        public bool Find(TBox B)
        {
            for (int n = 0; n < Count; n++)
            {
                if (B.IsEq(this[n]))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        public bool IsEq(TBox B)
        {
            for (int i = 0; i < N; i++)
            {
                if (this[i] != B[i])
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #4
0
        public TPole(Canvas g, string name)
        {
            this.g    = g;
            this.name = name;
            NN        = 5;
            dx        = g.Width / NN; // ширина в пикселях клетки

            Box = new TBox(NN, name);

            Rs = new Rectangle[NN, NN];

            Draw(); // перерисовать поле

            g.MouseUp += Check;
        }
        private void cmFind(object sender, RoutedEventArgs e)
        {
            if (Boxes.Count < 1)
            {
                return;
            }

            THopfield Hopfield = new THopfield(Boxes);

            TBox Box = Hopfield.Find(Pole.Box, 100);

            if (Box == null)
            {
                MessageBox.Show("Образ не найден!");
            }
            else
            {
                Pole.Box = Box;
                Pole.Draw();
            }
        }
Exemple #6
0
        private void CmFind(object sender, RoutedEventArgs e)
        {
            if (Boxes.Count < 1)
            {
                return;
            }

            THopfield Hopfield = new THopfield(Boxes);

            TBox Box = Hopfield.Find(Pole.Box, 100);

            if (Box == null)
            {
                MessageBox.Show("Не знайдено дiагнозiв, схожих по характеристикам!");
            }
            else
            {
                Pole.Box     = Box;
                name         = Pole.Draw();
                textBox.Text = names;
            }
        }
Exemple #7
0
        // восстановление образа
        public TBox Find(TBox BS, int T = 1000)
        {
            TBox B  = new TBox(BS);
            TBox B2 = new TBox(B);

            for (int t = 0; t < T; t++)
            {
                for (int j = 0; j < N; j++)
                {
                    double d = 0;

                    for (int i = 0; i < N; i++)
                    {
                        d += w[j, i] * B[i];
                    }

                    if (d > 0)
                    {
                        B2[j] = 1;
                    }
                    else
                    {
                        B2[j] = -1;
                    }
                }

                B = new TBox(B2);

                if (Boxes.Find(B))
                {
                    return(B);
                }
            }

            return(null);
        }
Exemple #8
0
 public void Add(TBox B)
 {
     arr.Add(B);
 }