|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.bio.EvolveStandard
org.generation5.demos.EvoHelloWorld
Attempts to evolve a target string, defaulting to "Hello World!". All valid digits are acceptable inputs for the string.
| Field Summary | |
protected java.lang.StringBuffer |
dataString
The mutable data string. |
protected static java.lang.String |
targetString
The target string to evolve. |
| Fields inherited from class org.generation5.bio.EvolveStandard |
fitnessValue, minimizeFitness, random |
| Constructor Summary | |
EvoHelloWorld()
Creates a new instance of EvoHelloWorld |
|
| Method Summary | |
void |
calculateFitness()
The fitness is calculated as the sum of the differences between the data string and the target string. |
static java.lang.String |
getTargetString()
Return the target string being evolved. |
static void |
main(java.lang.String[] args)
Run the genetic algorithm with a target string. |
Evolvable |
mate(Evolvable partner)
Mate two strings with a simple one-point crossover. |
void |
mutate()
Mutate this string between -2 and +2 characters. |
void |
randomInitialize()
Initialize the string to a random collection of characters. |
static void |
setTargetString(java.lang.String ts)
Set the target string. |
java.lang.String |
toString()
Return an immutable version of dataString. |
| Methods inherited from class org.generation5.bio.EvolveStandard |
compareTo, getFitness |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.StringBuffer dataString
protected static java.lang.String targetString
| Constructor Detail |
public EvoHelloWorld()
| Method Detail |
public static void main(java.lang.String[] args)
args - the command line argumentspublic void calculateFitness()
calculateFitness in interface EvolvablecalculateFitness in class EvolveStandardpublic Evolvable mate(Evolvable partner)
mate in interface Evolvablemate in class EvolveStandardpartner - the partner string to mate with.
public void mutate()
mutate in interface Evolvablemutate in class EvolveStandardpublic void randomInitialize()
randomInitialize in interface EvolvablerandomInitialize in class EvolveStandardpublic java.lang.String toString()
dataStringpublic static java.lang.String getTargetString()
public static void setTargetString(java.lang.String ts)
ts - the new target string.
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||