Later, after getting Beth’s help with Miri and incidentally showing him how to organize the Green Private School, Ken approached Beth again. He thanked the young girl for showing him what was right and bringing him closer to his niece again.

“I love Miri too, Daddy. I try to be a friend to her, but I’m only five and she is eleven now. That’s a big gap, and will get bigger when she is through puberty. She needs people her own age, Daddy. Now, let’s talk algorithms.”

“Let’s. That’s sure to make me feel better.”

“Well, I’ve thinking about treating it as one big traveling salesman problem. Your salesman has to visit the 64 kids in one grade, but he’s smart and says to himself, I should get each potential customer to recommend my vacuum cleaner to her best friend. So he travels from best friend to best friend, until he has visited every person in the class. Then we snip the 64 person circuit into 8 person classes.”

“Yes, not a bad approach. He will sometimes have to settle for 2nd or 3rd best, to avoid duplication, but he should be able to make a single circuit of the class before coming back with encyclopedias to sell.”

“Yes. It’s that settling for 2nd or 3rd best that worries me. Fourth best maybe. Miri really doesn’t care about what happens in the rest of the circle. I’m interested in a direct matching approach.”

“How would that work?”

“Well, there are something like two thousand different ways of dividing a class into two kid pairs. That’s the binomial coefficient, from 64 choose 2. So you could examine all two thousand ways of matching kids into pairs. That’s a weighted bipartite matching problem, which could be solved with the Hungarian algorithm, or one of the faster ones. The results should be pretty good. Miri would be much more likely to get a single best friend that way than using a TSP algorithm.”

“You could iterate or recurse that.”

“Yes, Daddy, of course. given a pair of girls who are best friends, Alpha and Beta, you could match them with all other pairs, and find that the pair they’d get along with. Call the best two Gamma and Delta. Four girls who would love to have a tea party together.”

“There would be 32 pairs, so there are a lot fewer choices to look at.”

“Right, just a sec. Doing binomial coefficients in my head is not all that much fun, OK, from 32 choose 2 is 496.”

“I don’t know if there is any five year old in the world who knows what a binomial coefficient is, Beth, let alone calculate one in her head.”

“I’m sure there are plenty of us. So, all you have to do is a weighted bipartite match with a 496 by 496 weight matrix. I’m not going to do that in my head, though.”

“I’d be worried if you could.”

“Me too. So for kids of 9 or 10, you might end up with mostly all girl or all boy classes, and some mixed classes. Or you could tweak the algorithm, forcing it to produce mixed classes.”

“Mixed might be better.”

“Maybe. What do I know? I’m just a kid. Anyway, at that age boys would probably prefer to be with boys and girls with girls. Which would you have preferred, Daddy?”

“I’ve always liked girls better, Beth.”

“Is that why you have so many of them, Daddy?”

“Oh, no. That’s just because men don’t have babies. Having babies is all I care about.”

“I don’t know anything about anything, Daddy, but Mommy says its not just about the babies. I’m not sure what she means by that, but she makes it sound like you have fun with them.”

“I would never lie to you, Beth. I have fun with them. How about I spare you the details, for now? And spare me the details of explaining them. They are much less interesting than algorithms anyway.”

“I’ll right, I’ll let you keep me in ignorance for now, but if I ever discover that other five year olds know things I don’t, you are going to be in real trouble.”

“Good enough. So, I guess we could just match groups of four kids with groups of four, and see what happens. If we don’t get enough mixed classes, we could tweak the algorithm. In that case I’ll have to ask someone like Annette, though.”

“I don’t know. And I’m not sure what Miri would say, either. But by 12 or 13, the kids might prefer mixed classes. Actually, instead of matching one group of four boys with one of four girls, you might find the kids would like you to match one pair of girls with one pair of boys, so they could double date.”

“I don’t know if I can stand the thought of Miri dating, even if it was just double dating.”

“Well, you have a year or two more to adapt yourself to the idea, but whatever you do, ask Miri what she wants. You must always ask her, Daddy. Always, do you understand? I insist that you do. If you won’t I’ll tell Mommy, and she will make you do it.”

]]>