bcds.phison.multfailures
Class SID<V,E>

java.lang.Object
  extended by bcds.phison.multfailures.SID<V,E>
Direct Known Subclasses:
SIDxPathFailures

public class SID<V,E>
extends java.lang.Object

This class implements the spreading of epidemics on a network as defined by the SID model. That model is described in:

E. Calle, J. Ripoll, J. Segovia, P. Vila and M. Manzano. "A multiple failure propagation model in GMPLS-based networks". Network, IEEE 24(6):17-22, November-December 2010.

By design, this class is minimalistic: it covers the state transitions experimented by individuals as the epidemic evolves, but the effects of such transitions on the traffic dynamics over the network are not taken into account. Instead, that aspect is implemented by SIDxPathFailures.

Several alternatives where evaluated to represent the node states (a byte array, a "bit-field" array, several bitsets, etc.) and this one came out the fastest (and the simplest): it uses two HashMap objects to represent the current and previous state of nodes.

In this class, "node" and "individual" are used interchangeably.

Author:
Juan Segovia S., based on work originally by Marc Manzano.

Nested Class Summary
static class SID.States
          The possible states of each node.
 
Constructor Summary
SID(SimGraph<V,E> g, float beta, float delta_1, float tau, float delta_2)
          Creates a new instance that will operate on the given graph and with given rates.
 
Method Summary
 java.util.Map<SID.States,java.lang.Integer> getCompartmentSizes()
          Returns the number of nodes per state, that is, the size of the compartments into which the population is decomposed.
 SID.States getPrevState(V v)
          Returns the previous state of node v.
 java.util.Random getRandomGen()
          Returns the current random number generator.
 SID.States getState(V v)
          Returns the current state of node v, or null if v does not exist (seemingly a programming error).
 void nextGeneration()
          Computes the new state for each node, that is, produces a new "generation" of the epidemic.
 void setRandomGen(java.util.Random rnd)
          Sets rnd as the random number generator to be used afterwards.
 void setState(V v, SID.States st)
          Sets the current state of the node v to st.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SID

public SID(SimGraph<V,E> g,
           float beta,
           float delta_1,
           float tau,
           float delta_2)
Creates a new instance that will operate on the given graph and with given rates. All nodes are put into the SUSCEPTIBLE state. An instance of java.util.Random is created with its default seed. The randon number generator can be changed later by calling setRandomGen(java.util.Random).

Method Detail

setRandomGen

public void setRandomGen(java.util.Random rnd)
Sets rnd as the random number generator to be used afterwards. It must not be null.


getRandomGen

public java.util.Random getRandomGen()
Returns the current random number generator.


getState

public SID.States getState(V v)
Returns the current state of node v, or null if v does not exist (seemingly a programming error).


setState

public void setState(V v,
                     SID.States st)
Sets the current state of the node v to st. The previous state remains unchanged.


getPrevState

public SID.States getPrevState(V v)
Returns the previous state of node v.


nextGeneration

public void nextGeneration()
Computes the new state for each node, that is, produces a new "generation" of the epidemic.


getCompartmentSizes

public java.util.Map<SID.States,java.lang.Integer> getCompartmentSizes()
Returns the number of nodes per state, that is, the size of the compartments into which the population is decomposed.