org.apache.commons.math.genetics
Class BinaryChromosome

java.lang.Object
  extended by org.apache.commons.math.genetics.Chromosome
      extended by org.apache.commons.math.genetics.AbstractListChromosome<Integer>
          extended by org.apache.commons.math.genetics.BinaryChromosome
All Implemented Interfaces:
Comparable<Chromosome>, Fitness

public abstract class BinaryChromosome
extends AbstractListChromosome<Integer>

Chromosome represented by a vector of 0s and 1s.

Since:
2.0

Constructor Summary
BinaryChromosome(Integer[] representation)
          Constructor.
BinaryChromosome(List<Integer> representation)
          Constructor.
 
Method Summary
static List<Integer> randomBinaryRepresentation(int length)
          Returns a representation of a random binary array of length length.
 
Methods inherited from class org.apache.commons.math.genetics.AbstractListChromosome
getLength, newFixedLengthChromosome, toString
 
Methods inherited from class org.apache.commons.math.genetics.Chromosome
compareTo, getFitness, searchForFitnessUpdate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.math.genetics.Fitness
fitness
 

Constructor Detail

BinaryChromosome

public BinaryChromosome(List<Integer> representation)
Constructor.

Parameters:
representation - list of {0,1} values representing the chromosome

BinaryChromosome

public BinaryChromosome(Integer[] representation)
Constructor.

Parameters:
representation - array of {0,1} values representing the chromosome
Method Detail

randomBinaryRepresentation

public static List<Integer> randomBinaryRepresentation(int length)
Returns a representation of a random binary array of length length.

Parameters:
length - length of the array
Returns:
a random binary array of length length


jHepWork 3.1 ©