AI::Genetic::OpSelection - A class that implements various selection operators.
See AI::Genetic.
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)
The following selection operators are defined:
Here, the probability of an individual being selected is proportional to its fitness score. The following methods are defined:
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.
This method selects N individuals. N defaults to 2. Note that the same individual can be selected multiple times.
This method selects N unique individuals. N defaults to 2. Any individual can be selected only once per call to this method.
Here, N individuals are randomly selected, and the fittest one of them is returned. The following method is defined:
N defaults to 2. Note that only one individual is returned per call to this method.
Here, N individuals are randomly selected and returned. The following method is defined:
N defaults to 1.
Here, the fittest N individuals of the whole population are returned. The following method is defined:
Written by Ala Qumsieh aqumsieh@cpan.org.
(c) 2003,2004 Ala Qumsieh. All rights reserved. This module is distributed under the same terms as Perl itself.
To install AI::Genetic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::Genetic
CPAN shell
perl -MCPAN -e shell install AI::Genetic
For more information on module installation, please visit the detailed CPAN module installation guide.