public string ToHtml(IInitialParams initParams, int d)
 {
     return(string.Format("<P>Значение целевой функции:<BR>{0}<BR>" +
                          "Текущее решение:<BR>{1}<BR>" +
                          "Симплекс:<BR>{2}<BR>" +
                          "Среднее квадратическое отклонение:<BR>{3}</P>",
                          Math.Round(fRes, d), Html.ArrayToHtml(arrXRes, d),
                          Html.MatrixTranToHtml(matrX, d), Math.Round(sigma, d)));
 }
 public string ToHtml(IInitialParams initParams, int d)
 {
     return(string.Format("<P>Значение целевой функции:<BR>{0}<BR>" +
                          "Текущее решение:<BR>{1}<BR>" +
                          "Величины шагов:<BR>{2}<BR>" +
                          "Направление поиска по образцу:<BR>{3}<BR>" +
                          "Значение множителя в поиске по образцу:<BR>{4}</P>",
                          Math.Round(fRes, d), Html.ArrayToHtml(arrX, d),
                          Html.ArrayToHtml(arrXDelta, d), Html.ArrayToHtml(arrE, d),
                          Math.Round(mult, d)));
 }
Esempio n. 3
0
        LinePlot[] GetPotentials(IInitialParams ip)
        {
            ReadGraphParams();
            List <LinePlot> listPotent = new List <LinePlot>();
            double          stepX      = (xMax - xMin) / (nGridX - 1);
            double          stepY      = (yMax - yMin) / (nGridY - 1);

            for (int i = 0; i < nGridX; i++)
            {
                for (int j = 0; j < nGridY; j++)
                {
                    double x1 = xMin + stepX * i;
                    double y1 = yMin + stepY * j;
                    try
                    {
                        double k = -ip.GetDerivative(new double[] { x1, y1 }, 0) /
                                   ip.GetDerivative(new double[] { x1, y1 }, 1);
                        double x2 = x1 + mult * stepX;
                        double y2 = y1 + k * (x2 - x1);
                        if (Math.Abs(y2 - y1) > stepY * mult * mult2)
                        {
                            goto nextTry;
                        }
                        double f   = ip.GetFuncValue(new double[] { (x1 + x2) / 2, (y1 + y2) / 2 });
                        int    red = (int)(f / denom);
                        if (red > 255)
                        {
                            red = 255;
                        }
                        LinePlot lp = new LinePlot();
                        lp.AbscissaData = new double[] { x1, x2 };
                        lp.OrdinateData = new double[] { y1, y2 };
                        lp.Pen.Color    = Color.FromArgb(red, 0, 0);
                        listPotent.Add(lp);
                        continue;
                    }
                    catch { }
nextTry:
                    try
                    {
                        double k = -ip.GetDerivative(new double[] { x1, y1 }, 1) /
                                   ip.GetDerivative(new double[] { x1, y1 }, 0);
                        double y2 = y1 + mult * stepY;
                        double x2 = x1 + k * (y2 - y1);
                        if (Math.Abs(x2 - x1) > stepX * mult * mult2)
                        {
                            continue;
                        }
                        double f   = ip.GetFuncValue(new double[] { (x1 + x2) / 2, (y1 + y2) / 2 });
                        int    red = (int)(f / denom);
                        if (red > 255)
                        {
                            red = 255;
                        }
                        LinePlot lp = new LinePlot();
                        lp.AbscissaData = new double[] { x1, x2 };
                        lp.OrdinateData = new double[] { y1, y2 };
                        lp.Pen.Color    = Color.FromArgb(red, 0, 0);
                        listPotent.Add(lp);
                    }
                    catch { }
                }
            }
            return(listPotent.ToArray());
        }
 public void Initialize(IInitialParams initParams)
 {
     ip = (HJInitialParams)initParams;
 }