Neural networks

The neural networks used in this program are standard multilayer perceptron networks. Each greener has its own network with its own set of weights. The networks have four inputs, one hidden layer of six perceptrons and two outputs. The inputs and outputs are described in the Rules section.


Genetic algorithms

Evolution is "used" to find the best neural network to survive in the given environment. Usually this means that the network will have to make the greener hunt greens, but I have seen genomes which blindly fly back and forth really quickly and are still able to survive given enough greens (about 15). Bouncing off the wall takes away some health in order to make this less likely.

The exact details of how the genome changes are described in the Rules section.


Dynamic learning

By "dynamic learning" I mean adjusting the network while the greener is alive. I don't suppose this is a real scientific term; it's just what I call it. The algorithm is rather simple and not particularly efficient.

A "happiness" function is defined: it is equal to the reciprocal of the greener's distance to the nearest green. When a greener is born, its happiness function is integrated over 15 seconds. A random set of weights is chosen (one weight for each gene), and each gene is adjusted by the product of a Rate variable multiplied by the corresponding weight. The happiness function is then integrated over the next 15 seconds. If the total happiness has increased, the Rate variable is also increased and the genome is adjusted again (because it looks like the adjustment made the genome better).

If the happiness is worse, genome is restored, and the program attempts to adjust the genome in the other direction (i.e. Rate is negative). If this fails too, a new set of weights is chosen. If this works, the program continues adjusting genome until it stops working again.

There are several problems with this algorithm. Most importantly, the greeners tend to die after an unsuccessful adjustment to their genome before the previous genome can be restored. A work-around for this is the "fix" feature in the screensaver (makes the greeners invincible). Another problem is that 15 seconds is usually not enough for a "proper" evaluation of a genome, but longer intervals are difficult because again, the greeners tend to die quickly. To help them survive, greeners are given a "rest" period, in which they get the original genome, after two consecutive "bad" adjustments. This gives them a chance to accumulate a bit of health.