ec.gp
Interface GPNodeSelector
- All Known Implementing Classes:
- KozaNodeSelector
- public interface GPNodeSelector
- extends Prototype
GPNodeSelector is a Prototype which describes algorithms which
select random nodes out of trees, typically marking them for
mutation, crossover, or whatnot. GPNodeSelectors can cache information
about a tree, as they may receive the pickNode(...) method more than
once on a tree. But this should really only be done if it can be
done relatively efficiently; it's not all that common. A GPNodeSelector
will be called reset() just before it is pressed into service in
selecting nodes from a new tree, which gives it the chance to
reset caches, etc.
pickNode
public GPNode pickNode(EvolutionState s,
int subpopulation,
int thread,
GPIndividual ind,
GPTree tree)
- Picks a node at random from tree and returns it. The tree
is located in ind, which is located in s.population[subpopulation].
This method will be preceded with a call to reset();
afterwards, pickNode(...) may be called several times for the
same tree.
reset
public void reset()
- Resets the Node Selector before a new series of pickNode()
if need be.