R
- the representation type of the solution to be recombinedpublic class UniformRecombine<R extends java.io.Serializable> extends java.lang.Object implements Recombination<VectorSolution<R>>
Recombination strategy that uniformly swaps two solutions representation with a probability of 0.5.
Modifier and Type | Class and Description |
---|---|
static interface |
io.vavr.Lambda.Memoized |
Modifier and Type | Field and Description |
---|---|
private NormalizedDoubleRandomGenerator |
rand |
Constructor and Description |
---|
UniformRecombine(NormalizedDoubleRandomGenerator rand) |
Modifier and Type | Method and Description |
---|---|
default boolean |
isMemoized() |
io.vavr.Tuple2<VectorSolution<R>,VectorSolution<R>> |
recombine(VectorSolution<R> solution1,
VectorSolution<R> solution2) |
protected io.vavr.Tuple2<io.vavr.collection.Array<R>,io.vavr.collection.Array<R>> |
swap(io.vavr.collection.Array<R> representation1,
io.vavr.collection.Array<R> representation2,
int index)
Swaps the representations at the given index.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply
private final NormalizedDoubleRandomGenerator rand
public UniformRecombine(NormalizedDoubleRandomGenerator rand)
public final io.vavr.Tuple2<VectorSolution<R>,VectorSolution<R>> recombine(VectorSolution<R> solution1, VectorSolution<R> solution2)
recombine
in interface Recombination<VectorSolution<R extends java.io.Serializable>>
protected final io.vavr.Tuple2<io.vavr.collection.Array<R>,io.vavr.collection.Array<R>> swap(io.vavr.collection.Array<R> representation1, io.vavr.collection.Array<R> representation2, int index)
Swaps the representations at the given index.
This method purpose is to allow efficient unboxing in case of representations of primitives. Subclasses can then cast the given representation in the corresponding fastutil collection.
representation1
- the first representationrepresentation2
- the second representationindex
- the index at which swapping should occurpublic boolean isMemoized()