Ejemplo n.º 1
0
        public void Select(Parametrs a)
        {
            VeshIndivid[] Ind_popul = new VeshIndivid[a.Popultion];
            VeshIndivid   f, g;

            VeshIndivid[] C = { new VeshIndivid(a), new VeshIndivid(a) };
            //  Individ[] q = new Individ[a.Tutu];

            for (int i = 0; i < (int)Math.Floor(a.Popultion / 2.0); i++)
            {
                f = Turnir(Rand_Turnir(a));
                g = Turnir(Rand_Turnir(a));


                C = VeshIndivid.PointCrossOver(a, f, g);

                C[0].MutateAll(a);
                C[1].MutateAll(a);

                Ind_popul[2 * i]              = C[0];
                Ind_popul[2 * i + 1]          = C[1];
                Ind_popul[2 * i].Fank_out     = Fank_(Ind_popul[2 * i], a);
                Ind_popul[2 * i + 1].Fank_out = Fank_(Ind_popul[2 * i + 1], a);
            }

            Popul_all = Ind_popul;
            // Mut_all(Mut, Inv, 3);
        }
Ejemplo n.º 2
0
        private void Test_VeshInd()
        {
            VeshIndivid Te1, Te2;

            VeshIndivid[] Te = new VeshIndivid[2];
            Te[0] = new VeshIndivid(Aa);
            Te[1] = new VeshIndivid(Aa);

            Te1 = new VeshIndivid(Aa);
            Te2 = new VeshIndivid(Aa);

            MtextBox.Text = MtextBox.Text + "-------------" + Environment.NewLine +
                            Te1.Prin_Ind(Aa) + Environment.NewLine + Te2.Prin_Ind(Aa) + Environment.NewLine;

            Te = VeshIndivid.PointCrossOver(Aa, Te1, Te2);

            MtextBox.Text = MtextBox.Text +
                            Te[0].Prin_Ind(Aa) + Environment.NewLine + Te[1].Prin_Ind(Aa) + Environment.NewLine;
        }