When I posted the last post I posted, I was smugly certain that I’d be posting another post, (that very day!)all about how success had been achieved. It had been a while since I’d last looked at my figures. I had episode 200 to kick out the door, and some research to do for a new project. It wasn’t that long of a break, but just long enough to mean I had to read my journal to figure out where I was, and what I should do next. Once I knew what was what, I realized that what I had planned to do was pointless and useless, at least compared to the shiny new idea in my head.
The shiny idea was both sparkly, and good—it did fix the problem I was needing to fix. But, it wasn’t enough. I lost track of the number of things I did to tweak the experiment, trying, somehow, someway, to coax a population of my figures to evolve the ability to push a button when they see the light.
While the experiment is running, a seed population is loaded. It’s run and mutated. Energy and protection from mutation are given as a reward for correctly pushing the button, and removed when the wrong button gets pushed at the wrong time. When the population goes extinct, the seed population is reloaded, and the entire mess starts all over.
Originally, I’d planned on just having one button, one port that should be called when the light was on. There was no other button. The population would have to push that button while the light was on, and avoid it when it was off. I changed to having two buttons, because I thought using only one button would leave the population too exposed to further mutation, even when they’d already learned what to do, when to do it, and when to not.
It was taking far too long for populations to go extinct. The default level of energy was set high enough so that doing nothing wouldn’t starve them. To get populations that weren’t making progress out of the way faster, I changed the way the energy worked.
Each time a new figure is born, it is born with one unit of energy less than its parent. Now they can’t just sit there; they have to work for it. In fact, dropping by 1 was still too slow. I changed it to drop by 10, and extinctions were finally happening at a decent rate.
Next, and I thought I’d never do this, I turned up the mutation rate. If you’ve been following along, you’ll no that I spent a very long time worried over how vulnerable to mutations the figures are, but with population turnover so high, I had to speed up the number of mutations that were happening so that enough change could happen in a short enough time.
Have a bit o-out-put-o.
guess on 41,690
guess off 0
Figure births 13,422
Elapsed time=0 hours, 0 minutes and 20 seconds
As you can see, I only ran it for 20 seconds—just long enough to show that good guesses outnumber bad ones, by 47.99 times as much in this run. Meanwhile, only one button is being pushed. They keep guessing that the light is on.
If they keep guessing that the light is on, shouldn’t they be wrong about half the time?
I tore the code inside out and upside-down. Eventually, I gave up, convinced as I went to sleep that there was some strange bias in the random number generator.
This morning, I was still completely mystified. As a test, I loaded a different population and let it run. It was still getting results like it had before. That suggests that the random numbers are properly random. I tested the random number generator while having the population do its thing, and it doesn’t show the sort of heavy bias it would have to in order to explain the results.
From the same 20 second run as above: “was on 457,831, was off 458,688.”
It’s roughly even, like it should be. In fact, the light was off more than on, but even though the figures never guessed that it was off, their good guesses still greatly outnumber the bad. So what, in the nine hells of haven’t-had-any-coffee-yet, is going on?
It finally hit me. This population is pushing the button when the light is on. That’s what I wanted them to do.
They’re saved in guesser0.pop. They’re not perfect, and they ignore the second button completely, but they’ve learned to push a button when they see the light, and mostly avoid it when the light is off. A bit less than once every fifty times, they make a mistake, but I can use guesser0 as the new seed population, and let them evolve a bit more. Actually, they’re in a local minimum, so I might have to change the mutation rate and/or the energy, but there it is.
Since they turn out to be capable of learning to use an eye, I’ll want to give them two, and see what they can do with them. I might, for a change, actually be able to produce some graphics, maybe even an animation… no promises.