public Phenotype GenotypeToPhenotype() { Phenotype phenotype = new Phenotype(numberOfFurniture, maxCountOfOneKindOfFurniture+1); int[,] matrixOfPhenotype = phenotype.getPhenotype(); for (int allele=0; allele<genotype.Count;allele++) { matrixOfPhenotype[allele,genotype[allele]] = 1; } phenotype.setPhenotype(matrixOfPhenotype); return phenotype; }
public Individual(int _numberOfFurniture, int _maxCountOfOneKindOfFurniture, List<AdditionalInformation> _additionalInformationAboutIndividual,Random _randomCount,double _maxVolume,double _maxCost) { numberOfFurniture = _numberOfFurniture; maxCountOfOneKindOfFurniture = _maxCountOfOneKindOfFurniture; additionalInformationAboutIndividual = _additionalInformationAboutIndividual; randomCount = _randomCount; maxVolume = _maxVolume; maxCost = _maxCost; do { genotypeOfIndividual = new Genotype(numberOfFurniture, maxCountOfOneKindOfFurniture, randomCount); individual = genotypeOfIndividual.FormRandomGenotype(); } while (checkForAllowabilityInVolume() || checkForAllowabilityInCost()); phenotypeOfIndividual = genotypeOfIndividual.GenotypeToPhenotype(); CountPCommon(); CountSCommon(); }