EvolvingObjects
eoOrderXover< Chrom > Class Template Reference

apply orderXover on two chromosomes. More...

#include <eoOrderXover.h>

Inheritance diagram for eoOrderXover< Chrom >:
eoQuadOp< Chrom > eoOp< Chrom > eoBF< Chrom &, Chrom &, bool > eoFunctorBase binary_function

List of all members.

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)

Detailed Description

template<class Chrom>
class eoOrderXover< Chrom >

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

Examples:
t-eoOrderXover.cpp.

Definition at line 26 of file eoOrderXover.h.


Member Function Documentation

template<class Chrom>
bool eoOrderXover< Chrom >::operator() ( Chrom &  _chrom1,
Chrom &  _chrom2 
) [inline, virtual]
Returns:
true if the chromosome has changed
Parameters:
_chrom1The first chromosome which will be crossed with chrom2.
_chrom2The 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().

template<class Chrom>
void eoOrderXover< Chrom >::cross ( Chrom &  _chrom1,
Chrom &  _chrom2,
Chrom &  _child,
char  _direction,
unsigned  _cut1,
unsigned  _cut2 
) [inline, private]
Parameters:
_chrom1The first parent chromosome.
_chrom2The second parent chromosome.
_childThe result chromosome.
_directionThe direction of the OrderXover (left: -1 or right: 1)
_cut1index of the first cut
_cut2index of the second cut

Definition at line 64 of file eoOrderXover.h.

Referenced by eoOrderXover< Chrom >::operator()().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends