davidrmiller / biosim4

Biological evolution simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you calculate the action to do

RevenMyst opened this issue · comments

Hi ! I was looking for a example of a complex genetic algorithm w/ explanations so that I could get inspired to dev one by myself. I found the youtube video and loved it !
I'm trying to reproduce a smaller and simpler version (less kind of neuron etc...)
However I'm a bit lost on how to calculate the action to do given a sample of genes, especially beacuse of the loops that can occur.
Can someone explain me the algorithm (maybe in pseudo code or smth like that) ? I tried reading the C++ code but I am a bit lost.
Thanks a lot !

Hi @RevenMyst , I assume that the loops you mentioned are those where an internal neuron connects back to itself either directly or through one or more other internal neurons. Such feedback loops can saturate or oscillate over a number of simulator steps. In this simulator, each internal neuron has a latch on its output. We recalculate each internal neuron's output exactly once each simulator step, using the latched values of the other neurons connected to its input, and latch the new output value. A neuron's latched output value persists until its output is recalculated in the next simulator step.

In each simulator step, the output action neurons are recalculated after all the internal neurons have been updated. For the movement neurons, we more or less take a vector sum of the movements and treat the X and Y components as probabilities of movement along those axes, then convert that into a unit movement vector. For the other action neurons, we compute each neuron's output, which will always be in the range -1 to +1, ignore those with negative outputs, and treat the ones with positive outputs as probabilities that they will fire.

There are other ways to do it, and you may want to experiment a bit to see what works best with your particular design. Good luck!