Skip to main content
Version: 🚧 Alpha 🚧

1. A basic disease-spread model

This first model represents people moving in a square environment. Infected agents can transmit the disease to nearby people with a fixed probability.

Result of the Luneray Flu model 1.

People agents​

The moving skill provides movement attributes and actions. Each person has a speed and infection state. The move reflex calls wander; infected people ask those within 10 meters to test a 0.05 infection probability. The aspect uses color to distinguish infected from susceptible agents.

species people skills: [moving] {
float speed <- (2 + rnd(3)) #km/#h;
bool is_infected <- false;

reflex move {
do wander();
}

reflex infect when: is_infected {
ask people at_distance 10 #m {
if flip(0.05) {
is_infected <- true;
}
}
}

aspect circle {
draw circle(10) color: is_infected ? #red : #green;
}
}

World and initialization​

The world contains 2,147 people, starts with five infected agents and advances in five-minute steps. The init block creates the people and marks an initial sample as infected.

global {
int nb_people <- 2147;
int nb_infected_init <- 5;
float step <- 5 #mn;
geometry shape <- square(1500 #m);

init {
create people number: nb_people;
ask nb_infected_init among people {
is_infected <- true;
}
}
}

Experiment​

The experiment lets the user set the initial number of infected people and displays each agent with its circle aspect.

experiment main mode: gui {
parameter "Nb people infected at init" var: nb_infected_init min: 1 max: 2147;

output {
display map {
species people aspect: circle;
}
}
}

See the complete Luneray Flu model 1 in the model library.