ECJ-INTEREST-L Archives

April 2007

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Subject:
From:
Chris McCubbin <[log in to unmask]>
Date:
Wed, 18 Apr 2007 11:57:55 -0400
Comments:
Reply-To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (34 lines)
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

ATOM RSS1 RSS2