MouseModel

Purpose
To model the dynamics of a small mammal, which could be a squirrel or a mouse, in an environment with limited food and optionally some generic predators

Entities, State Variables, Scales
Patches can be empty, contain food, or contain a nest
 * Empty: black, no food or nest
 * Food: green, 'grows' at a user defined interval
 * Nest: yellow, represents a mouse's "home". Only place where mice can reproduce

Turtles can be either mice or (if included) predators.

Mice have variables defining
 * homeP: the patch containing the mouse's nest
 * foodHolding: how much food the mouse is currently holding
 * energy: how much energy the mouse has left (movement and reproduction costs energy)
 * nextReprod: when (in ticks) the mouse can reproduce next

Predators have variables defining
 * predEnergy: the predator's energy
 * nextBreed: when (in ticks) the predator can reproduce

Each nest patch has variables defining
 * foodCache: how much food is stored in the nest

In the interface window, users can define
 * InitialFood: how many patches will be set as food at setup
 * vision: how far (in patches) mice can see
 * visionAngle: the viewing angle (as a cone in front of it) in which a mouse can see
 * InitialNests: how many nests will be created at setup (and therefore how many mice)
 * MaxEnergy: the maximum energy a mouse can have
 * FoodGrowthInterval: the amount of ticks between food growth
 * ReproductionRate: how often, in ticks, mice can reproduce
 * ShowTargets: turns food patches a mouse is currently attempting to pick up red. Mostly for debugging but it looks nice too
 * IncludePredators: switch on whether or not to include predators
 * InitialPredators: how many predators to create at setup
 * PredatorMaxGrowth: how often, in ticks, predators can reproduce
 * PredatorVision: how far predators can see (in patches, in any direction)
 * PredEnergyPerTurn: how much energy a predator consumers per turn

In terms of scale, the model is a 50 x 50 square/torus. Mice move at 1 patch/tick, predators move slightly slower.

Process Overview and Scheduling
Time Step
 * First mice move choosing to go back to their nest if they can't carry any more food, or can reproduce and have at least 1 food. Otherwise it will search for food
 * To forage a mouse looks in a user defined cone in front of it, and moves 1 step toward the nearest food tile. If it cannot see any food tiles it turns up to 90 degrees in either direction and moves 1 step forward
 * To go home a mouse faces its home patch and takes 1 step. If it is at its home patch it adds any food it is carrying to the nests food cache, then reproduces once if it can. If there is more than one food stored in the nest, the mice and it's offspring have their energy refilled and continue to search. If there is only one food available the original mouse dies and the offspring continues to search
 * If a mouse runs out of energy it dies and drops as much food as it can/is carrying in nearby empty patches
 * Food grows, if the specified tick has been reached, by changing one adjacent empty patch to a food patch. If there are no nearby empty patches, nothing happens
 * If predators are enabled, they default to moving very slowly (.01 patches/tick) forward. If a mouse comes within the vision radius, a predator will move more quickly (.8 / tick) toward the mouse. If a predator is within one patch of a mouse, it will eat the mouse and gain energy equal to the mouse's remaining energy. If consuming a mouse puts a predator above max energy and it hasn't reproduced recently it will spawn another predator. As with the mice, if a predator falls below 0 energy it dies.

Design Concepts
The main concept being demonstrated is the interplay of semi-intelligent foragers and their primary food source. Sensing and stochasticity are prominent concepts from the ODD list.

Initialization

 * Create initial nests and one mouse on each
 * Create predators if enabled
 * Set next food growth and animal reproduction tick
 * Randomly distribute food onto empty patches

Input Data
No input data

Submodels
The main submodel is the foraging behavior of the mice. They have an adjustable viewing distance and angle, as well as a variable carrying capacity. Simpler submodels specify patch growth and predator hunting behavior.

Implementation note
I didn't realize we were using NetLogo 4.1 for these models, so mine was developed in version 5RC7. I tested it in 4.1.3 and everything seemed to behave the same except the plots, which are no longer specified in code in v5 so can't be easily translated.