GrowInitialiser implements CreationOperation, Stochastic { public Individual createIndividual() { GEGrammar gram = GEGrammar.getGrammar(this.grammar); Phenotype phenotype = new Phenotype(); int[] codons = new int[this.initChromSize]; GEChromosome chrom = new GEChromosome(this.initChromSize, codons); if (gram.getMaxDerivationTreeDepth() < this.maxDepth) { gram.setMaxDerivationTreeDepth(this.maxDepth); } chrom.setMaxChromosomeLength(gram.getMaxChromosomeLengthByDepth()); Genotype geno = new Genotype(1, chrom); Fitness fitness = new BasicFitness(); GEIndividual gei = new GEIndividual(gram, phenotype, geno, fitness); return gei; } GrowInitialiser(RandomNumberGenerator rng, GEGrammar gegrammar, int maxDepth);  GrowInitialiser(RandomNumberGenerator rng, GEGrammar gegrammar, Properties p); void setRNG(RandomNumberGenerator m); RandomNumberGenerator getRNG(); void setProperties(Properties p); Individual createIndividual(); int getMinDepth(); void setMinDepth(int minDepth); void setMaxDepth(int i); int getMaxDepth(); void doOperation(Individual operand); void doOperation(List<Individual> operands); Genotype getGenotype(int maxLength); boolean grow(NimbleTree<Symbol> dt);  }
@Test public void testCreateIndividual() { System.out.println("createIndividual"); Individual result = gi1.createIndividual(); GEGrammar grammar = (GEGrammar) result.getMapper(); assertEquals(true, grammar.getDerivationString().equals("geva.Mapper.ContextualDerivationTree")); result = gi2.createIndividual(); grammar = (GEGrammar) result.getMapper(); assertEquals(true, grammar.getDerivationString().equals("geva.Mapper.DerivationTree")); }