More virtual birds

I have returned to my simulated rafts of shags. As well as general code refinements, I have also completely overhauled the way they dive and surface.

The dive rules have been in place for a while. They are as follows:

diverules

1. The virtual bird will dive wherever and whenever it wants, without paying any attention to what other birds are doing. Given that my hypothesis is that birds are using the diving behaviour of others to make their own diving decisions, this is the null model.

2. Birds are more likely to dive if another bird dived or surfaced recently. How likely they are to dive depends on how close the other bird was in space and time.

3. Similar to 2. but birds only have a limited cone of vision. They will not be away of a dive going on behind them for example.

 

Previously I only had one rule for surfacing: birds would surface at a random time after they had dived, within a circle of a random radius centred around where they initially dived . The distance they were allowed to travel was constrained by how long they’d been underwater. They were also more likely to surface in proximity to other birds, so as to maintain the cohesion we see in real birds.

Just before ISBE, my supervisor suggested that actually we probably want to try out a variety of surface rules to try a few different scenarios. This required a complete rewrite of the simulation, but this was a good opportunity for me to merge all my various dive rules into one piece of code too. Though there was quite a bit of hair pulling involved, I eventually ended up with a simple unified function.

The surfacing rules birds can now obey are as follows:

surfrules

1. Surface completely randomly in time and space. Virtual birds can reappear at any time within a circle of random radius centred around their dive, with the maximum radius depending on how long a bird was underwater. They don’t care if they are near another bird on the surface or not.

2. Same as rule 1, but birds are more likely to surface closer to another bird. The time they stay underwater is still random, which still controls the maximum possible distance they can travel underwater.

3. Similar to 2. with an important addition: A bird is more likely to surface in close proximity (in time and space) to a bird it dived in close proximity to (in time and space). This is to attempt to simulate birds following each other more closely underwater.

Of course. rewriting my code so that I can switch between which rules a simulation is using just by changing a number in my simulation uses was somewhat tricky, but eventually I hammered out all the bugs. Unifying all my code like this will make the selection of a best fitting model much simpler.

Advertisements

4 responses to “More virtual birds

  1. Pingback: The Shag Project

  2. Pingback: What do you think you’re doing? | The Shag Project

  3. Pingback: So I wrote a thesis.. | The Shag Project

  4. Pingback: So what do you do after you hand in your thesis anyway? | The Shag Project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s