| Language Reference |
sets the crossover operator for a genetic algorithm optimization
c1= p1[1,1:k] || p2[1,k+1:n];
c2= p2[1,1:k] || p1[1,k+1:n];
x2 = a * p2 + (1-a) * p1;
c1 = p1[1,1:k] || x2[1,k+1:n];
x1 = a * p1 + (1-a) * p2
c2 = p2[1,1:k] || x1[1,k+1:n];
Note that for
c1 = p1[1,1:k1] || p2[1,k1+1:k2] || p1[1,k2+1:n];
c2 = p2[1,1:k1] || p1[1,k1+1:k2] || p2[1,k2+1:n];
For real vector encoding, you can specify an additional
parameter,
x2 = a * p2 + (1-a) * p1;
c1 = p1[1,1:k1] || x2[1,k1+1:k2] || p1[1,k2+1:n];
x1 = a * p1 + (1-a) * p2;
c2 = p2[1,1:k1] || x1[1,k1+1:k2] || p2[1,k2+1:n];
Note that for
c1 = a * p1 + (1-a) * p2;
c2 = a * p2 + (1-a) * p1;
where a is a random number between 0 and 1. For integer encoding, each component is rounded off to the nearest integer. It has the
advantage that it always produces feasible offspring for a
convex solution space. A disadvantage of this operator is that it
tends to produce offspring toward the interior of the search
region, so that it can be less effective if the optimum lies on
or near the search region boundary.
c1 = a * (p2 - p1) + p2;
where p2 is the parent with the better objective value, and a is a random
number between 0 and 1. The second offspring is
computed as in the arithmetic operator, as follows:
c2 = (1 - a) * p1 + a * p2;
This operator is unusual in that it uses the
objective value. It has the advantage of directing
the search in a promising direction, and automatically fine-tuning
the search in an area where solutions are clustered. If upper and lower
bound constraints are specified in the GAINIT call,
the offspring are checked against the bounds, and any component outside
its bound is set equal to that bound.
p1 = {1 2|3 4 5 6|7 8 9};
p2 = {8 7|9 3 4 1|2 5 6};
The first step is to cross the selected segments ( . indicates
positions yet to be determined):
c1 = {. . 9 3 4 1 . . .};
c2 = {. . 3 4 5 6 . . .};
Next, define a mapping according to the two selected segments, as
follows:
9-3, 3-4, 4-5, 1-6
Next, fill in the positions where there is no conflict from the
corresponding parent:
c1 = {. 2 9 3 4 1 7 8 .};
c2 = {8 7 3 4 5 6 2 . .};
Last, fill in the remaining positions from the subsequence
mapping. In this case, for the first child
c1 = {6 2 9 3 4 1 7 8 5};
c2 = {8 7 3 4 5 6 2 9 1};
This operator tends to maintain similarity of both the absolute
position and relative ordering of the sequence elements, and is useful for
a wide range of sequencing problems.
p1 = {1 2|3 4 5 6|7 8 9};
p2 = {8 7|9 3 4 1|2 5 6};
c1 = {. . 3 4 5 6 . . .};
c2 = {. . 9 3 4 1 . . .};
Starting at the second cutpoint, the elements of p2
are in the following order (cycling back to the beginning):
2 5 6 8 7 9 3 4 1
After removing 3, 4, 5 and 6, which have already been placed in
c1, you have the following:
2 8 7 9 1
Placing these back in order, starting at the second cutpoint, yields
the following:
c1 = {9 1 3 4 5 6 2 8 7};
Applying this logic to c2 yields the following:
c2 = {5 6 9 3 4 1 7 8 2};
This operator maintains the similarity of the relative
order, or adjacency, of the sequence elements of the parents.
It is especially effective for circular path-oriented optimizations, such as the
traveling salesman problem.
p1 = {1 2 3 4 5 6 7 8 9};
p2 = {8 7 9 3 4 1 2 5 6};
For the first child, pick the first element from the first parent, as
follows:
c1 = {1 . . . . . . . .};
To maintain the condition that the position of each
element value must come from one of the parents,
the position of the '8' value must come from p1,
because the '8' position in p2 is already taken by the '1'
in c1:
c1 = {1 . . . . . . 8 .};
Now the position of '5' must come from p1, and so on until the
process returns to the first position:
c1 = {1 . 3 4 5 6 . 8 9};
At this point, choose the remaining element positions from p2:
c1 = {1 7 3 4 5 6 2 8 9};
For the second child, starting with the first element from
the second parent, similar logic produces the following:
c2 = {8 2 9 3 4 1 7 5 6};
This operator is most useful when the absolute position
of the elements is of most importance to the objective value.
See the GASETUP function for an example.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.