I am not a mathematician but out of curiosity I am trying to implement the [SIS epidemic model](http://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIS_model) when the nodes have mobility to understand how it will change the results. I understand how to perform this simulation in an analytical fashion. However, things get rather confusing when nodes are mobile. To give a background, all models that I have come across do not consider that nodes are mobile.


The model assumes that each node can infect **any** node and hence the equations (differential or difference) are valid. But when nodes are mobile, each node is **not able** to infect every other node (the other node might not be within the range) and has to explicity send a message to a node that is susceptible in order to infect it. In that case, give an infection rate `B`, how do I simulate this when the nodes are mobile? 


Currently, the way I am doing this is in the following way:



```
def Controller():
    for i in range(1,100):
        randNum = getRand()
        if (randNum <= InfectionRate):
            neighbors = getNeighbors(i)
            ScheduleTransmission(getCurrentTime(), i, neighbors)
    Schedule(getCurrentTime() + 1, Controller)

```

My problem is that I am not understanding if the infection rate can now be captured through a single value (which was previously `B`). If not, how does one analyze this scenario? Do I set the `InfectionRate` as `B/numNodes` so that the overall probability will be `B`? Any suggestions?


**UPDATE: Making it more realistic**



```
def Controller():
    for i in range(1,100):
        neighbors = getNeighbors(i)
        for j in neighbors:
           randNum = getRand()
           if (randNum <= InfectionRate):
                 ScheduleTransmission(getCurrentTime(), i, j)
    Schedule(getCurrentTime() + 1, Controller)

```


How are epidemic models simulated in case of mobility?
You are free to define the parameters as you wish, as long as you document it. But in the standard (non-spatial) SIS model the rate at which new infections occur is $\beta I S$, i.e. each infective individual infects each susceptible individual at a rate $\beta$. This would correspond in your model to a situation where all individuals are neighbours and at each time step an infective node sends a message to each neighbour with probability $\beta \Delta t$, where $\Delta t$ represents the duration of one time step. 


If I understand your code, at each time step a given node either sends no transmissions or transmits to all its neighbours. I suspect it might be more realistic if, instead of this all-or-none scenario, transmissions from each infective node to its neighbours occurred independently, each with the same probability.


