Exemple #1
0
        public TX(TX X = null)
        {
            N = Info.N;

            A = new double[N];

            if (X == null)
            {
                for (int n = 0; n < N; n++)
                {
                    this[n] = Calc.U(Info.A, Info.B);
                }
            }
            else
            {
                for (int n = 0; n < N; n++)
                {
                    this[n] = X[n];
                }
            }
        }
Exemple #2
0
        public override double F(TX X)
        {
            double res = 0;

            double dt = 0.1;

            double t = 0;

            double Js = 10;

            while (t < Info.N)
            {
                double r = I(t, X);

                res += Calc.S2(r - Js) * dt;

                t += dt;
            }

            return(Math.Sqrt(res)); // + 0.01 * Omega(X);
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();

            Info.Init();

            //TNonlocalRoy R = new TNonlocalRoy();

            //for (int l = 0; l < Info.L; l++)
            //{
            //    R.Run();
            //}

            //R.G.Print("n.txt");

            //Close();


            TGraph Graph = new TGraph(g);

//            Roy = new TIJRoy(Graph);
            Roy = new TMyRoy(Graph);

            TX X0 = new TX();

            X0[0] = 1;
            X0[1] = 1;

            Graph.SetU(X0);

            Timer          = new DispatcherTimer();
            Timer.Tick    += new EventHandler(onTick);
            Timer.Interval = new TimeSpan(0, 0, 0, 0, 10);

            Timer.Start();

            //Close();
        }
Exemple #4
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;
            }
        }
Exemple #5
0
 abstract public double F(TX X);