List of usage examples for org.apache.commons.math3.genetics BinaryChromosome randomBinaryRepresentation
public static List<Integer> randomBinaryRepresentation(int length)
length
. 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); }