当前位置: 首页>>代码示例>>Java>>正文


Java LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME属性的具体用法?Java LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME怎么用?Java LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


在下文中一共展示了LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: crossover

/**
 * {@inheritDoc}
 *
 * @throws MathIllegalArgumentException if the chromosomes are not an instance of {@link AbstractListChromosome}
 * @throws DimensionMismatchException if the length of the two chromosomes is different
 */
@SuppressWarnings("unchecked")
public ChromosomePair crossover(final Chromosome first, final Chromosome second)
    throws DimensionMismatchException, MathIllegalArgumentException {

    if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
        throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
    }
    return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:15,代码来源:CycleCrossover.java

示例2: crossover

/**
 * {@inheritDoc}
 *
 * @throws MathIllegalArgumentException iff one of the chromosomes is
 *   not an instance of {@link AbstractListChromosome}
 * @throws DimensionMismatchException if the length of the two chromosomes is different
 */
@SuppressWarnings("unchecked")
public ChromosomePair crossover(final Chromosome first, final Chromosome second)
    throws DimensionMismatchException, MathIllegalArgumentException {

    if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
        throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
    }
    return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:16,代码来源:UniformCrossover.java

示例3: crossover

/**
 * Performs one point crossover. A random crossover point is selected and the
 * first part from each parent is copied to the corresponding child, and the
 * second parts are copied crosswise.
 *
 * Example:
 * <pre>
 * -C- denotes a crossover point
 *                   -C-                                 -C-
 * p1 = (1 0 1 0 0 1  | 0 1 1)    X    p2 = (0 1 1 0 1 0  | 1 1 1)
 *      \------------/ \-----/              \------------/ \-----/
 *            ||         (*)                       ||        (**)
 *            VV         (**)                      VV        (*)
 *      /------------\ /-----\              /------------\ /-----\
 * c1 = (1 0 1 0 0 1  | 1 1 1)    X    c2 = (0 1 1 0 1 0  | 0 1 1)
 * </pre>
 *
 * @param first first parent (p1)
 * @param second second parent (p2)
 * @return pair of two children (c1,c2)
 * @throws MathIllegalArgumentException iff one of the chromosomes is
 *   not an instance of {@link AbstractListChromosome}
 * @throws DimensionMismatchException if the length of the two chromosomes is different
 */
@SuppressWarnings("unchecked") // OK because of instanceof checks
public ChromosomePair crossover(final Chromosome first, final Chromosome second)
    throws DimensionMismatchException, MathIllegalArgumentException {

    if (! (first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
        throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
    }
    return crossover((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:33,代码来源:OnePointCrossover.java

示例4: crossover

/**
 * Performs a N-point crossover. N random crossover points are selected and are used
 * to divide the parent chromosomes into segments. The segments are copied in alternate
 * order from the two parents to the corresponding child chromosomes.
 *
 * Example (2-point crossover):
 * <pre>
 * -C- denotes a crossover point
 *           -C-       -C-                         -C-        -C-
 * p1 = (1 0  | 1 0 0 1 | 0 1 1)    X    p2 = (0 1  | 1 0 1 0  | 1 1 1)
 *      \----/ \-------/ \-----/              \----/ \--------/ \-----/
 *        ||      (*)       ||                  ||      (**)       ||
 *        VV      (**)      VV                  VV      (*)        VV
 *      /----\ /--------\ /-----\             /----\ /--------\ /-----\
 * c1 = (1 0  | 1 0 1 0  | 0 1 1)    X   c2 = (0 1  | 1 0 0 1  | 0 1 1)
 * </pre>
 *
 * @param first first parent (p1)
 * @param second second parent (p2)
 * @return pair of two children (c1,c2)
 * @throws MathIllegalArgumentException iff one of the chromosomes is
 *   not an instance of {@link AbstractListChromosome}
 * @throws DimensionMismatchException if the length of the two chromosomes is different
 */
@SuppressWarnings("unchecked") // OK because of instanceof checks
public ChromosomePair crossover(final Chromosome first, final Chromosome second)
    throws DimensionMismatchException, MathIllegalArgumentException {

    if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
        throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
    }
    return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:33,代码来源:NPointCrossover.java


注:本文中的org.apache.commons.math3.exception.util.LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。