I have an agent-based simulation of an epidemic in which I use a standard SEIR model. I define the infection parameters in the main class. I now want to be able to change some agents during model runtime.
For example: I have defined 'contact rate' as a parameter in the 'main' class. I now want to be able to say that once an agent gets hospitalised, its contact rate now becomes 0. I tried writing a function within the 'agent' class that said:
if (hospitalise == true) {
main.ContactsPerDay = 0.0;
}
But this just sets the overall contact rate to 0 as soon as the first hospitalisation occurs, which is obviously wrong.
How could I write a function within agents that would only modify the contact rate for specific agents?