Ejemplo n.º 1
0
        /// <summary>
        /// Performs a lifecycle on the current population
        /// </summary>
        public void Next()
        {
            if (CurrentPopulation.Species.Count == 0)
            {
                Populate();
            }

            if (EvaluationFunction == null)
            {
                throw new Exception("EvaluationFuntion has to be set first!");
            }

            if (Mutator == null)
            {
                throw new Exception("Mutator has to be set first!");
            }

            //Evaluate Members
            CurrentPopulation.EvaluateMembers(EvaluationFunction);

            //Perform lifecycle
            DoSelection();
            Reproduce();

            //Fire event
            LifecycleFinishedEvent?.Invoke(CurrentPopulation);
        }