91dpo
91dpo

Reputation: 201

Is there a way to track the birth rate in NetLogo

I'm writing a predator-prey model similar to the wolf-sheep predation model in NetLogo. I have a set of rules as to when the agents can reproduce (a given probability at each time step). Is there a way for me to keep track of what the total birth rate is in the model? Or the predation rate? The population growth rate? I don't really have any ideas as to what I could write.

Edit: I'm not sure yet if I want the birth-rate per tick or over a certain number of ticks, probably both eventually. If one time step is roughly a day, I'd like to work out birth-rate each time step but also over the year (so roughly 365 time steps). I'd like to compare the birth-rate of several runs with varying parameters (e.g. probability of reproduction).

Thanks, Damien

Upvotes: 0

Views: 131

Answers (1)

Alan
Alan

Reputation: 9620

Is there a way? Yes there are many ways. But it is difficult to say more without more model details. (E.g., do you just want to know how many are born each tick, or over some other interval?)

Here is one way to keep track of births. Introduce a global: say, sheep-born. Introduce an initialization procedure: say, init-asheep. The initialization procedure includes the command set sheep-born (1 + sheep-born). This initialization procedure can also include all your other initializations for a new sheep. Run the initialization procedure on each sheep you create. Now each tick (or whenever you wish) just plot sheep-born and then reset it to 0.

This may not address your exact need because you are not very specific about that. But it does illustrate a general approach. If you need to collect some information, come up with some way to collect the information, and some place to store it. In the approach described above, we collect the number of sheep born each tick by accumulating each birth in a global variable, and we store it by plotting it. (You could instead explicitly store it in a list, or write it to a file, etc.)

hth.

Upvotes: 1

Related Questions