Пример #1
0
        private void runSimpleSearch()
        {
            OptimizeResult rez = algorythm.Optimize();

            netChart.ChangeState(rez.Pack);
            netChart.Draw();
        }
        public override OptimizeResult Optimize()
        {
            List <double[]> res  = new List <double[]>();
            double          deln = (Nmax - Nmin) / dn;
            double          deld = (Dmax - Dmin) / dd;

            for (double n = Nmin; n <= Nmax; n += deln)
            {
                for (double d = Dmin; d <= Dmax; d += deld)
                {
                    res.Add(new double[] { n, d, func.functional(n, d, ref psi, ref delta), delta, psi });
                }
            }
            if (sortFlag)
            {
                res.Sort(new ArrComparer());
                if (percent != 100)
                {
                    res.RemoveRange((int)(res.Count * percent / 100), res.Count - 1);
                }
            }
            OptimizeResult pack = new OptimizeResult();

            pack.Pack  = res;
            pack.OType = typeof(List <double[]>);
//            string ans = "";
//            foreach (var xx in res)
//            {
//                ans += xx[1] + "\t" + xx[2] + "\t" + xx[0] + "\t" + xx[3] + "\t" + xx[4] + "\r\n";
//
//            }
            //     textBox1.Text += "n\td\tf\t\r\n";
            //    textBox1.Text += ans;
            return(pack);
        }
Пример #3
0
        public IEnumerable <IResult> Optimize()
        {
            yield return(new SingleResult
            {
                Action = () =>
                {
                    IsBusy = true;
                }
            });

            var result = new OptimizeResult {
                Id = Id
            };

            yield return(result);

            DatabaseSize = result.DatabaseSize;
            IsBusy       = false;
        }