Exemple #1
0
 void StopButton_Click(Object sender, EventArgs e)
 {
     Arny                = null;
     network_version     = 0;
     total_action_number = 0;
     StopButton.Enabled  = false;
     ProcessTextBox.AppendText(" ----- Конец ----- " + Environment.NewLine);
     StartButton.Text = "Start";
 }
Exemple #2
0
 void StartButton_Click(Object sender, EventArgs e)
 {
     StartButton.Text = "Continue";
     if (Arny == null)
     {
         StopButton.Enabled = true;
         Arny             = new Neuroweb(this);
         Arny.Best_result = action_limit;
     }
     Arny.Start(ref Arny);
 }
Exemple #3
0
 public void Evolve()
 {
     Reach1000.network_version++;
     /*if (total_action_numer_of_this_nw == 0) total_action_numer_of_this_nw = Reach1000.action_number;*/     // ?
     Reach1000.action_number = 0;
     previous = (Neuroweb)this.Clone();
     total_action_numer_of_this_nw = 0;
     reached_number = 0;
     ValueNeurons();
     for (int i = 0; i < web.Length; i++)
     {
         if (Reach1000.sluchai.Next(0, 101) <= Reach1000.chance * web[i].coeff)
         {
             string        op_name;
             Neuron_Action act;
             int           action_delta = 1;
             if (Reach1000.sluchai.Next(0, 101) < 50)
             {
                 op_name = "Add";
             }
             else
             {
                 op_name = "Delete"; action_delta = -1;
             }
             if (Reach1000.sluchai.Next(0, 101) < 50 * web[i].addmult_coeff)
             {
                 act = Add;
                 web[i].num_of_add += action_delta;
             }
             else
             {
                 act = Multiply;
                 web[i].num_of_mult += action_delta;
             }
             web[i].Change_action(op_name, act);
         }
         if (Reach1000.sluchai.Next(0, 101) <= Reach1000.chance) //here
         {
             int j;
             do
             {
                 j                 = Reach1000.sluchai.Next(0, web.Length);
                 web[i].Next       = web[j];
                 web[i].next_index = j;
             }while (i == j);
         }
         if (Reach1000.sluchai.Next(0, 101) <= Reach1000.chance * web[i].param_coeff)
         {
             web[i].param        += Reach1000.sluchai.Next(0, 5);
             web[i].param_changed = true;
         }
     }
 }
Exemple #4
0
        public void Act(ref Neuroweb sender) // Выполнение нейроном заданных действий
        {
            num_of_calls++;
            int b4 = sender.reached_number;

            action(ref sender.reached_number, param);
            sum_of_delta += sender.reached_number - b4;
            if (Reach1000.action_number < Reach1000.action_limit && sender.reached_number < Reach1000.goal)
            {
                Pass(ref sender);
            }
            else
            {
                Neuroweb.Mother.Show_best_result(sender.Best_result);
                if (sender.Delta <= 0 || sender.previous == null)
                {
                    sender.Evolve();
                }
                else
                {
                    sender = (Neuroweb)sender.previous.Clone(); sender.Evolve();
                }
            }
        }
Exemple #5
0
        public object Clone()
        {
            Neuroweb old = new Neuroweb(Mother, false)
            {
                reached_number  = this.reached_number,
                initial_amount  = this.initial_amount,
                Multiply_amount = this.Multiply_amount,
                total_action_numer_of_this_nw = this.total_action_numer_of_this_nw
            };

            for (int i = 0; i < web.Length; i++)
            {
                old.web[i] = (Neuron)this.web[i].Clone();
            }
            for (int i = 0; i < web.Length; i++)
            {
                old.web[i].Next = old.web[old.web[i].next_index];
            }
            for (int i = 0; i < initial_action.Length; i++)
            {
                old.initial_action[i] = this.initial_action[i];
            }
            return(old);
        }
Exemple #6
0
 private void Pass(ref Neuroweb sender) // Передача сигнала
 {
     Next.Act(ref sender);
 }
Exemple #7
0
 public void Start(ref Neuroweb sender)
 {
     web[0].Act(ref sender);
 }