hcrypto.analyzer
Class FreqGaIndividual
java.lang.Object
|
+--hcrypto.analyzer.GaIndividual
|
+--hcrypto.analyzer.FreqGaIndividual
- All Implemented Interfaces:
- java.lang.Comparable
- public class FreqGaIndividual
- extends GaIndividual
- implements java.lang.Comparable
Method Summary |
void |
calcFitness()
This method should be implemented in the subclass. |
void |
cross(GaIndividual i)
Implement a cross algorithm. |
java.lang.String |
displayCrossData()
|
int |
mutate(double rate)
This version of mutate swaps two random characters
in the key. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
FreqGaIndividual
public FreqGaIndividual(java.lang.String text,
java.lang.String initKey)
- This constructor takes an initial distribution for the key as
a parameter.
- Parameters:
text
- -- A string giving the text to be decrypted.initKey
- -- A string giving the initial values for the key.
FreqGaIndividual
public FreqGaIndividual(GaIndividual i)
- Copy constructor
cross
public void cross(GaIndividual i)
- Implement a cross algorithm.
- Overrides:
cross
in class GaIndividual
- Following copied from class:
hcrypto.analyzer.GaIndividual
- Parameters:
i1
- an Individual parenti2
- an Individual parent
mutate
public int mutate(double rate)
- This version of mutate swaps two random characters
in the key. The mutation is done with frequency equal
to rate. The resulting mutant is discarded if it
does not improve the fitness of the individual.
- Overrides:
mutate
in class GaIndividual
- Parameters:
rate
- is the mutation rate
calcFitness
public void calcFitness()
- Description copied from class:
GaIndividual
- This method should be implemented in the subclass.
- Overrides:
calcFitness
in class GaIndividual
displayCrossData
public java.lang.String displayCrossData()
- Overrides:
displayCrossData
in class GaIndividual
toString
public java.lang.String toString()
- Overrides:
toString
in class GaIndividual