public void LoadPopulationSettingsFromCSV(string path)
        {
            using (FileStream fs = new FileStream(path, FileMode.Open))
            {
                using (StreamReader reader = new StreamReader(fs))
                {
                    paramHeader = reader.ReadLine();

                    string[] splits = ParamHeader.Split(new[] {","}, StringSplitOptions.None);
                    for (int i = 0; i < splits.Length; i++)
                    {
                        paramOrder.Add(splits[i], i);
                    }

                    while (!reader.EndOfStream)
                    {
                        //filterRate,crossRate,mutateRate,populationSize,generations
                        string param = reader.ReadLine();
                        string[] paramSplits = param.Split(new[] {","}, StringSplitOptions.None);

                        double crossRate = Convert.ToDouble(paramSplits[paramOrder["crossRate"]]);
                        double filterRate = Convert.ToDouble(paramSplits[paramOrder["filterRate"]]);
                        double mutateRate = Convert.ToDouble(paramSplits[paramOrder["mutateRate"]]);
                        int populationSize = Convert.ToInt32(paramSplits[paramOrder["populationSize"]]);
                        int generations = Convert.ToInt32(paramSplits[paramOrder["generations"]]);

                        PopulationSettings settings = new PopulationSettings(generations, populationSize, mutateRate, filterRate, populationSize, crossRate);

                        StatSimulationMultiRunResult result = new StatSimulationMultiRunResult(settings, param);

                        Settingses.Add(result);
                    }
                }
            }
        }
        private void GetResultParallel(StatSimulationMultiRunResult result)
        {
            StatSimulation simulation = new StatSimulation(runCount, boardSeed, result.Settings);

            simulation.RunAnalysis();
            result.AverageScore = simulation.Results.Average(c => c.Fitness);
            result.StandardDeviation = simulation.Results.StandardDeviation(c => c.Fitness);
            result.RunTimeElapsed = simulation.RunTimeElapsed;
            simulation.WriteAnalysis(string.Format(@"{0}\{1}", TopFolder, result.SettingsString));
            InvokePercentCompleteChanged(new PercentCompleteEventArgs(++Count/Settingses.Count));
        }
        public void CreateRandomPopulation(int paramSetCount)
        {
            for (int i = 0; i < paramSetCount; i++)
            {
                double crossRate = RandomSource.Instance.NextDoublePositive();
                double filterRate = RandomSource.Instance.NextDoublePositive();
                double mutateRate = RandomSource.Instance.NextDoublePositive();
                int populationSize = RandomSource.Instance.Next(20, 100);
                int generations = RandomSource.Instance.Next(1, 50);

                PopulationSettings settings = new PopulationSettings(generations, populationSize, mutateRate, filterRate, populationSize, crossRate);

                StatSimulationMultiRunResult result = new StatSimulationMultiRunResult(settings, settings.DefaultParamString);

                Settingses.Add(result);
            }
        }