Esempio n. 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)}");
        }
Esempio n. 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);
     }
 }
Esempio n. 3
0
        public override IFitness CreateFitness()
        {
            this.fitness = new FitnessGlassUnit(this.inputData, this.settings);

            return(this.fitness);
        }