3 ms·
I've tried to play build the idea cubicle67 mentioned to use relative mutations instead of absolute ones. What I've implemented is a function that does not limi
by Arancaytar 18y ago
I've tried to play build the idea cubicle67 mentioned to use relative mutations instead of absolute ones. What I've implemented is a function that does not limit the change at all, but simple makes it more likely to be small and less likely to be large.
The new value becomes either (MAX - current) * P or current * P (50% chance on each), where P is the product of two random variables between [-1, 1]. I'm not sure how that is distributed (been a while since that statistics course), but it obviously favors numbers closer to 0.
This optimization looks rather efficient, as the same image seems to get about 67% more beneficient mutations in the same interval of generations.
Another change I would like to implement (but haven't yet) is a low chance of changing multiple values at once, which may eventually escape from a "dead end".
The best improvement of all would be to allow users to airbrush "priority" onto different regions, which then get weighted in the fitness score. If I'm generating a portrait, I care a lot more about the eyes than the background, for example.
- kenbo 18y agoI will try your function in my code this evening. Another strategy I thought about is to have a small chance of replacing a polygon with a random new polygon. It seems that it would help get out of dead end situations.
- kenbo 18y agoOk, I tried it and it converges much faster. My dna data is all integers so the update function is something like constrained update( int existing_value, int limit ) { new_value = random( limit ) constraining_value = random_float difference = ( new_value - existing value ) * ( constraining_value * constraining value ) return difference ( apologize if code doesn't format correctly). I also tried randomly replacing a poly with a new random shape and color poly 5% of the time to get away from local minima... didn't seem to help. I'm still doing a bit on this in my spare time if anyone is interested. Later.