Exemple #1
0
 public TSPIndividual(TSPIndividual father)
 {
     genome = new List <TSPGene>();
     foreach (var gene in father.genome)
     {
         genome.Add(new TSPGene(gene));
     }
     Mutate();
 }
Exemple #2
0
        public TSPIndividual(TSPIndividual father, TSPIndividual mother)
        {
            genome = new List <TSPGene>();
            int cuttingPoint = Parameters.RandomGenerator.Next(father.genome.Count);

            foreach (var gene in father.genome.Take(cuttingPoint))
            {
                genome.Add(new TSPGene(gene));
            }
            foreach (var gene in mother.genome)
            {
                if (!genome.Contains(gene))
                {
                    genome.Add(gene);
                }
            }
            Mutate();
        }