Esempio n. 1
0
        public void Collect(GeneticAlgorithmStatus status)
        {
            _iterations.Add(new IterationData()
            {
                AverageFitness = status.CurrentPopulation.AvgFitness,
                PopulationFitness = status.CurrentPopulation.Fitness,
                NumberOfIteration = status.IterationNumber,
                BestChromosomeValue = status.BestChromosome.Value,

                SelectionOverhead = status.SelectionOverhead,
                CrossoverOverhead = status.CrossoverOverhead,
                MutationOverhead = status.MutationOverhead,
                RepairOverhead = status.RepairOverhead,
                TransformOverhead = status.TransformOverhead,
                EvaluationOverhead = status.EvaluationOverhead,

                IterationTimeInMillis = status.IterationTimeInMillis
            });

            if (status.BestChromosome.Value > _bestChromosomeValue)
            {
                _bestChromosomeValue = status.BestChromosome.Value;
                _bestChromosome = status.BestChromosome.Clone();
            }
        }
Esempio n. 2
0
 private void AlgorithmStatus(GeneticAlgorithmStatus status)
 {
     Console.CursorTop = 0;
     Console.CursorLeft = 0;
     Console.WriteLine("Iteration: {0}", status.IterationNumber);
     Console.WriteLine("Crossover overhead: {0:0.000}", status.CrossoverOverhead);
     Console.WriteLine("Evaluation overhead: {0:0.000}", status.EvaluationOverhead);
     Console.WriteLine("Mutation overhead: {0:0.000}", status.MutationOverhead);
     Console.WriteLine("Repair overhead: {0:0.000}", status.RepairOverhead);
     Console.WriteLine("Population fitness: {0:0.000}", status.CurrentPopulation.Fitness);
     Console.WriteLine("Population avg fitness: {0:0.000}", status.CurrentPopulation.AvgFitness);
     Console.WriteLine("Best population chromosome value: {0:0.000}", status.CurrentPopulation.BestChromosome.Value);
     Console.WriteLine("Best algorithm chromosome value: {0:0.000}", status.BestChromosome.Value);
 }
Esempio n. 3
0
 /// <summary>
 /// Applies final solution to building view model.
 /// </summary>
 private void OnGeneticCompleted(GeneticAlgorithmStatus status)
 {
     CurrentBuilding.SetFenotype(((BinaryChromosome)status.BestChromosome).Genotype.ToFenotype());
     CurrentBuilding.DrawSolution();
 }
Esempio n. 4
0
 private void CollectAlgorithmStatus(GeneticAlgorithmStatus status)
 {
     _statistics.Collect(status);
 }
Esempio n. 5
0
        private void OnReportStatus(GeneticAlgorithmStatus status)
        {
            var pointHelper = new PointHelper(status.IterationNumber);
            AvgFitness.Add(pointHelper.Create(status.CurrentPopulation.AvgFitness));
            BestChromosome.Add(pointHelper.Create(status.BestChromosome.Value));
            Selection.Add(pointHelper.Create(status.SelectionOverhead));
            Crossover.Add(pointHelper.Create(status.CrossoverOverhead));
            Mutation.Add(pointHelper.Create(status.MutationOverhead));
            Repair.Add(pointHelper.Create(status.RepairOverhead));
            Transform.Add(pointHelper.Create(status.TransformOverhead));
            Evaluation.Add(pointHelper.Create(status.EvaluationOverhead));

            SelectionOverhead = status.SelectionOverhead;
            CrossoverOverhead = status.CrossoverOverhead;
            MutationOverhead = status.MutationOverhead;
            RepairOverhead = status.RepairOverhead;
            TransformOverhead = status.TransformOverhead;
            EvaluationOverhead = status.EvaluationOverhead;

            MaxIterations = status.MaxIterations;
            CurrentIteration = status.IterationNumber;
            PercentCompleted = (CurrentIteration * 100) / MaxIterations;
            BestChromosomeValue = status.BestChromosome.Value;

            ProgressInfo = String.Format("Iteration {0} of {1}", CurrentIteration, MaxIterations);

            OnPropertyChanged("StatisticsChanged");
        }