views
103
likes
3

Comments (1)

What do you think?

Unfortunately it's missing the unityplayer.dll file.

This is a very basic implementation of a Genetic Algorithm.

How to use it:

  • Click in the Input box ("Enter Target Text Here") and type in whatever string of characters you'd like, as long as it's something that's standard on a QWERTY keyboard (no Unicode or special characters from other languages or anything, it can't handle those).

  • Click "Generate Population" to set everything up and create the first generation of strings.

  • Click one of the remaining 4 buttons to evolve at different rates. The "Evolve" button will just keep the simulation running until something matches the target text.

  • You'll be able to clearly see the overall progress by looking at the "Best Text" just under the input box. This will show you how close the population is to achieving the goal.

  • The generation counter will tell you which generation you are on, or if you just hit "Evolve", how many generations it took to get a match.

NOTE: If you type something new into the input box, YOU MUST CLICK "GENERATE POPULATION" again before attempting to evolve otherwise the simulation may crash.

How it works:

  • When the population is first generated, each member of the population is a randomly generated sequence of valid characters.

  • When a generation is run, the "fitness" of each member of the population is evaluated, and the population is sorted in order of who is the closest to the target text.

  • The population is then culled using a "tournament" selection method, where three members of the population are selected at random, and their fitnesses are compared, with the lowest of the three being removed. This means that those with a higher fitness are more likely to make it, but are not guaranteed, because if three with a high fitness are randomly selected, the lowest, despite being high, will still be removed. Equally, an individual with a low fitness may survive if it is selected alongside individuals with an even lower fitness. This selection process continues until the population is cut in half.

  • The surviving population then reproduces, with those of a higher fitness reproducing first, then lower down the list until the population is refilled.

  • The UI is then updated, showing the results of that generation, with the most successful in the upper left, and the least successful in the lower right.

The number of generations it takes to achieve the target string is largely dependent on the length of the string, but usually achieves an exact match within 500 generations.
#other



all-ages

13/06 Update