S
- the representation type of the solution to be recombinedpublic class OnePointRecombine<T,S extends Solution<io.vavr.collection.Array<T>>> extends java.lang.Object implements Recombination<S>
Recombines the representations of two binary solutions at a random point.
Modifier and Type | Class and Description |
---|---|
static interface |
io.vavr.Lambda.Memoized |
Modifier and Type | Field and Description |
---|---|
private IntRandomGenerator |
rand |
Constructor and Description |
---|
OnePointRecombine(IntRandomGenerator rand) |
Modifier and Type | Method and Description |
---|---|
default boolean |
isMemoized() |
io.vavr.Tuple2<S,S> |
recombine(S solution1,
S solution2) |
protected <R> 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 IntRandomGenerator rand
public OnePointRecombine(IntRandomGenerator rand)
public final io.vavr.Tuple2<S,S> recombine(S solution1, S solution2)
recombine
in interface Recombination<S extends Solution<io.vavr.collection.Array<T>>>
protected final <R> 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()