RapidModel is one of the original in-browser programs. This may be an odd thing to say since it’s only just appearing now, as the fourth project (or fifth, or sixth, depending on how you count the projects in beta) but it’s actually the second in-browser program I wrote. Much like the original version of CamoEvolve it needed some serious fixes. Unlike CamoEvolve it needed so many fixes that it really wasn’t workable, and so I took it down, re-wrote the code effectively from scratch (I kept a few drawing functions), and have now put it back up (having, in the meantime, re-written the whole site).
RapidModel is based on something I did in college. In one of our classes (probably Conservation Biology) we played around with a program where we could link items together and then play with sliders on them and see how they affected other items. I assume we built population models with this system, but I don’t really remember. RapidModel is similarly generic (but also free and does not require downloading).
At its most basic, RapidModel is a bunch of nodes that hold numbers with connections that cause the numbers in one node to influence the numbers in other nodes. The numbers in a node may represent anything – number of caribou, GDP, cans of beets – and the connections can take almost any form. So, without further ado, a brief explanation of the objects in RapidModel.
Nodes are just number containers. To create a node select Add/Edit Nodes and click on the black part of the screen. A new node will appear where you click and you’ll be asked to name the node. You’ll also be asked for:
Number: The number the node starts with. When you hit “Reset” the node will remember this number and reset to it as well.
Maximum: The number in the node will not exceed this number. In some cases the maximum is based on a real world constraint and in others it exists just to keep the model in some sane range.
Minimum: The number in the node will not drop below this number. For many real objects zero is a natural choice.
If you edit a node (which you do by selecting the radio button with the node’s name after creating a node) you can also choose to check Round to Integer. In this case the node will never display non-integer numbers. However, it does keep track of non-integer effects. So, for instance, if an integer node held a 2 and you subtracted 0.1 from it ten times in a round the node would drop to 1. If you subtracted 0.1 from it once a round nothing would happen for ten rounds, and then it would drop to 0. For many real-world items rounding to integers makes sense. There are no 0.3 whales or 0.71 consumers out there.
Connections can only be created in the sidebar. Create some nodes, selected Add/Edit Connections, and select Add New. Connections name themselves in a way that describes exactly what they do (for instance, a recent model of mine had a connection called “Seals-Sharks”) so you won’t be asked for a name but you will be asked for a start node and an end node. Circular connectors are fine. Calculators (which we’ll discuss next) can only be starting nodes. Here’s the important thing to remember: start nodes do something to end nodes. This is easy to think about with additive nodes. You take the number from the start node, go over to the end node, and add that start node number to the end node. What a start node does to the end node is determined by the node type, which is just a mathematical operator. Connection weights can be used modify how much of the start node is used to modify the end node. For instance, to grow a node by 50% a turn connect a node to itself with an additive connection of weight 0.5. You could do exactly the same thing by setting up a node that just held the number 1.5 and using it as the start node for a multiplicative connector of weight 1.
You create calculators much like nodes, which calculators are (technically) a subclass of. However, unlike nodes the important things that go on in calculators have to be done from the sidebar menu. Calculators have a set of arguments with exactly the same name as in nodes and these arguments (maximum, etc) function exactly the same way so I won’t re-describe them.
However, while calculators are programatically nodes they are ideologically very fancy connections. Unlike nodes they don’t retain a number for multiple turns, modifying it. Instead they calculate a value fresh every turn. Originally this was done by using dozens of connections and dummy nodes but calculators work much better. It’s the addition of calculators that made RapidModel usable. To use a calculator you must give it an equation. Equations can contains the names of nodes, numbers, and a small set of mathematical operators. Equations are written in a pretty straightforward manner: Squirrels/Trees gives you the number of squirrels per tree this turn. If you type an equation correctly you will see “No errors” when you hit enter. Otherwise you’ll be told what part of the equation was an issue. Calculators will also identify nodes that they draw numbers from and create yellow connections to them automatically.
The equation reader can only handle the following operators: +, -, * (multiplication), / (division), ^ (exponentials). It cannot handle order of operations. All equations are read left to right. So Squirrels/Trees/10+1 is equivalent to ((Squirrels/Trees)/10)+1.
Calculators can also be used to delay effects in a model. The delay time simply puts the calculator X turns behind the rest of the model. At the very simplest a calculator could simply take the value from another node a hold it for a certain number of turns (for instance, price responds to the demand of two turns ago). Because of the delay function the initial number of the calculator can be important. Perhaps you are multiplying by the output of a delayed calculator. If you start with 0 in the calculator you’ll zero out your next node as well, whereas if you started with 1 in the calculator nothing would happen for the turns before the calculator showed its first calculation.
So what does this look like?
Here’s a silly example. I want trees to grow slowly. I also want the squirrel population to grow but to be capped at 2 squirrels per tree. I made this model.
Trees and Squirrels are just nodes, set to round to integers. SquirrelsPerTree is a calculator with the equation Squirrels/2/Trees, which hits 1 when there are two squirrels per tree and stays under 1 when there are less than two squirrels per tree (as in this screenshot). Trees connects to trees with an additive connector of strength 0.1 which causes the population to grow by 10% per turn. (Again, while trees are integers, the accumulation of partial trees still eventually triggers the addition of a tree.) SquirrelsPerTree creates dummy connections (in yellow) that can’t be edited but which show that it uses both Trees and Squirrels for its calculations. Squirrels is divided by SquirrelsPerTree, so when there is extra space around the population expands. The minimum cap on SquirrelsPerTree can be used to lock the squirrel growth rate at some maximum and the maximum cap can be used to prevent the squirrel population from crashing violently.
I have no idea what you’ll use RapidModel for. I’ll definitely use it for population models in ecology this semester, but I deliberately made it extremely open-ended. If you do something fun with it leave me a comment.