Пример #1
0
        public TAgent(TRoy Roy)
        {
            this.Roy = Roy;

            X = new TX();
            P = new TX(X);
            J = Roy.F(P);

            V = new TX();

            for (int n = 0; n < Info.N; n++)
            {
                V[n] = Calc.U(-(Info.B - Info.A), Info.B - Info.A);
            }
        }
Пример #2
0
        public void Move(TX G)
        {
            for (int n = 0; n < Info.N; n++)
            {
                V[n] = Info.alpha * V[n] + Info.beta * (P[n] - X[n]) * Calc.U(0, 1) +
                       Info.gamma * (G[n] - X[n]) * Calc.U(0, 1);

                X[n] = X[n] + V[n];

                //if (X[n] < 0)
                //{
                //    X[n] = 0;
                //}
            }

            double j = Roy.F(X);

            if (j < J)
            {
                P = new TX(X);
                J = j;
            }
        }