コード例 #1
0
ファイル: Gene.cs プロジェクト: ERGeorgiev/TrAIngle
 public Gene(Gene <T> source)
 {
     this.settings  = source.settings;
     this.functions = source.functions;
     this.Allele    = new List <T>(source.Allele.Count);
     this.Allele    = functions.allelesDeepCopy(source.Allele);
     this.Fitness   = 0;
 }
コード例 #2
0
ファイル: Gene.cs プロジェクト: ERGeorgiev/TrAIngle
        public Gene(int size, GenomeFunctions <T> functions, GenomeSettings settings, bool initGenes = true)
        {
            this.settings  = settings;
            this.functions = functions;
            this.Allele    = new List <T>(size);
            this.Fitness   = 0;

            if (initGenes == true)
            {
                InitGenes();
            }
        }
コード例 #3
0
ファイル: Genome.cs プロジェクト: ERGeorgiev/TrAIngle
        public Genome(int genomeSize, int geneSize, GenomeFunctions <T> functions, GenomeSettings settings = null)
        {
            if (settings == null)
            {
                this.settings = new GenomeSettings(genomeSize);
            }
            else
            {
                this.settings = settings;
            }
            this.Generation = 1;
            this.Genes      = new List <Gene <T> >(genomeSize);
            this.geneSize   = geneSize;
            this.functions  = functions;

            for (int i = 0; i < Genes.Capacity; i++)
            {
                Genes.Add(new Gene <T>(geneSize, functions, settings));
            }
        }