示例#1
0
        //public void FUNCT2(double f_1, ref double[] x_1, ref double[] g_1)//st-nomer stroki
        //{

        //    this.tp[0].A = x[0];
        //    this.tp[0].B = x[1];
        //    this.tp[1].A = x[2];
        //    this.tp[1].B = x[3];

        //    f_1 = this.Integral(this.tp);

        //    double delta = 0.001;

        //    TaskParameters tp1 = tp.Clone() as TaskParameters;
        //    tp1[0].A += delta;
        //    double d1 = this.Integral(tp1);
        //    g_1[0] = (d1 - f_1) / delta;

        //    TaskParameters tp2 = tp.Clone() as TaskParameters;
        //    tp2[0].B += delta;
        //    double d2 = this.Integral(tp2);
        //    g_1[1] = (d2 - f_1) / delta;

        //    TaskParameters tp3 = tp.Clone() as TaskParameters;
        //    tp3[1].A += delta;
        //    double d3 = this.Integral(tp3);
        //    g_1[2] = (d3 - f_1) / delta;

        //    TaskParameters tp4 = tp.Clone() as TaskParameters;
        //    tp4[1].B += delta;
        //    double d4 = this.Integral(tp4);
        //    g_1[3] = (d4 - f_1) / delta;


        //    //g_1[0] = 2 * x_1[0];
        //    //g_1[1] = 2 * x_1[1];
        //    //g_1[2] = 2 * x_1[2];

        //}

        public void FUNCT3(ref double f_1, ref double[] x_1, ref double[] g_1) //st-nomer stroki
        {
            int k = 0;

            for (int i = 0; i < tp.Count; i++)
            {
                for (int j = 0; j < tp[i].Param.Length; j++)
                {
                    tp[i].Param[j] = x[k];
                    k++;
                }
            }

            f_1 = Integral(tp);

            double delta = 0.001;

            k = 0;
            for (int i = 0; i < tp.Count; i++)
            {
                for (int j = 0; j < tp[i].Param.Length; j++)
                {
                    var tp1 = tp.Clone() as TaskParameters;
                    tp1[i].Param[j] += delta;
                    double val = Integral(tp1);
                    g_1[k] = (val - f_1) / delta;
                    k++;
                }
            }
        }