urchine, a genetic algorithm

urchine is a genetic algorithm (GA), a computer program that uses the idea of natural selection to maximize a mathematical function. Think about a sine wave as a bunch of hills. There are 30 hamsters, some sitting in the valleys, and some near the tops of the hills. If we move all of the food to the tops of the hills, the hamsters will eventually migrate there (those that don't will die).

Now, create a function for food placement. We already know that y=sin(x). Let's say that food=ky, where k>0, so that there is more food at the top of the hills than the bottoms. Now our hamsters are just an x value, and their probability of natural selection is proportional to food.

Similarly, here's what urchine does: randomly places sea urchins on the landscape; evaluates their likelihood of selection; selects mates; performs crossover on their genes, producing two offspring for every pair of parents; randomly mutates the children's genes. Then the children become the new parents, and the cycle repeats itself.

Source code

For the R source, please visit this page. This code is released under the BSDL, so it's free for you to use and modify.

I also have more elegant code for the GA in C, but it is still a bit buggy. Contact me if this interests you.

Complete papers

Here's my final undergraduate research paper and the poster from my presentation on my work to date within the field of Economics.

In addition, Jeff Crowder, Neil Cornish, and myself have a paper published about the application of the GA to simulated LISA data in the field of Physics.

Resources


References