Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lb"></param>
        /// <param name="ub"></param>
        /// <param name="xinteger">indicate, which variable is integer</param>
        /// <param name="evalmax"></param>
        /// <param name="evalfnc"></param>
        /// <param name="seed"></param>
        public SingleObjective(double[] lb, double[] ub, bool[] xint, int evalmax, Func <double[], double> evalfnc, int seed)
        {
            this.lb        = lb;
            this.ub        = ub;
            this.xint      = xint;
            this.evalcount = 0;
            this.evalmax   = evalmax;
            this.evalfnc   = evalfnc;
            this.n         = lb.Length;
            this.rnd       = new RandomDistributions(seed);

            this.fxopt = double.MaxValue;
            this.xopt  = new double[this.n];
        }
        static void rndMain(string[] args)
        {
            List <string>       log = new List <string>();
            RandomDistributions rnd = new RandomDistributions(0);

            for (int i = 0; i < 5000; i++)
            {
                log.Add(Convert.ToString(rnd.NextGaussian(0, 0.3)));
            }
            Console.ReadKey();


            string fileName = @"C:\_CHRIS\rnd.txt";

            using (FileStream fs = new FileStream(fileName, FileMode.Append, FileAccess.Write))
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    for (int i = 0; i < log.Count; i++)
                    {
                        sw.WriteLine(log[i]);
                    }
                }
        }