public override List<IGEPOrganism> Execute(IGEPEnvironment environment)
        {
            var dna = new GEPDNA();
            var allele = new GEPAllele(dna);
            var main = new GEPGene(environment: environment);
            main.Add(allele);

            var chromosome = new GEPChromosome(environment: environment, main: main);

            var organism = new GEPOrganism(environment: environment) { chromosome };
            organism.Parent = environment;

            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                allele.DNA.AddRandomNucleotide();




            /*
            var testAllele = new GEPAllele(new GEPDNA());
            var testGene = new GEPGene(environment: environment);
            testGene.Add(testAllele);
            main.Add(testGene);
            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                testAllele.DNA.AddRandomNucleotide();

            var test2Allele = new GEPAllele(new GEPDNA());
            var test2Gene = new GEPGene(environment: environment);
            test2Gene.Add(test2Allele);
            main.Add(test2Gene);
            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                test2Allele.DNA.AddRandomNucleotide();

            var test3Allele = new GEPAllele(new GEPDNA());
            var test3Gene = new GEPGene(environment: environment);
            test3Gene.Add(test3Allele);
            test2Gene.Add(test3Gene);
            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                test3Allele.DNA.AddRandomNucleotide();

            var test4Allele = new GEPAllele(new GEPDNA());
            var test4Gene = new GEPGene(environment: environment);
            test4Gene.Add(test4Allele);
            main.Add(test4Gene);
            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                test4Allele.DNA.AddRandomNucleotide();

            var test5Allele = new GEPAllele(new GEPDNA());
            var test5Gene = new GEPGene(environment: environment);
            test5Gene.Add(test5Allele);
            test3Gene.Add(test5Gene);
            for (var i = 0; i < environment.GeneticCode.DNALength; i++)
                test5Allele.DNA.AddRandomNucleotide();
            */


            return new List<IGEPOrganism>() { organism };
        }
예제 #2
0
 protected GEPOrganismBase(IGEPEnvironment environment, IEnumerable<IGEPChromosome> collection)
     : base(collection: collection)
 {
     this.GlobalRegistry = new Registry(identifier: environment.GlobalRegistryIdentifier, registryType: RegistryType.Global, readOnly: false);
     this.ResultsRegistry = new Registry(identifier: environment.ResultsRegistryIdentifier, registryType: RegistryType.Result, readOnly: false);
 }
예제 #3
0
        protected GEPOrganismBase(IGEPEnvironment environment)
            : this(environment: environment, collection: new IGEPChromosome[] { })
        {

        }
 /// <summary>
 /// Creates (i.e. initializes) one or more IGEPOrganisms.
 /// </summary>
 /// <param name="environment"></param>
 /// <returns></returns>
 public abstract List<IGEPOrganism> Execute(IGEPEnvironment environment);
예제 #5
0
 private IGEPGene CreateGeneFromGenomeUnit(IGEPEnvironment gepEnvironment, IGenomeUnit unit)
 {
     var gene = new GEPGene(environment: gepEnvironment);
     gene.Add(unit.ActiveAllele);
     foreach (var inactiveAllele in unit.InactiveAlleles)
         gene.Add(inactiveAllele);
     return gene;
 }
예제 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="main">The Main() IGene that will be executed when this IChromosome
 /// is executed.</param>
 /// <param name="environment"></param>
 public GEPChromosome(IGEPEnvironment environment, IGEPGene main)
     : base(environment: environment, main:main)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="main">The Main() IGene that will be executed when this IChromosome
 /// is executed.</param>
 /// <param name="environment"></param>
 protected GEPChromosomeBase(IGEPEnvironment environment, IGEPGene main)
 {
     this.Main = main;
     this.Main.Parent = this;
     this.LocalGlobalRegistry = new Registry(identifier: environment.LocalGlobalRegistryIdentifier, registryType: RegistryType.LocalGlobal, readOnly: false);
 }