コード例 #1
0
ファイル: Manager.cs プロジェクト: cckobal/BitNeat
        /// <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);
        }