find_a_mate: Second try function for finding a mate, for pararellisation...

Description Usage Arguments Value

View source: R/updates.R

Description

Second try function for finding a mate, for pararellisation Takes in a female mosquito's position, then finds a single mate for them. Returns the ID of the male mate. NB the input of this function is the row position of a female in the current data.frame of agents. The output is the ID number (a column/variable) of a mate, and not its row position.

Usage

1
find_a_mate(femID, k, max_daily_mates, mozzie.dt)

Arguments

femID

ID of female mosquito to find a mate for.

k

2*k is the width of the bounding box drawn around the mosquito. This function will attempt to find a mate within this box.

max_daily_mates

Maximum number of times a male mosquito can mate in one day.

Value

The ID number of the male mate. Find males inside that boundary I find it easier to do a dplyr::filter and then change to ID numbers etc, system.time of the below on nrow(mozzie.dt) = 91795 gives: user system elapsed 0.008 0.008 0.018 no_bachelors == 0 means that there are no suitable mates. no_bachelors == 1 means there is one suitable bachelor no_bachelors > 1 means there are multiple suitable bachelors We randomly permute them and then take the top of the pile. Return the ID :)


beeysian/cairnsmozzie documentation built on Feb. 15, 2021, 12:12 a.m.