Function PGAIntegerAlternatingEdgeCrossover
Defined in File integer.c
Function Documentation
-
void PGAIntegerAlternatingEdgeCrossover(PGAContext *ctx, int p1, int p2, int pop1, int c1, int c2, int pop2)
Perform Alternating Edge Crossover on two parent strings producing two children via side-effect.
Description
Note that this function is set in
PGASetUp()as the crossover user function for the integer datatype when selecting partially mapped crossover.The operation produces permutations of the integer genes of both parents. The result is a permutation again for both children.
Note that the original paper [GGRG85] mandates that the search starts with a random position. We start with a random position but keep the absolute position in the child (and don’t copy from the middle of the parent to the start of the child). This may make the crossover work for other problems than just TSP. From the paper it is unclear if edge reversals are possible, we allow them but prefer non-reversed egdes.
Example
Performs crossover on the two parent strings
mandd, producing childrensandb.PGAContext *ctx; int m, d, s, b; ... PGAIntegerAlternatingEdgeCrossover (ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP);
- Parameters:
ctx – context variable
p1 – the first parent string
p2 – the second parent string
pop1 – symbolic constant of the population containing string p1 and p2
c1 – the first child string
c2 – the second child string
pop2 – symbolic constant of the population to contain string c1 and c2
- Returns:
c1 and c2 in population pop2 are modified by side-effect.