critter
Class Genome
java.lang.Object
|
+--critter.Genome
- public class Genome
- extends java.lang.Object
|
Constructor Summary |
Genome(critter.Genome genomeX,
critter.Genome genomeY,
int crossoverPoint)
Constructor for a new genome based on two parents. |
Genome(int nLength,
int nAlphabet,
long seed)
Constructor for generating a new random genome |
|
Method Summary |
int |
crossoverPoint()
Helper function that calculates a suitable point for crossover |
void |
mutate(double probability)
Randomly changes bits in the genetic code. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
code
public int[] code
rand
protected java.util.Random rand
nAlpha
public int nAlpha
Genome
public Genome(int nLength,
int nAlphabet,
long seed)
- Constructor for generating a new random genome
- Parameters:
nLength - the number of bits in the codenAlphabet - the number of symbols that a bit can be instantiated toseed - the randomizing seed
Genome
public Genome(critter.Genome genomeX,
critter.Genome genomeY,
int crossoverPoint)
- Constructor for a new genome based on two parents.
- Parameters:
genomeX - the parent x genomegenomeY - the parent y genomecrossoverPoint - the point marking for crossover operation.
crossoverPoint
public int crossoverPoint()
- Helper function that calculates a suitable point for crossover
- Returns:
- int point for crossover
mutate
public void mutate(double probability)
- Randomly changes bits in the genetic code.
- Parameters:
probability - the probabililty by which a bit is changed.