Package org.opt4j.operator.neighbor
Class NeighborPermutationSwap
java.lang.Object
org.opt4j.operator.neighbor.NeighborPermutationSwap
- All Implemented Interfaces:
Operator<PermutationGenotype<?>>
,Neighbor<PermutationGenotype<?>>
,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
.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNeighborPermutationSwap
(Rand random) Constructs aNeighborPermutationSwap
operator for thePermutationGenotype
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
neighbor
(PermutationGenotype<?> genotype) Moves theGenotype
to a neighbor.
-
Field Details
-
random
-
-
Constructor Details
-
NeighborPermutationSwap
Constructs aNeighborPermutationSwap
operator for thePermutationGenotype
.- Parameters:
random
- the random number generator
-
-
Method Details