public State <T> Step()
        {
            State = Killer.Kill(State);
            State = CrossOver.CrossOver(State);
            //State = Mutator.Mutate(State);

            return(State);
        }
        public void Run()
        {
            for (int i = 0; i < Generations; i++)
            {
                if (BeforeRun != null)
                {
                    BeforeRun(this, new GeneticEventArgs(i));
                }

                foreach (var chromosome in Population.Chromosomes)
                {
                    chromosome.Fitness = Evaluator.ComputeFitness(chromosome.Genes);
                }

                Population.Chromosomes = Population.Chromosomes.OrderByDescending(x => x.Fitness).ToList();

                if (BeforeKill != null)
                {
                    BeforeKill(this, EventArgs.Empty);
                }

                Killer.Kill(Population);

                if (AfterKill != null)
                {
                    AfterKill(this, EventArgs.Empty);
                }

                var selected = Selector.Select(Population.Chromosomes);

                if (BeforeCrossOver != null)
                {
                    BeforeCrossOver(this, EventArgs.Empty);
                }

                foreach (var pair in selected)
                {
                    var offspring = CrossOver.CrossOver(pair.Item1, pair.Item2);

                    Population.AddChromosome(offspring);
                }

                if (AfterCrossOver != null)
                {
                    AfterCrossOver(this, EventArgs.Empty);
                }

                if (BeforeMutate != null)
                {
                    BeforeMutate(this, EventArgs.Empty);
                }

                MutateStep(Population);

                if (AfterMutate != null)
                {
                    AfterMutate(this, EventArgs.Empty);
                }

                if (AfterRun != null)
                {
                    AfterRun(this, new GeneticEventArgs(i));
                }

                if (Solution.IsSolution(Population.Best))
                {
                    if (OnSolution != null)
                    {
                        OnSolution(this, EventArgs.Empty);
                    }

                    return;
                }
            }
        }