Algorithms January 03, 2016


I have been doing programming puzzles for quite a while now, of the type found on Project Euler. As with any word problem, sometimes it’s a bit of a challenge just to understand what is being asked, but once that’s done the first solution that comes to mind is usually one that involves brute force, i.e. a complete enumeration of all the possibilities. Sometimes this is good enough, but many times the parameters of the problem make it impossible to find the solution by brute force, even if you could harness all the computers on earth from now until the heat death of the universe. Solving these problems often requires a change in perspective; for instance by expressing the problem in the language of graphs or matrices. If the problem is stated the right way, the right algorithm will often suggest itself in a moment of inspiration. But to getting to the point of inspiration was already a lot of work; there’s a significant upfront investment in learning enough about matrices or graphs or whatever else to know what algorithms apply and how to use them in anger against a tough problem. Actually executing the solution is another significant amount of work, and there are always further wrinkles that complicate things.

On the surface, day-to-day parenting doesn’t exaclty resemble a programming puzzle, but maybe it’s just a matter of learning how to translate challenges from the way in which they’re presented to a language in which they can be understood. With my limited understanding, I too often rely on brute force methods, but more in the sense of intimidation and yelling rather than going through all the possibilities. Where would I even begin to get the knowledge I would need to put myself in position to have the flashes of insight needed on a regular basis? Perhaps irrationally, I don’t believe that parenting books are the answer. Even if I could somehow figure it all out, how would I have the fortitude to apply things in real time?

I had one brief excursion into parenting by algorithm. At times it seems that Elena and Roman compete over everything, no matter how trivial, from who can get into the car first to which bathroom they get to use for washing up before meals. The end-of-day fight was always over who got to be first in the tooth brushing queue, so I decided to try a random method. For more than a week, we flipped a coin to make the determination, with the caveat that since this was an unbiased, random method (not exactly easy concepts for a six year old and four year old to grasp), there was no reason to fuss or cry about it and if they ever did so, we would give up on this strategy and go back to the old way. After losing the coin flip four days in a row, Elena lost her cool, and we haven’t used that method since. There’s an old investing maxim: “the market can stay irrational longer than you can stay solvent.” Even though the strategy didn’t last very long, maybe the fact that they’ve had an early lesson in the martingale fallacy will pay dividends much later on.

comments powered by Disqus