jump to navigation

Detailed balancing for garbage collectors June 25, 2006

Posted by dorigo in games, mathematics, personal, physics, science.

Detailed balancing is a principle which, in its simplest form, relates the relative population of two states by the probability of a transition between them. The principle applies equally well to physical systems, mathematical probability densities, or statistical processes in a variety of forms.

Yesterday I was sweeping the floor of the apartment we rented at Cavallino, by the beach. The floor is made of white tiles, and it is always dirty – or so it looks – because my kids come and go from the beach and bring home lots of sand. The combination of lots of small particles and a white floor triggered my imagination, while I tried to be tidy and do the work as well as I could – and in the smallest possible time, of course!

When you sweep the floor you have two strategies, basically. You can sweep a small area and collect the garbage -sand, in my case- there, then moving on to the neighboring area. Or, you can sweep a large area by bringing along what you have been collecting, until you gather a larger amount of sand, and only then you "stop at the boxes" and take a pause to collect it. Normally, you would use the second strategy, because by minimizing the number of times you collect the garbage, you save time. Ok, but how much can you wait before stopping at the boxes ?

The question is meaningful, of course, since when you bring along more and more sand with the broom, you will continue to collect what you are sweeping, but a small amount of what you have been sweeping will leak out of the moving pile. If the pile is large enough, more sand will leak out than you can collect with the same movement.

A detailed balancing condition has arisen! Let's put it in math terms: if Na is the number of sand grains in a unit area of the floor to be swept, and Ns is the number of sand grains in the pile you are bringing along as you sweep the floor, you can write:

Ns P(s->a) = Na P(a->s)

where P(s->a) is the probability that while you sweep a unit area of floor, a sand grain collected by the broom leaks out, and P(a->s) is the probability that a sand grain on the floor will be collected as you sweep the unit area over which it sits.

I would say that in my case P(s->a) was of the order of 1%, and P(a->s) was 99%. What that means is that I reach an equilibrium condition as soon as Ns is 99 times Na. For instance, if there are 100 grains per tile, then by the time I have collected 9900 grains I can stop sweeping and have better collecting, since my pile won't grow any larger!!

Actually, much earlier than that, because already when I have 5000 grains I start losing 50 every 99 that I collect: my efficiency of collection has dropped by 49%!

All this is very instructive. I had never had the occasion of observing the principle at work in so simple a system… The white tiles are a perfect sand detector. You can actually see what is going on… Almost.

Ah, these crazy particle physicists… 

About these ads

Get every new post delivered to your Inbox.

Join 96 other followers

%d bloggers like this: