EvolvingObjects
|
apply orderXover on two chromosomes. More...
#include <eoOrderXover.h>
Public Member Functions | |
virtual std::string | className () const |
The class name. | |
bool | operator() (Chrom &_chrom1, Chrom &_chrom2) |
Private Member Functions | |
void | cross (Chrom &_chrom1, Chrom &_chrom2, Chrom &_child, char _direction, unsigned _cut1, unsigned _cut2) |
apply orderXover on two chromosomes.
Example: With 2 parents p1= [1,2,4,3,6,5], p2= [4,5,3,1,6,2] It applies a random cut between ("|") two indices. Example: the second element and the fourth: p1 : [1|2,4,3|6,5] and p2 : [4|5,3,1|6,2] generate two children: c1 = [2,4,3,6,5,1] 2,4,3 taken from p1 and 6,5,1 from p2 c2 = [5,3,1,6,2,4] 5,3,1 taken from p2 and 6,2,4 from p1
Definition at line 26 of file eoOrderXover.h.
bool eoOrderXover< Chrom >::operator() | ( | Chrom & | _chrom1, |
Chrom & | _chrom2 | ||
) | [inline, virtual] |
_chrom1 | The first chromosome which will be crossed with chrom2. |
_chrom2 | The second chromosome which will be crossed with chrom1. |
Implements eoBF< Chrom &, Chrom &, bool >.
Definition at line 37 of file eoOrderXover.h.
References eoOrderXover< Chrom >::cross(), eoRng::flip(), and eoRng::random().
void eoOrderXover< Chrom >::cross | ( | Chrom & | _chrom1, |
Chrom & | _chrom2, | ||
Chrom & | _child, | ||
char | _direction, | ||
unsigned | _cut1, | ||
unsigned | _cut2 | ||
) | [inline, private] |
_chrom1 | The first parent chromosome. |
_chrom2 | The second parent chromosome. |
_child | The result chromosome. |
_direction | The direction of the OrderXover (left: -1 or right: 1) |
_cut1 | index of the first cut |
_cut2 | index of the second cut |
Definition at line 64 of file eoOrderXover.h.
Referenced by eoOrderXover< Chrom >::operator()().