Print

Print


Hi Sean,

Your method seems to work. The only difficult thing was determining which
constraint number matched which constraint. To do this I put the following
code in a custom statistics class in the finalStatistics method:

GPInitializer initializer = ((GPInitializer)state.initializer);
GPNodeConstraints[] constraints = initializer.nodeConstraints;
state.output.println("\nNode Constraints",Output.V_NO_GENERAL, popLog);
for (GPNodeConstraints constraint:constraints){
   if (constraint!=null){
      state.output.print("{" + constraint.constraintNumber 
                         + "} : (" ,Output.V_NO_GENERAL, popLog);
      for (GPType childType:constraint.childtypes){
         state.output.print(childType+",",Output.V_NO_GENERAL, popLog);
      }
      state.output.println(")",Output.V_NO_GENERAL, popLog);
    }
}

i.e. I print out every constraint number and match it to the constraint's
child types. This worked well for me because the constraints have unique
child types. 

I'd still like to see an easy way to set one seed individual and randomize
the rest. Right now I am forced to "fake" it by inserting a bunch of empty
trees in the initial population file. Looking at the Subpopulation code it
seems like it wouldn't be too difficult to create new individuals to fill
out the population if the number of individuals in the input file is less
than the subpop size.

Thanks for the help,
Chris