Example usage for org.apache.commons.math3.genetics BinaryChromosome randomBinaryRepresentation

List of usage examples for org.apache.commons.math3.genetics BinaryChromosome randomBinaryRepresentation

Introduction

In this page you can find the example usage for org.apache.commons.math3.genetics BinaryChromosome randomBinaryRepresentation.

Prototype

public static List<Integer> randomBinaryRepresentation(int length) 

Source Link

Document

Returns a representation of a random binary array of length length.

Usage

From source file:it.units.malelab.sse.OperationsChromosome.java

public OperationsChromosome(Evaluator evaluator) {
    super(BinaryChromosome.randomBinaryRepresentation(BITS));
    this.evaluator = evaluator;
}

From source file:ga.GeneticAlgorithmTestBinary.java

/**
 * Initializes a random population.//  w w w .j av a  2  s .c  o m
 */
private static ElitisticListPopulation randomPopulation() {
    List<Chromosome> popList = new LinkedList<>();

    for (int i = 0; i < POPULATION_SIZE; i++) {
        BinaryChromosome randChrom = new FindOnes(BinaryChromosome.randomBinaryRepresentation(DIMENSION));
        popList.add(randChrom);
    }
    return new ElitisticListPopulation(popList, popList.size(), ELITISM_RATE);
}

From source file:p.lodz.playground.ApacheGeneticsTest.java

/**
 * Initializes a random population.//w  w  w  .  ja  v  a  2 s .com
 */
private ElitisticListPopulation randomPopulation() {
    List<Chromosome> popList = new LinkedList<Chromosome>();
    for (int i = 0; i < POPULATION_SIZE; i++) {
        BinaryChromosome randChrom = new FindOnes(BinaryChromosome.randomBinaryRepresentation(DIMENSION));
        popList.add(randChrom);
    }
    return new ElitisticListPopulation(popList, popList.size(), ELITISM_RATE);
}