The new simulation draws on two parallel analogies. First, at a high level, I am trying to evolve creatures that forage for food in a virtual world. At a lower level, I am trying to use the concept of a neural network to guide development.
Whiteboard notes; click for a larger version.
Genome
Neural network
Here's a rough idea of a what a neural network-based genome might look like:
gene_00: LLA (function) gene_01: dx (sensory input 1) gene_02: dy (sensory input 2) gene_03-24: modifiers
Genes 01 and 02 are essentially fixed; they provide sensory information from the world. The function denoted by gene 00 could vary, as can the modifier genes, which serve to "shape" the voltage gradient. They act, in theory, as the hidden layer. Weights are given by the spatial relationship between points on the sheet, implicitly encoded by the relationship between expressed genes (04 and 24 code for distant points and thus have a weaker interaction than say, genes 05 and 06).
Control
Input is given by two sensory nodes, which convey direction-dependent x' and y'. Output is sampled from an output node, mapped to a three-way stair step function (left, right, and straight). The input and output nodes are located at fixed positions (in the phenotype), to be determined.
Analog
For an analog model, each gene is identical, as there are no preordained phenotypic features specified by the genome.
[1] The gene might look like:
part_A: type (SRC, SNK, LLA_IN, OFF) part_B: payload (27 states)
Figuring out how to express a generic node is really giving me trouble. For one thing, I suspect that successful analog configurations will be more sparse than not. This suggests that most genes will be dormant. Further, the types are not compatible. Sources and sinks have a collective range of 400 states (assuming a uEAC), while LLAs currently only have 27 states. Here are a few alternatives to consider:
[2] Without OFF as a type:
part_A: state (expressed / dormant) part_B: type (SRC, SNK, LLA_IN) part_C: payload (27 states)
[3] Without worrying about expressed or not:
part_A: type (SRC, SNK, LLA_IN) part_B: payload (27 states) part_C: coordinates
This version has the disadvantages of multiple expression per node and varying genome lengths.
Parameters
This is a list of parameters to consider; their values may change.
- The snake has an initial length (5)
- The snake does not move at predetermined intervals
- The snake does not grow after eating food
- Collisions with walls are ignored
Movement (in progress)
Regardless of the encoding/representation scheme used, movement will be compute the same way. The snake will receive as input the relative distance to food, as vectors x' and y'. Given this information, the snake must choose from the following options:
- Turn right
- Turn left
- Go straight
- Do not move (possibly)
The directions are defined in terms of the snake's current direction. If, for example, the snake is traveling right, turning left has the effect of moving the snake in the up direction. Because of this, it is important the the absolute distance is properly translated.
UP: ( x, y) (viewport native coordinates) DOWN: (-x,-y) LEFT: ( y, x) RIGHT: (-y,-x)
It is also very important that the movement is properly translated back into global coordinates!
Original parameters
These were the parameters used for my original simulation. The system failed to converge to anything meaningful.
Genetic algorithm
- population size = 50
- generations = 50
- mutation rate = 0.15
Game
- speed = 250 ms
- size = 300x300
Genotype
- encoding
Phenotype
- input calculation - distance
- input distribution - even/odd
- output calculation - first read
- LLA distribution - max=8
- output interpretation - three phase output
