The Azimuth Project
Blog - Azimuth explained (part 2)

This page is a blog article in progress, written by David Tanzer.
Please remember that blog articles need HTML, not Markdown.

guest post by David Tanzer</i>

Lake Petri Net

Hi this is Rick from the Portland Gear Works, checking back in with you. It’s now time to brew that pot of coffee I mentioned last time (link). I’ve thumbed through the catalog of their articles, and chosen one.

…But we won’t get to it in this post, because there are some basics that we need to know about first.

Now I didn’t get get it quite right when I called those Petri networks “Pachinko machines.” Instead of balls, they call the things that move around the network “tokens.” Also, more to the point, it’s not one big machine, but a network built up by connecting together lots of little machines. And the tokens aren’t necessarily part of a game. Each token represents something in the world. Imagine they have different colors, with each color for a different kind of thing. Suppose we have snakes, frogs and butterflies, and these are represented by tokens that are white, green and yellow, respectively.

Now the machines represent “processes” in the world, which take in some tokens at their inputs, and send out some tokens at their outputs. You could imagine, for example, a magic saucer that floats around the lake, which tries to attract exactly one snake and one frog. When it catches one of each, then presto, a transformation occurs: they shake hands, and are immediately converted into seven butterflies. As a mnemonic for all this, let’s call the saucer Preston.

Each one of these “meals” is represented by the following formula:

Preston: 1 Snake + 1 Frog –> 7 Butterfly

Now what would happen if our lake started out with 507 snakes, 379 frogs, and 27 butterflies. After each meal, Preston will deplete the snake and frog population some more, and the butterfly population will be soaring. Sadly, a population imbalance would develop. To make things more fair, let’s suppose that he had a brother and a sister saucer, each of which had a different eating habit:

Minerva: 5 Butterfly –> 1 Frog

Evan: 5 Butterfly –> 1 Snake

Now Preston will be in cooperation with both Evan and Minerva, because he will supply them with butterflies and they will supply him with frogs and snakes. On the other hand, Minerva and Evan will be competing for butterflies.

Now we can ask how the three populations will change over time, with all of the volcanoes working at the same time. This is a matter of “population dynamics.”

Well the answer depends on the feeding rates of each of the saucers. Suppose that Evan takes ten years between meals, whereas Minerva and Preston take only ten seconds. Then Preston will quickly deplete all of the snakes, and then run out of food, and so he will grind to a halt. Whatever butterflies are there will quickly be used up by Minerva, who will also grind to a halt. There will only be frogs. Then, when Evan is ready to eat again, all the food will be gone, and so the system will be stuck in the state of Eternal Frogs.

To make it more realistic, we should consider that the speed with which the saucers go from one meal to the next will depend upon how much of their specific nutrients are present in the lake. After all, if there are hardly any frogs present, then Preston will have to spend a lot of time floating around looking for them, and so there will be long search times between the meals. So the reaction rate of a saucer is a function of the input supplies. And it is an increasing function – the more inputs present, the faster it goes.

Now I will explain the standard model for how the feeding rate depends on the amount of food. Suppose that the lake is big and square, and the frogs and snakes are relatively few and far between. Suppose that Preston can attract any creatures that are within 50 feet. He moves by making hops of 500 feet, in a random direction each time. After each hop, if there is both a frog and a snake within 50 feet, then the magic reaction takes place.

Suppose he makes 20 hops per hour, that half the cells contains snakes, and that half the cells contain frogs. Then, assuming that the snakes and the frogs are independently distributed across the lake, how many meals per hour would take place? Well, of the 20 cells that are visited per hour, on the average, only one quarter of them will have both a frog and a snake, and so there will be an average feeding rate of 5 meals per hour.

So the feeding rate of a volcano is proportional to the product of the numbers of its input species that are present.

What if Thor were to change his diet from Snake + Frog to Snake + Snake? Then he could only have a meal if there were two snakes found in a cell. Well if the odds of finding one snake in a cell are 50%, then the odds of finding two snakes will be 25%. So the feeding rate would still be 5 meals per hour. This example shows us that if a volcano eats two instances of a species, then its feeding rate will be proportional to the square of the number of tokens that are present for that species. You can generalize this to the case where it eats more than two instances of a species.

In closing, I’d like to point out that the terminology we have used here, which makes things pretty clear, is unfortunately not standard. Let’s see how to connect it with the terms that are used by “professionals” – which by the way are much less emotional and vivid.

First, the volcanoes are called processes, reactions, or transitions. Second, each meal of a volcano is called a firing event of the transition. The feeding rate of a volcano is referred to as the firing rate of the transition. The transitions could actually represent processes that have nothing to do with our beloved lake, like the splitting apart of a molecule into atoms. There the tokens would represent different types of chemical entities, and the transitions correspond to different kinds of chemical reactions. So a Petri net is really closely related to the idea of a reaction network.

One closing comment on the name “Petri net.” The name actually comes from the inventor of it, but a useful mnemonic is to visualize Lake Petri Net growing, like a microcosm, inside of a Petri dish.

TODO:

  • describe rate coefficient
  • clarify 50% odds versus 50% of the cells have a frog

category: blog