NAME

AI::Genetic::OpSelection - A class that implements various selection operators.

SYNOPSIS

See AI::Genetic.

DESCRIPTION

This package implements a few selection mechanisms that can be used in user-defined strategies. The methods in this class are to be called as static class methods, rather than instance methods, which means you must call them as such:

AI::Genetic::OpSelection::MethodName(arguments)

SELECTION OPERATORS AND THEIR METHODS

The following selection operators are defined:

Roulette Wheel

Here, the probability of an individual being selected is proportional to its fitness score. The following methods are defined:

initWheel(population)

This method initializes the roulette wheel. It expects an anonymous list of individuals, as returned by the people() method as described in "CLASS METHODS" in AI::Genetic. This must be called only once.

roulette(?N?)

This method selects N individuals. N defaults to 2. Note that the same individual can be selected multiple times.

rouletteUnique(?N?)

This method selects N unique individuals. N defaults to 2. Any individual can be selected only once per call to this method.

Tournament

Here, N individuals are randomly selected, and the fittest one of them is returned. The following method is defined:

tournament(?N?)

N defaults to 2. Note that only one individual is returned per call to this method.

Random

Here, N individuals are randomly selected and returned. The following method is defined:

random(?N?)

N defaults to 1.

Fittest

Here, the fittest N individuals of the whole population are returned. The following method is defined:

topN(?N?)

N defaults to 1.

AUTHOR

Written by Ala Qumsieh aqumsieh@cpan.org.

COPYRIGHTS

(c) 2003,2004 Ala Qumsieh. All rights reserved. This module is distributed under the same terms as Perl itself.