Beispiel #1
0
        private static void OutputGenerationResults(OptimizeWindowViewModel viewModel, GeneticAlgorithm ga,
                                                    FormInputData inputData)
        {
            var bestChromosome = (ChromosomeGlass)ga.Population.BestChromosome;
            var bestThickness  = GetBestThicknessMm(bestChromosome);

            FitnessGlassUnit.UpdateInputDataFromChromosome(bestChromosome, inputData);
            LogLine(viewModel, $"Generation: {ga.Population.GenerationsNumber} | Total thickness: {bestThickness}");
            LogLine(viewModel, $"Time: {ga.TimeEvolving:mm\\:ss\\.f} | Buildup: {FormInputData.GetBuildupDescriptionString(inputData)}");
        }
Beispiel #2
0
 private static FormInputData RunOptimization(FormInputData inputData, OptimizeWindowViewModel viewModel,
                                              GeneticAlgorithm ga)
 {
     try
     {
         LogLine(viewModel, "Optimization Started!");
         ga.Start();
         LogLine(viewModel, "Optimization stopped!");
         FitnessGlassUnit.UpdateInputDataFromChromosome((ChromosomeGlass)ga.BestChromosome, inputData);
         return(inputData);
     }
     catch (Exception ex)
     {
         LogLine(viewModel, $"Error: {ex.Message}");
         return(inputData);
     }
 }