These particles are born in the left half of the screen, and are left to wander around... After some number of iterations, those who are in the right half of the canvas, survive, the others, are killed. Admittedly it's a rough world to live in, but that's life.

Each particle has a small neural network brain that takes 4 inputs: the distance from the particle to each wall. The neural network outputs 4 numbers that we use to compute a displacement in the x axis [begin-latex-inline]dx[end-latex-inline] and a displacement in the y axis [begin-latex-inline]dy[end-latex-inline].

[begin-latex]\tanh \left( \begin{bmatrix} \text{top} \\ \text{left} \\ \text{bottom} \\ \text{right} \end{bmatrix} \begin{bmatrix} w_{11} & w_{12} & w_{13} & w_{14} \\ w_{21} & w_{22} & w_{23} & w_{24} \\ w_{31} & w_{32} & w_{33} & w_{34} \\ w_{41} & w_{42} & w_{43} & w_{44} \end{bmatrix} \right) = \begin{bmatrix} y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix}[end-latex]

The displacements are computed arbitrarily as:

[begin-latex]\left\{ \begin{array}{ll} dx = y_1 - y_2 \\ dy = y_3 - y_4 \end{array} \right.[end-latex]

When particles survive the death round, they are paired in groups of 2 to produce a child particle. The child particle's brain (aka neural network) is built by mixing the neural network parameters from each of its parents. More precisely, the neural network of the child inherits half the [begin-latex-inline]W[end-latex-inline] parameters matrix from each of its parents. The parents and the child are then taken to the next round.

Interestingly, the parameters of each particle's brain are never trained per-se (for example with gradient descent), but simply built out of the parents brains. Another interesting fact is that particles are never told to go right; they don't even know how the output of their brain is being used. They have essentially zero feedback from the environment. However, since we only ever keep the particles that behaved in a certain way, i.e. went right, we end up with a population that has the sought-after characteristics.

This is the process of natural selection.

So, next time you see a Samara flying in the wind and wonder how smart nature is to develop these beautiful structures that optimize seed propagation; keep in mind, those who can't compete... will die.

Epoch:

Population Size

Survival Ratio