我試圖執行SIR epidemic model。基本上,我理解模型的方式是,在每個時間步,它告訴我們有多少節點被感染,有多少節點被恢復。我現在試圖將其轉換爲離散事件模擬,並且在一點上感到困惑。將數學問題轉換爲離散事件模擬
該模型通常使用歐拉方法求解。現在,當我將它轉換成離散事件仿真,我做這樣的事情(數字是用於清晰度):
Initialize 100 members
At every time step t,
//Determine how many get infected
for i = 1 to 100
let i pass a message to its neighbors
When the neighbor receives the message from an infected member, it generates a random number and if it is less than beta*(infected/total), where beta is the infection rate, then the member gets infected
Update the count for infected, recovered, susceptible
//Determine how many are recovered
for i = 1 to 100
Generate a random number from a uniform distribution and check if it is less than gamma*infected. If it is, then this member is recovered.
Update the count for infected, recovered, susceptible
我基本上想,如果上面的方法是正確的。有什麼建議麼?
我知道這已經很晚了,但是有沒有不使用Gillespie算法的原因?你正在使用的不是離散事件相當於ODE公式(至少我認爲)。 http://en.wikipedia.org/wiki/Gillespie_algorithm – MHH 2014-05-15 20:40:40