Package org.opt4j.operators.neighbor
Class NeighborPermutationSwap
- java.lang.Object
-
- org.opt4j.operators.neighbor.NeighborPermutationSwap
-
- All Implemented Interfaces:
org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.PermutationGenotype<?>>
,Neighbor<org.opt4j.core.genotype.PermutationGenotype<?>>
,NeighborPermutation
public class NeighborPermutationSwap extends java.lang.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 in1 2 7 4 5 6 3 8
.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Random
random
-
Constructor Summary
Constructors Constructor Description NeighborPermutationSwap(org.opt4j.core.common.random.Rand random)
Constructs aNeighborPermutationSwap
operator for thePermutationGenotype
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
neighbor(org.opt4j.core.genotype.PermutationGenotype<?> genotype)
Moves theGenotype
to a neighbor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opt4j.operators.neighbor.Neighbor
getOperatorType
-
-
-
-
Constructor Detail
-
NeighborPermutationSwap
@Inject public NeighborPermutationSwap(org.opt4j.core.common.random.Rand random)
Constructs aNeighborPermutationSwap
operator for thePermutationGenotype
.- Parameters:
random
- the random number generator
-
-
Method Detail
-
neighbor
public void neighbor(org.opt4j.core.genotype.PermutationGenotype<?> genotype)
Description copied from interface:Neighbor
Moves theGenotype
to a neighbor.
-
-