-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimparam.py
87 lines (70 loc) · 3.17 KB
/
simparam.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import numpy as np
class SimParam(object):
"""
Contains all important simulation parameters
"""
def __init__(self, setting):
if setting is None:
# current buffer spaces and minimal buffer spaces
self.lmbda = 0.34
# set seed for random number generation
# The branching split i,e Q
self.SPLIT = 2
self.biased_split = False
if self.biased_split:
# set branching probability for binary split
self.branchprob = 0.5
else:
self.branchprob = 1 / self.SPLIT
# Set branching probability for a split
self.branch_biased = np.full(self.SPLIT, (1 - self.branchprob) / (self.SPLIT - 1))
self.branch_biased[0] = self.branchprob
if self.optimim_sic_split:
self.branch_biased = [0.5 ** p for p in range(1, self.SPLIT + 1)]
self.branch_biased[-1] = self.branch_biased[-2]
# The number of packets that can be resolved in a multipacekt reception system in one slot.
self.K = 1
# The type of Resolution Algorithm
self.modified = False
self.unisplit = False
self.sic = True
self.combi = False
self.combi_splits = [3, 4]
self.combi_split_ratio = 0.33
self.windowed_access = False
self.window_size_delta = 17
else:
# current buffer spaces and minimal buffer spaces
self.lmbda = 0.34
# set seed for random number generation
# The branching split i,e Q
self.SPLIT = int(setting.firstwindow.test_values[0])
self.biased_split = setting.firstwindow.test_values[2]
if self.biased_split:
# set branching probability for binary split
self.branchprob = float(setting.firstwindow.test_values[3])
else:
self.branchprob = 1 / self.SPLIT
# Set branching probability for a split
self.branch_biased = np.full(self.SPLIT, (1 - self.branchprob) / (self.SPLIT - 1))
self.branch_biased[0] = self.branchprob
# The number of packets that can be resolved in a multipacekt reception system in one slot.
self.K = int(setting.firstwindow.test_values[1])
# The type of Resolution Algorithm
self.modified = setting.firstwindow.test_values[4]
self.unisplit = setting.firstwindow.test_values[5]
self.sic = setting.firstwindow.test_values[6]
def print_settings(self):
print("Q = " + str(self.SPLIT))
print("K = " + str(self.K))
print("Branch Prob = " + str(self.branchprob))
if self.biased_split:
print("Using Biased Split")
if self.modified:
print("Modified Tree")
if self.sic:
print("Successive Interference Cancellataion")
if self.unisplit:
print("Uniform First Split")
if not self.modified and not self.sic:
print("Simple Tree")