Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE . 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: ListPopulation.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ListPopulation instance.
 *
 * @param chromosomes list of chromosomes in the population
 * @param populationLimit maximal size of the population
 */
public ListPopulation (List<Chromosome> chromosomes, int populationLimit) {
    if (chromosomes.size() > populationLimit) {
        throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
                                            chromosomes.size(), populationLimit, false);
    }
    if (populationLimit < 0) {
        throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
    }

    this.chromosomes = chromosomes;
    this.populationLimit = populationLimit;
}
 
Example 2
Source File: ListPopulation.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ListPopulation instance.
 *
 * @param chromosomes list of chromosomes in the population
 * @param populationLimit maximal size of the population
 */
public ListPopulation (List<Chromosome> chromosomes, int populationLimit) {
    if (chromosomes.size() > populationLimit) {
        throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
                                            chromosomes.size(), populationLimit, false);
    }
    if (populationLimit < 0) {
        throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
    }

    this.chromosomes = chromosomes;
    this.populationLimit = populationLimit;
}
 
Example 3
Source File: ListPopulation.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ListPopulation instance.
 *
 * @param chromosomes list of chromosomes in the population
 * @param populationLimit maximal size of the population
 */
public ListPopulation (List<Chromosome> chromosomes, int populationLimit) {
    if (chromosomes.size() > populationLimit) {
        throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
                                            chromosomes.size(), populationLimit, false);
    }
    if (populationLimit < 0) {
        throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
    }

    this.chromosomes = chromosomes;
    this.populationLimit = populationLimit;
}
 
Example 4
Source File: ListPopulation.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ListPopulation instance.
 *
 * @param chromosomes list of chromosomes in the population
 * @param populationLimit maximal size of the population
 */
public ListPopulation (List<Chromosome> chromosomes, int populationLimit) {
    if (chromosomes.size() > populationLimit) {
        throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
                                            chromosomes.size(), populationLimit, false);
    }
    if (populationLimit < 0) {
        throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
    }

    this.chromosomes = chromosomes;
    this.populationLimit = populationLimit;
}