Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#CROSSOVER_RATE

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#CROSSOVER_RATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 2
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 3
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 4
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 5
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 6
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 7
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 8
Source File: GeneticAlgorithm.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new genetic algorithm.
 * @param crossoverPolicy The {@link CrossoverPolicy}
 * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
 * @param mutationPolicy The {@link MutationPolicy}
 * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
 * @param selectionPolicy The {@link SelectionPolicy}
 * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
 */
public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
                        final double crossoverRate,
                        final MutationPolicy mutationPolicy,
                        final double mutationRate,
                        final SelectionPolicy selectionPolicy) throws OutOfRangeException {

    if (crossoverRate < 0 || crossoverRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
                                      crossoverRate, 0, 1);
    }
    if (mutationRate < 0 || mutationRate > 1) {
        throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
                                      mutationRate, 0, 1);
    }
    this.crossoverPolicy = crossoverPolicy;
    this.crossoverRate = crossoverRate;
    this.mutationPolicy = mutationPolicy;
    this.mutationRate = mutationRate;
    this.selectionPolicy = selectionPolicy;
}
 
Example 9
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 10
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 11
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 12
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 13
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 14
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}
 
Example 15
Source File: UniformCrossover.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
 *
 * @param ratio the mixing ratio
 * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
 */
public UniformCrossover(final double ratio) throws OutOfRangeException {
    if (ratio < 0.0d || ratio > 1.0d) {
        throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
    }
    this.ratio = ratio;
}