Example #1
0
        public Point(double[] x, IEquationSystem es)
        {
            this.x = x;
            f      = new double[es.number()];
            try
            {
                es.equations(x, f);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                f[0] = 10000.0;
            }

            m = 0.0;
            for (int j = 0; j < es.number(); j++)
            {
                double mm = Math.Abs(f[j]);
                if (mm > m)
                {
                    m = mm;
                }
            }
        }
Example #2
0
        public void solve(double[] x)
        {
            if (es.number() == 0)
            {
                return;
            }

            list.Add(new Point(x, es));
            while (list[0].getM() > 1.0)
            {
                goOn();
                suggest();
                list.Sort();
                while (list.Count > es.number() * 4)
                {
                    list.RemoveAt(list.Count - 1);
                }
            }

            for (int j = 0; j < es.number(); j++)
            {
                x[j] = list[0].getIndex(j);
            }
        }