Пример #1
0
 public Chromosome(Chromosome oldChromosome)
 {
     this.rd         = oldChromosome.rd;
     this._gene      = oldChromosome._gene;
     this.Fitness    = oldChromosome.Fitness;
     this.AbsFitness = oldChromosome.AbsFitness;
 }
Пример #2
0
        public static Chromosome GetHigherChromosome(ResearchDefinitions rd)
        {
            var binGene = "";

            for (int i = 0; i < rd.chromosomeDefinition.ChromosomeLength; i++)
            {
                binGene += '1';
            }
            return(new Chromosome(rd).SetGene(binGene));
        }
Пример #3
0
        public static List <Chromosome> NewRandomPopulation(ResearchDefinitions rd, int chromosomeCount)
        {
            var list = new List <Chromosome>();

            for (var i = 0; i < chromosomeCount; i++)
            {
                list.Add(Chromosome.NewRandomChromosome(rd));
            }
            return(list);
        }
Пример #4
0
 public static Chromosome GetLowestChromosome(ResearchDefinitions rd) => new Chromosome(rd).SetGene("0");
Пример #5
0
 public Chromosome(ResearchDefinitions rd)
 {
     this.rd = rd;
 }
Пример #6
0
 public static Chromosome NewRandomChromosome(ResearchDefinitions rd)
 => new Chromosome(rd)
 {
     Gene = Utils.LongRandom(rd.chromosomeDefinition.GenesCount)
 };