/users/rlr/RePast/Demos-3/SIR1_DS/Readme.txt -------------------------------------------- This is a simple SIR (susceptible-infected-recovered) agent-based model. This copy uses a dynamic schedule of events (DES) vs the discrete time (synchronous) version in SIR1 from which this was dervied. To make a copy: /appl/repast/Demos-3/bin/copyProject.pl \ -S/users/rlr/RePast/Demos-3 -XSIR1_DS \ -R/users/YOURLOGIN/ -PSIR1_DS where YOURLOGIN is your login, and you might have -R/users/YOURLOGIN/RePast if you want to put the model in a directory named RePast/ . Then you can cd SIR1_DS ant compile You can then get a further description of the model with: bin/batchrun.sh --help and then run it with ant run ant run -Dargs="D=2" bin/batchrun.sh nA=100 ncps=2 T=50 Look at the report.* file (eg report.00 is the default) to see the results. See the file /users/rlr/RePast/Demos-3/SIR1_DS/notes-050410.txt for additional information. ---------------------------------------------------------------- SIRS1_DS -- simple agent-based epid model. Agents are in one of 3 states: Susceptible Infected Recovered We start with all in state S except 1. The basic dynamics: We want agents to schedule events of these types: - contactAnotherAgent On contact if one is infected and the other is not, then with probInfInfectsS, change the other to infected, and schedule a becomeRecovered event. at time timeInfected + t where t = Normal( infectionDuration, infectionDuration/4.0 ) - becomeRecovered Set state to Recovered We would like on average numContactsPerStep (cps) per agent, where a "step" is a Repast unit of time (e.g., interpreted as a day). To get started, Model-buildSchedule schedules contactEvent's for each agent, the time for each being drawn from a uniform random distribution U[0,1]. Then, on each contact event, the instigator agent schedules itself for a future event at a time drawn from, say, a normal distribution with mean 1, and some variance. (In this model, lets just make the variance = 1 for simplicity.) NB: Be sure that the time added to current time to get future events is > 0, so that the events are scheduled in the future! The Model's contactEvent(a,b) method decides if one agent infects another, and if so, tells that agent to execute its infected() method. The Agent-infected() method sets its state and schedules a RecoverEvent. The Agent-recover() just changes state. We also want to write stats to report file each step (day). Stats written each t include: #Newly Infected at that t total S, I, R at that t One could of course add other events, eg, - becomeInfectious - becomeDormant - die If there are die events, one has to be careful to remove events from the schedule for those that die, which means agents need a ListArray instance variable that contains pointers to all future events they are to participate in. (Note we could also have an ArrayList of pastEvents, so that we would have a history of all events the agent participated in during the entire run.) Here are parameters (alias) = default values: rDebug (D) = 0 seed (S) = 1234567 stopT (T) = 100 initialAgentsFileName (iAFN) = initialParametersFileName (iPFN) = infectionDuration (infDur) = 10 numAgents (nA) = 16 numContactsPerStep (ncps) = 1 outputDirName (oDN) = ./ probInfInfectsS (prIIS) = 0.05 reportFrequency (rF) = 1 reportFileName (rFN) = report runNumber (rN) = 0 saveRunEndState (sRES) = 0 worldSizeX (wsX) = 40 worldSizeY (wsY) = 40