GA Exercise (first look)
Click to run World:
GA (Finnegans Wake) at
Ancient Brain.
- Exercise: Clone and Edit this World.
- Change the speed. See the "frameRate" line.
- It seems we can do frameRate less than 1. (One frame every n seconds.)
This appears to be undocumented.
Search for longer strings
- Make target string very long.
- Does search time increase linearly? (Twice as long string takes twice as long to find)
Search for shorter strings
- Change target string to:
- You might be surprised what happens. Slow down frameRate to see.
Initial strings
- randomChar() is called by initialisation (initial strings) and mutation.
- Change where the strings are initialised to use character "c" instead of randomChar().
- So every character in every initial string is "c".
- What happens?
- Slow it down to see.
Mutation
- Change mutation to just give character "c".
- Both mutation and crossover are now useless. Why?
- Change mutation to just give character "d".
- What happens?
- Note string is: "riverrun, past Eve and Adam's, from swerve of shore to bend of bay"
- So string all "c" has fitness 0.
- String all "d" has fitness 3.
GAs are not for problems where you know the answer
- It should be said that
GAs are not for problems where you know the answer.
-
If you know the answer there is no need for any search!
- A GA is for a problem where the answer is not known
but there is still a measure of "fitness".
-
This kind of example (with a known answer)
is used to show and debug how the GA works.