@Test public void crossoverAll1() { final CharSeq chars = CharSeq.of("a-zA-Z"); final ISeq<CharacterGene> g1 = ISeq.of(CharacterChromosome.of(chars, 20)); final ISeq<CharacterGene> g2 = ISeq.of(CharacterChromosome.of(chars, 20)); final MultiPointCrossover<CharacterGene, Double> crossover = new MultiPointCrossover<>(2000); final int[] points = new int[g1.length()]; for (int i = 0; i < points.length; ++i) { points[i] = i; } final MSeq<CharacterGene> ms1 = g1.copy(); final MSeq<CharacterGene> ms2 = g2.copy(); crossover.crossover(ms1, ms2); }
@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();  }