Mean-field computations#

slotted_aloha_simulator.mean_field.dynamic_mean_field(p0=0.125, alpha=0.5, n=2, c_max=40, t_sim=10)[source]#

Dynamic mean fields values.

Parameters:
  • p0 (float, optional) – Default emission probability.

  • alpha (float, optional) – Back-off ratio.

  • n (int, optional) – Number of stations.

  • c_max (int, optional) – Upper bound on state value.

  • t_sim (int, optional) – Time range (exponential).

Returns:

  • states (ndarray) – State distribution

  • occupancy (ndarray) – Proportion of busy slots

  • goodput (ndarray) – Proportion of useful slots

  • efficiency (~numpy.ndarray) – Proportion of useful emissions

Examples

>>> s, o, g, e = dynamic_mean_field()
>>> s[:4, :4].round(4)
array([[1.000e+00, 9.772e-01, 9.392e-01, 8.861e-01],
       [0.000e+00, 2.280e-02, 5.990e-02, 1.095e-01],
       [0.000e+00, 1.000e-04, 9.000e-04, 4.300e-03],
       [0.000e+00, 0.000e+00, 0.000e+00, 1.000e-04]])
>>> e[:4].round(4)
array([0.875 , 0.8764, 0.8788, 0.8823])
>>> s, o, g, e = dynamic_mean_field(n=1000)
>>> s[:4, :4].round(4)
array([[1.    , 0.8203, 0.5545, 0.2578],
       [0.    , 0.1758, 0.3909, 0.5112],
       [0.    , 0.0039, 0.0528, 0.2059],
       [0.    , 0.    , 0.0019, 0.0241]])
>>> e[:4].round(4)
array([0., 0., 0., 0.])
slotted_aloha_simulator.mean_field.mean_field(p0=0.125, alpha=0.5, n=2, c_max=40)[source]#

Asymptotic mean fields values.

Parameters:
  • p0 (float, optional) – Default emission probability.

  • alpha (float, optional) – Back-off ratio.

  • n (int, optional) – Number of stations.

  • c_max (int, optional) – Upper bound on state value.

Returns:

  • states (ndarray) – State distribution

  • occupancy (float) – Proportion of busy slots

  • goodput (float) – Proportion of useful slots

  • efficiency (float) – Proportion of useful emissions

Examples

>>> s, o, g, e = mean_field()
>>> s[:4].round(4)
array([0.7808, 0.1712, 0.0375, 0.0082])
>>> round(e, 4)
0.8904
>>> s, o, g, e = mean_field(n=1000)
>>> s[:4].round(4)
array([0.0028, 0.0028, 0.0028, 0.0027])
>>> round(e, 4)
0.5014