|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectChromosome
public class Chromosome
| Field Summary | |
|---|---|
static double |
CROSSOVER_RATE
A constant that specifies the cross over rate (see crossover). |
static double |
MUTATION_RATE
A constant that specifies the mutation rate (see mutate). |
static int |
OVERLAP_PENALTY
A penalty that will be applied for each overlapping constituent. |
| Constructor Summary | |
|---|---|
Chromosome(Chromosome other)
A constructor that initializes the content of this Chromosome with that of other. |
|
Chromosome(java.lang.String chain)
A constructor that initializes this chromosome with random moves for this chain. |
|
| Method Summary | |
|---|---|
Chromosome |
crossOver(Chromosome other)
With probability CROSSOVER_RATE the method returns a new Chromosome consisting of a certain number of contiguous genes from this solution and the rest of the genes coming from other. |
java.lang.String |
getChain()
Returns the chain of constitents of this chromosome. |
int |
getFitness()
Returns an integer value that reflects the quality of the solution. |
Move |
getGene(int pos)
Returns the value of the gene at the given position of the chromosome. |
void |
mutate()
Applies mutations to this chromosome. |
int |
size()
Returns the size of this chromosome, which is the number of genes. |
java.lang.String |
toString()
Returns a String representation of this Chromosome. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int OVERLAP_PENALTY
public static final double MUTATION_RATE
public static final double CROSSOVER_RATE
| Constructor Detail |
|---|
public Chromosome(java.lang.String chain)
chain - the chain of constituentspublic Chromosome(Chromosome other)
other - is an other Chromomose| Method Detail |
|---|
public int getFitness()
public Chromosome crossOver(Chromosome other)
other - the other chromosome that will be used for the crossover
public void mutate()
public java.lang.String toString()
Chromosome [fitness=-2, genes=[Down, Right, Right, Up, Left, Up, Right], chain=hphpphhp]
toString in class java.lang.Objectpublic int size()
public Move getGene(int pos)
pos - the given position
public java.lang.String getChain()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||