Sender: |
|
Date: |
Wed, 28 Jun 2006 10:29:09 -0400 |
MIME-version: |
1.0 (Apple Message framework v750) |
Reply-To: |
|
Content-type: |
text/plain; charset=US-ASCII; delsp=yes; format=flowed |
Subject: |
|
From: |
|
In-Reply-To: |
|
Content-transfer-encoding: |
7bit |
Comments: |
|
Parts/Attachments: |
|
|
On Jun 28, 2006, at 10:02 AM, Stefan Wappler wrote:
> I'm interested in initializing the initial population by using
> randomly generated individuals at the one hand (using grow, half,
> or uniform), and by reusing individuals from previous optimizations
> on the other hand. Is this basically possible? Is there any
> documentation about seeding?
Not much, but we're here. What do you want to know?
It works like this:
1. ECJ cals Initializer.initialPopulation(...)
2. Initializer.initialPopulation(...) calls Population.populate(...)
3. Population(...) calls Subpopulation.populate(...)
4. Subpopulation.populate(...) either generates random individuals or
loads from a file
All you have to do is make a subclass of Subpopulation, override the
populate method to fill the subpopulation as you like, and set the
parameter pop.subpop.n=your.new.SubpopulationClassname for each
subpopulation n that your'e using (likely you're only using one, so n
would be 0). The existing code in Subpopulation.populate(...) is
small and easy to understand. Use it to roll your own.
> As far as I know, when specifying pop.subpop.0.file=$myFile the
> initial population will be created from the individuals from the
> given file. Why is it important to have the fitness value also
> saved to this file? The current optimization could use a different
> fitness function and hence this value would be irrelevant.
Because ECJ doesn't know if you need the fitness or not. Almost
certainly you *will* need the fitness, so throwing it out would be
unwelcome. In the case that you want a different fitness, you can
just replace it on initialization; override
Initializer.initialPopulation(...) to call super, and then change the
fitness as you like.
> Furthermore, I'd like to have an initial population containing 50
> individuals. The seeding file contains only 10 individuals. How can
> I specify that the remaining 40 individuals shall be generated
> using a built-in tree builder (such as grow)?
You can't: you'll need to write that code, but it's easy. See the
discussion above.
Sean
|
|
|