I've had a little neural network/genetic algorithm project I've been working on and off (mostly off) for years now. Nothing fancy, just trying to build a good framework for evolving neural network solutions. The tricky part, and the thing you don't usually see done, is that I want to evolve the network layout as well as the relative link strengths/node trigger values. This requires a much more subtle encoding. To date I've had very little success evolving networks to perform even the simplest of tasks.
Over the last week I've been feeling inspired to poke at this project again. After refreshing myself on the rather unpleasant code structure (I started this a long time again), I set myself the task of developing a real genetic encoding before going any further. Might as well do it right...
The network lives on an arbitrarily sized n * m grid. The first row is input and the last row is output. There are two types of codons: geometric and markers. Geometric codons are: up, down, left, right, and 'knight jumps' upleft, upright, downleft, downright. Marker codons are: start marker, sequence marker, end marker. A couple are duplicated to give a total of 13 codons.
Following a start marker, the geometry codons are read until the first sequence marker, moving a cursor across the grid, starting from the top left. Movements wrap around the sides and just stop at the top and bottom. The final position is the location of a new node. The next series of geometries gives the trigger value for that node, given as the cumulative relative X coordinate of the geometry end position. Next links from that node are given in pairs of geometries. The first defines the target cell of the link. It is attached to the nearest existing node within 2 cells, if there is one, following a specific search pattern. The second geometry defines the activation value for that link, given by the relative Y coordinate. (Links without a second geometry default to 1.) This repeats until an end marker.
Overall, I'm quite happy with it. It has some of the organic attributes of real genetic encoding without being bizarrely complicated and impossible to implement. It should definitely be an improvement over the previous encoding, which was far too brittle and unstable in the face of even minor mutations. Now I just need to write the code.
So, whee. Nice to be getting somewhere on this. Nicer still to have something unimportant to distract me from doing real work. :)
Over the last week I've been feeling inspired to poke at this project again. After refreshing myself on the rather unpleasant code structure (I started this a long time again), I set myself the task of developing a real genetic encoding before going any further. Might as well do it right...
The network lives on an arbitrarily sized n * m grid. The first row is input and the last row is output. There are two types of codons: geometric and markers. Geometric codons are: up, down, left, right, and 'knight jumps' upleft, upright, downleft, downright. Marker codons are: start marker, sequence marker, end marker. A couple are duplicated to give a total of 13 codons.
Following a start marker, the geometry codons are read until the first sequence marker, moving a cursor across the grid, starting from the top left. Movements wrap around the sides and just stop at the top and bottom. The final position is the location of a new node. The next series of geometries gives the trigger value for that node, given as the cumulative relative X coordinate of the geometry end position. Next links from that node are given in pairs of geometries. The first defines the target cell of the link. It is attached to the nearest existing node within 2 cells, if there is one, following a specific search pattern. The second geometry defines the activation value for that link, given by the relative Y coordinate. (Links without a second geometry default to 1.) This repeats until an end marker.
Overall, I'm quite happy with it. It has some of the organic attributes of real genetic encoding without being bizarrely complicated and impossible to implement. It should definitely be an improvement over the previous encoding, which was far too brittle and unstable in the face of even minor mutations. Now I just need to write the code.
So, whee. Nice to be getting somewhere on this. Nicer still to have something unimportant to distract me from doing real work. :)