DoubleChromosome extends AbstractBoundedChromosome<Double, DoubleGene> implements
		NumericChromosome<Double, DoubleGene>,
		Serializable { public static DoubleChromosome of(final DoubleGene... genes) { checkGeneRange(Stream.of(genes).map(DoubleGene::range)); return new DoubleChromosome(ISeq.of(genes), IntRange.of(genes.length)); } protected  DoubleChromosome(
		final ISeq<DoubleGene> genes,
		final IntRange lengthRange
	); @Override DoubleChromosome newInstance(final ISeq<DoubleGene> genes); @Override DoubleChromosome newInstance(); DoubleChromosome map(final Function<? super double[], double[]> f); DoubleStream doubleStream(); double[] toArray(final double[] array); double[] toArray(); static DoubleChromosome of(final DoubleGene... genes); static DoubleChromosome of(final Iterable<DoubleGene> genes); static DoubleChromosome of(
		final double min,
		final double max,
		final IntRange lengthRange
	); static DoubleChromosome of(
		final double min,
		final double max,
		final int length
	); static DoubleChromosome of(
		final DoubleRange range,
		final IntRange lengthRange
	); static DoubleChromosome of(final DoubleRange range, final int length); static DoubleChromosome of(final double min, final double max); static DoubleChromosome of(final DoubleRange range);  }
@Test(invocationCount = 20, successPercentage = 95) public void newInstanceDistribution() { using(new Random(12345), r -> { final double min = 0; final double max = 100; final MinMax<Double> mm = MinMax.of(); final Histogram<Double> histogram = Histogram.ofDouble(min, max, 10); for (int i = 0; i < 1000; ++i) { final DoubleChromosome chromosome = DoubleChromosome.of(min, max, 500); for (DoubleGene gene : chromosome) { mm.accept(gene.allele()); histogram.accept(gene.allele()); } } Assert.assertTrue(mm.min().compareTo(0.0) >= 0); Assert.assertTrue(mm.max().compareTo(100.0) <= 100); assertUniformDistribution(histogram); }); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofAmbiguousGenes1() { DoubleChromosome.of( DoubleGene.of(1, 2), DoubleGene.of(3, 4), DoubleGene.of(5, 6) ); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofAmbiguousGenes2() { DoubleChromosome.of( ISeq.of( DoubleGene.of(1, 2), DoubleGene.of(3, 4), DoubleGene.of(5, 6) ) ); }