Example #1
0
        /// <summary>
        /// Start the specified populationSize and chromosomeLength.
        /// </summary>
        public void Start()
        {
            if (_ga != null && _ga.IsRunning)
            {
                RaiseLoggingEvent("The GA cannot be started as it is already running.", true);
            }
            else
            {
                CreateGeneticAlgorithm();
                if (ValidateGa(_ga))
                {
                    if (!_ga.IsRunning)
                    {
                        this.RunMilliseconds = 0;

                        _tempGenerationMilliseconds = 0;

                        Stopwatch = Stopwatch.StartNew();

                        _ga.RunAsync(_functions.TerminateFunction);

                        IsRunning = true;
                    }
                    else
                    {
                        RaiseLoggingEvent("The GA could not be created.", true);
                    }
                }
            }
        }