예제 #1
0
        public double Fank_(Individ s, Parametrs a)//double Fenotip_01, double Fenotip_02)
        {
            double x1 = 0, x2 = 0, x3 = 0, x4 = 0;
            double y1 = a.y1;
            double y2 = a.y2;
            double y3 = a.y3;
            double y4 = a.y4;

            if (a.Chom == 4)
            {
                x1 = s.Fenotip_1(a);
                x2 = s.Fenotip_2(a);
                x3 = s.Fenotip_3(a);
                x4 = s.Fenotip_4(a);
            }
            else
            {
                x1 = s.Fenotip_1(a);
                x2 = s.Fenotip_2(a);
            }

            double ouT;

            switch (a.Fanc)
            {
            case 1:
                ouT = x1 * y1 * y1 + x2 * y1 + x3;
                break;

            case 2:
                ouT = x1 * y1 * y1 + x2 * y2 * y2;
                break;

            case 3:
                ouT = x1 * y1 * y1 + x2 * y2 * y2 + x3 * y3;
                break;

            case 4:
                ouT = x1 * y1 * y4 + x2 * y2 * y2 + x3 * y3 + x4 * y4 * y4;    //4 * (x1 - 5) * (x1 - 5) + (x2 - 6) * (x2  - 6);
                break;

            case 5:
                ouT = (x2 - x1 * x1) * (x2 - x1 * x1) + (1 - x1) * (1 - x1);
                break;

            case 12:
                ouT = 4 * x1 * x1 + 3 * x2 * x2 - 4 * x1 * x2 * x2 + x1;
                break;

            case 15:
                ouT = (1.5 - x1 * (1 - x2)) * (1.5 - x1 * (1 - x2)) + (2.25 - x1 * (1 - x2 * x2)) * (2.25 - x1 * (1 - x2 * x2)) +
                      (2.625 - x1 * (1 - x2 * x2 * x2)) * (2.625 - x1 * (1 - x2 * x2 * x2));
                break;

            case 17:
                ouT = 100 * (x2 - x1 * x1) * (x2 - x1 * x1) + (1 - x1) * (1 - x1) + 90 * (x4 - x3 * x3) * (x4 - x3 * x3) +
                      (1 - x3) * (1 - x3) * (1 - x3) + 10.1 * ((x2 - 1) * (x2 - 1) + (x4 - 1) * (x4 - 1)) + 19.8 * (x2 - 1) * (x4 - 1);
                break;

            default:
                ouT = 4 * (x1 - 5) * (x1 - 5) + (x2 - 6) * (x2 - 6);
                break;
            }
            return(ouT);
        }
예제 #2
0
        //возможность измененния длины гена


        public VeshChrom(Parametrs A, int i)
        {
            chrom = A.rnd1.Next(Convert.ToInt32(A.interM[i, 0]), Convert.ToInt32(A.interM[i, 1]));
            chrom = chrom + A.rnd1.NextDouble();
        }