@Test public void singlePointCrossoverConsistency() { final ISeq<Character> a = CharSeq.toISeq("1234567890"); final ISeq<Character> b = CharSeq.toISeq("ABCDEFGHIJ"); for (int i = 0; i < a.length() + 1; ++i) { final MSeq<Character> ma1 = a.copy(); final MSeq<Character> mb1 = b.copy(); final MSeq<Character> ma2 = a.copy(); final MSeq<Character> mb2 = b.copy(); MultiPointCrossover.crossover(ma1, mb1, new int[]{i}); SinglePointCrossover.crossover(ma2, mb2, i); Assert.assertEquals(ma1, ma2); Assert.assertEquals(mb1, mb2); } }
@Override protected int crossover(final MSeq<G> that, final MSeq<G> other) { assert that.length() == other.length(); final int n = min(that.length(), other.length()); final int k = min(n, _n); final Random random = RandomRegistry.random(); final int[] points = k > 0 ? Combinatorics.subset(n, k, random) : new int[0]; crossover(that, other, points); return 2; }
MultiPointCrossover extends Crossover<G, C> { @Override protected int crossover(final MSeq<G> that, final MSeq<G> other) { assert that.length() == other.length(); final int n = min(that.length(), other.length()); final int k = min(n, _n); final Random random = RandomRegistry.random(); final int[] points = k > 0 ? Combinatorics.subset(n, k, random) : new int[0]; crossover(that, other, points); return 2; } }
MultiPointCrossover extends Crossover<G, C> { @Override protected int crossover(final MSeq<G> that, final MSeq<G> other) { assert that.length() == other.length(); final int n = min(that.length(), other.length()); final int k = min(n, _n); final Random random = RandomRegistry.random(); final int[] points = k > 0 ? Combinatorics.subset(n, k, random) : new int[0]; crossover(that, other, points); return 2; } MultiPointCrossover(final double probability, final int n);  MultiPointCrossover(final double probability);  MultiPointCrossover(final int n);  MultiPointCrossover(); }
MultiPointCrossover extends Crossover<G, C> { @Override protected int crossover(final MSeq<G> that, final MSeq<G> other) { assert that.length() == other.length(); final int n = min(that.length(), other.length()); final int k = min(n, _n); final Random random = RandomRegistry.random(); final int[] points = k > 0 ? Combinatorics.subset(n, k, random) : new int[0]; crossover(that, other, points); return 2; } MultiPointCrossover(final double probability, final int n);  MultiPointCrossover(final double probability);  MultiPointCrossover(final int n);  MultiPointCrossover(); int crossoverPointCount(); @Override String toString(); }
MultiPointCrossover extends Crossover<G, C> { @Override protected int crossover(final MSeq<G> that, final MSeq<G> other) { assert that.length() == other.length(); final int n = min(that.length(), other.length()); final int k = min(n, _n); final Random random = RandomRegistry.random(); final int[] points = k > 0 ? Combinatorics.subset(n, k, random) : new int[0]; crossover(that, other, points); return 2; } MultiPointCrossover(final double probability, final int n);  MultiPointCrossover(final double probability);  MultiPointCrossover(final int n);  MultiPointCrossover(); int crossoverPointCount(); @Override String toString();  }