public class NeighborPermutationSwap extends Object implements NeighborPermutation
Neighbor operator for the PermutationGenotype. Two elements are
selected and swapped.
Given a permutation 1 2 3 4 5 6 7 8, this might result in 1 2
7 4 5 6 3 8.
| Constructor and Description |
|---|
NeighborPermutationSwap(Rand random)
Constructs a
NeighborPermutationSwap operator for the
PermutationGenotype. |
| Modifier and Type | Method and Description |
|---|---|
void |
neighbor(PermutationGenotype<?> genotype)
Moves the
Genotype to a neighbor. |
@Inject public NeighborPermutationSwap(Rand random)
NeighborPermutationSwap operator for the
PermutationGenotype.random - the random number generatorpublic void neighbor(PermutationGenotype<?> genotype)
NeighborGenotype to a neighbor.neighbor in interface Neighbor<PermutationGenotype<?>>genotype - the Genotype to be changed