Subject: | |
From: | |
Reply To: | |
Date: | Fri, 27 Jul 2007 15:15:06 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Jul 27, 2007, at 2:28 PM, Peter Walker wrote:
> 1) (Traditional mutation): select a random node and remove it
> (along with all its children) and replace it by a randomly
> generated subtree and subtree root.
This is ec.gp.koza.Mutation
> The other two schemes I would like to implement are based on “point-
> mutation”. Both point-mutation schemes would start out by selecting
> a node and generate a random node (e.g. symbol1) to replace it.
> Symbol1 would be checked to see whether it is of the same arity as
> the node. If it is, then the node would be replaced by symbol1. If
> they are not of the same arity, then we would either:
>
> 2) Pick another symbol until we find one of the same arity; OR
>
> 3) Remove the node and replace it with a new subtree using
> symbol1 as the root.
You'll need to make a custom mutator for this that FIRST picks a
replacement and THEN decides on what to do (#2 or #3). However:
- ec.gp.breed.MutateOneNodePipeline will pick another node guaranteed
to be of the same arity (and type equivalence) and replace the node
with the new node. This is roughly equivalent to #2, as you've noted.
- #1 and #3 are roughly equivalent, it'd seem.
So I think you'll be writing a custom mutator -- take a look at the
code of these classes to get an idea about how to go about doing this
(it's nontrivial but doable!)
Sean
|
|
|