Let's assume for simplicity that every one of your trees uses the same GPTreeConstraints, hence the same types and the same GPFunctionSet. Then what I'd do is subclass GPIndividual to make sure that you have only ONE slot in your trees array, with a single prototypical individual. Then make a new GPSpecies subclass and override newIndividual so that after cloning the prototype it randomly changes the size of the array and copies element zero into all the other slots, then calls buildTree on each of the slots.
Okay, so that's initialization. Now you have to deal with breeding. If all you want to do for crossover is pick ONE tree from each individual, arbitrarily chosen, and cross them over, then ec/gp/koza/Crossover should already work fine. Likewise for mutation. But you probably will want to design a custom mutator which also changes the number of trees or rearranges them, I dunno, depends on your problem.
As to assessment: you'll have to evaluate the trees as you see fit in your GPProblem subclass.
On Feb 20, 2014, at 11:46 AM, Xiaomeng Ye <[log in to unmask]> wrote:
> 1. I would suggest subclass the Individual class. YourIndividual class stores a number indicating number of trees, and ofc, bunch of trees.
> 2. 3. I believe you need to write your own crossover for that purpose. And you can do so. You should be able to find good clues in subclasses of BreedingPipeline. http://cs.gmu.edu/~eclab/projects/ecj/docs/classdocs/index.html.
> On Thu, Feb 20, 2014 at 9:40 AM, Emre AYDOĞAN <[log in to unmask]> wrote:
> Hi, I want to ask some questions about genetic programming.
> Firstly, (1)Can each Individual classes separately hold trees in different number?
> So, first Individual holds 3 trees, second Individual holds 6 trees, ..., thirtieth
> Individual holds 10 trees and etc. Is this possible?
> if this is possible, in default crossover class, for example (2)will the crossover
> be between first Individual's first tree and thirtieth Individual's first tree? or
> (3)can the crossover be first Individual's third tree and thirtieth Individual's sixth
> if the default crossover class can't do like this, can i manually write my own
> Crossover class that do crossover like i said in (3) questions?