Aloha#
Main interface class
- class slotted_aloha_simulator.slotted_aloha_simulator.Aloha(p0=0.125, alpha=0.5, n=2, c_max=40, t_sim=20, m=10, seed=None, c_min=3)[source]#
Top-level class of the package.
- 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 in epochs (exponential).m (
int, optional) – Minimal number of samples per epoch (exponential).seed (
int, optional) – Seed
Examples
Initiate an Aloha simulator:
>>> aloha = Aloha(p0=1/2, alpha=1/2, n=4, c_max=20, t_sim=10, m=8, seed=42)
Launch simulation + approximations
>>> aloha()
Asymptotic results (from approximation)
>>> mfa = aloha.res_['mf_asymptotic'] >>> [round(mfa[k], 4) for k in ['occupancy', 'goodput', 'efficiency']] [0.5, 0.3784, 0.5946]
Results at epoch 3 (from approximation)
>>> mf = aloha.res_['mf'] >>> [round(mf[k][3], 4) for k in ['occupancy', 'goodput', 'efficiency']] [0.6501, 0.4202, 0.4549]
Results at epoch 3 (from simulations)
>>> sim = aloha.res_['simulation'] >>> [round(sim[k][3], 4) for k in ['occupancy', 'goodput', 'efficiency']] [0.6667, 0.4266, 0.447]