RANDOM-ENCOUNTER
Begin NetLogo code:do-every 1 [do-if my-state = "infected" [do-for-n the-encounter-rate all-individuals with [my-state != "dead"] [set my-last-encounter the-other add-behaviours list-of-micro-behaviours "Encounter Behaviours" [POSSIBLE-INFECTION.html]]]]End NetLogo code
Additional encounter behaviours can be added.
This relies upon the POSSIBLE-INFECTION micro-behaviour to possibly infect the other. CREATE-ENCOUNTER-RATE-SLIDER defines the the-encounter-rate variable used here.
RANDOM-SPATIAL-ENCOUNTER differs from this micro-behaviour in biasing the selection of the other individual to those close by.
RANDOM-SOCIAL-ENCOUNTER selects among my acquaintances.
RANDOM-PHYSICAL-ENCOUNTER selects among those at my location.
This models individuals that have the-encounter-rate encounters per unit time period (e.g., a simulated week). Every second, if I'm still infected (i.e., my-state = "infected") then I pick the-encounter-rate other individuals (who are not dead) and give them the micro-behaviour POSSIBLE-INFECTION. If the-encounter-rate is a non-integer then the remainder is compared with a random number probabilistically to possibly include one additional individual. I also sets the my-last-encounter variable of the other individuals to me in order to keep track of how many infections I cause.
do-for-n selects n agents and sets the-other to refer to each one.
This was implemented by Ken Kahn.