コード例 #1
0
ファイル: AlgorithmStatistics.cs プロジェクト: OlekNg/AHMED
        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();
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: OlekNg/AHMED
 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);
 }
コード例 #3
0
ファイル: Calculator.cs プロジェクト: OlekNg/AHMED
 /// <summary>
 /// Applies final solution to building view model.
 /// </summary>
 private void OnGeneticCompleted(GeneticAlgorithmStatus status)
 {
     CurrentBuilding.SetFenotype(((BinaryChromosome)status.BestChromosome).Genotype.ToFenotype());
     CurrentBuilding.DrawSolution();
 }
コード例 #4
0
ファイル: EvacuationSimulation.cs プロジェクト: OlekNg/AHMED
 private void CollectAlgorithmStatus(GeneticAlgorithmStatus status)
 {
     _statistics.Collect(status);
 }
コード例 #5
0
ファイル: Status.cs プロジェクト: OlekNg/AHMED
        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");
        }