/** * Create a new random chromosome. * * @since 4.0 * * @param min the min value of the {@link DoubleGene}s (inclusively). * @param max the max value of the {@link DoubleGene}s (exclusively). * @param lengthRange the allowed length range of the chromosome. The start * of the range is inclusively and the range end exclusively * @throws NullPointerException if one of the arguments is {@code null}. * @throws IllegalArgumentException if the length is smaller than one * * @deprecated Use {@link #of(double, double, IntRange)} instead. */ @Deprecated public DoubleChromosome( final Double min, final Double max, final IntRange lengthRange ) { this(DoubleGene.seq(min, max, lengthRange), lengthRange); _valid = true; }
/** * Create a new random chromosome. * * @since 4.0 * * @param min the min value of the {@link DoubleGene}s (inclusively). * @param max the max value of the {@link DoubleGene}s (exclusively). * @param lengthRange the allowed length range of the chromosome. * @return a new {@code DoubleChromosome} with the given parameter * @throws IllegalArgumentException if the length of the gene sequence is * empty, doesn't match with the allowed length range, the minimum * or maximum of the range is smaller or equal zero or the given * range size is zero. * @throws NullPointerException if the given {@code lengthRange} is * {@code null} */ public static DoubleChromosome of( final double min, final double max, final IntRange lengthRange ) { final ISeq<DoubleGene> genes = DoubleGene.seq(min, max, lengthRange); return new DoubleChromosome(genes, lengthRange); }