Exemple #1
0
        private static IChromosome ModifyChomosomeAccordingToSettings(ChromosomeGlass chromosome, SettingsOpt settings)
        {
            //
            if (settings.IsSymmetricLaminateUsed)
            {
                chromosome.ReplaceGene(ConstantsOpt.ExtThk1GeneNo, chromosome.GetGene(ConstantsOpt.ExtThk2GeneNo));
                chromosome.ReplaceGene(ConstantsOpt.IntThk1GeneNo, chromosome.GetGene(ConstantsOpt.IntThk2GeneNo));
                chromosome.ReplaceGene(ConstantsOpt.MiddleThk1GeneNo, chromosome.GetGene(ConstantsOpt.MiddleThk2GeneNo));
            }

            // Set monolith
            if (settings.ExternalLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Monolithic)
            {
                chromosome.ReplaceGene(ConstantsOpt.ExtMonolithGeneNo, new Gene(GlassPaneType.Monolithic));
            }

            if (settings.InternalLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Monolithic)
            {
                chromosome.ReplaceGene(ConstantsOpt.IntMonolithGeneNo, new Gene(GlassPaneType.Monolithic));
            }

            if (settings.MiddleLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Monolithic)
            {
                chromosome.ReplaceGene(ConstantsOpt.MiddleMonolithGeneNo, new Gene(GlassPaneType.Monolithic));
            }

            // Set laminate
            if (settings.ExternalLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Laminated)
            {
                chromosome.ReplaceGene(ConstantsOpt.ExtMonolithGeneNo, new Gene(GlassPaneType.Laminated));
            }

            if (settings.InternalLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Laminated)
            {
                chromosome.ReplaceGene(ConstantsOpt.IntMonolithGeneNo, new Gene(GlassPaneType.Laminated));
            }

            if (settings.MiddleLaminateOrMonolithic == GlassPaneTypeConsideredInOptimization.Laminated)
            {
                chromosome.ReplaceGene(ConstantsOpt.MiddleMonolithGeneNo, new Gene(GlassPaneType.Laminated));
            }

            return(chromosome);
        }
Exemple #2
0
        public static FormInputData UpdateInputDataFromChromosome(ChromosomeGlass chromosome, FormInputData inputData)
        {
            var updatedInput = inputData;

            var genes = chromosome.GetGenes();

            updatedInput.ExternalLayer1Thickness = ((GlassThickness)genes[ConstantsOpt.ExtThk1GeneNo].Value).GetThicknessInMeters();
            updatedInput.ExternalLayer2Thickness = ((GlassThickness)genes[ConstantsOpt.ExtThk2GeneNo].Value).GetThicknessInMeters();
            updatedInput.MiddleLayer1Thickness   = ((GlassThickness)genes[ConstantsOpt.MiddleThk1GeneNo].Value).GetThicknessInMeters();
            updatedInput.MiddleLayer2Thickness   = ((GlassThickness)genes[ConstantsOpt.MiddleThk2GeneNo].Value).GetThicknessInMeters();
            updatedInput.InternalLayer1Thickness = ((GlassThickness)genes[ConstantsOpt.IntThk1GeneNo].Value).GetThicknessInMeters();
            updatedInput.InternalLayer2Thickness = ((GlassThickness)genes[ConstantsOpt.IntThk2GeneNo].Value).GetThicknessInMeters();
            updatedInput.ExternalIsMonolithic    = ((GlassPaneType)genes[ConstantsOpt.ExtMonolithGeneNo].Value) == GlassPaneType.Monolithic;
            updatedInput.InternalIsMonolithic    = ((GlassPaneType)genes[ConstantsOpt.IntMonolithGeneNo].Value) == GlassPaneType.Monolithic;
            updatedInput.MiddleIsMonolithic      = ((GlassPaneType)genes[ConstantsOpt.MiddleMonolithGeneNo].Value) == GlassPaneType.Monolithic;
            updatedInput.Cavity1Thickness        = ((CavityThickness)genes[ConstantsOpt.Cavity1GeneNo].Value).GetCavityInMeters();
            updatedInput.Cavity2Thickness        = ((CavityThickness)genes[ConstantsOpt.Cavity2GeneNo].Value).GetCavityInMeters();

            return(updatedInput);
        }