|
AI::Genetic::OpCrossover - A class that implements various crossover operators.
|
AI::Genetic::OpCrossover - A class that implements various crossover operators.
See the AI::Genetic manpage.
This package implements a few crossover 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::OpCrossover::MethodName(arguments)
The following crossover operators are defined:
- Single Point
-
In single point crossover, a point is selected along the choromosomes of both parents.
The chromosomes are then split at that point, and the head of one parent chromosome is
joined with the tail of the other and vice versa, creating two child chromosomes.
The following method is defined:
- vectorSinglePoint(Xprob, parent1, parent2)
-
The first argument is the crossover rate. The second and third arguments are anonymous
lists that define the genes
of the parents (not AI::Genetic::Individual objects, but the return value of the genes()
method in scalar context).
If mating occurs, two anonymous lists of genes are returned corresponding to the two
new children. If no mating occurs, 0 is returned.
- Two Point
-
In two point crossover, two points are selected along the choromosomes of both parents.
The chromosomes are then cut at those points, and the middle parts are swapped,
creating two child chromosomes. The following method is defined:
- vectorTwoPoint(Xprob, parent1, parent2)
-
The first argument is the crossover rate. The second and third arguments are anonymous
lists that define the genes
of the parents (not AI::Genetic::Individual objects, but the return value of the genes()
method in scalar context).
If mating occurs, two anonymous lists of genes are returned corresponding to the two
new children. If no mating occurs, 0 is returned.
- Uniform
-
In uniform crossover, two child chromosomes are created by looking at each gene in both
parents, and randomly selecting which one to go with each child.
The following method is defined:
- vectorUniform(Xprob, parent1, parent2)
-
The first argument is the crossover rate. The second and third arguments are anonymous
lists that define the genes
of the parents (not AI::Genetic::Individual objects, but the return value of the genes()
method in scalar context).
If mating occurs, two anonymous lists of genes are returned corresponding to the two
new children. If no mating occurs, 0 is returned.
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.
|
AI::Genetic::OpCrossover - A class that implements various crossover operators.
|