most-queue 1.40__tar.gz → 1.41__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of most-queue might be problematic. Click here for more details.

Files changed (90) hide show
  1. {most_queue-1.40 → most_queue-1.41}/PKG-INFO +1 -1
  2. most_queue-1.41/most_queue/theory/utils/__init__.py +0 -0
  3. most_queue-1.41/most_queue/theory/utils/binom_probs.py +14 -0
  4. most_queue-1.41/most_queue/theory/utils/diff5dots.py +30 -0
  5. most_queue-1.41/most_queue/theory/utils/flow_sum.py +231 -0
  6. most_queue-1.41/most_queue/theory/utils/passage_time.py +1033 -0
  7. most_queue-1.41/most_queue/theory/utils/q_poisson_arrival_calc.py +60 -0
  8. most_queue-1.41/most_queue/theory/utils/student_stat.py +184 -0
  9. most_queue-1.41/most_queue/theory/utils/weibull.py +113 -0
  10. {most_queue-1.40 → most_queue-1.41}/most_queue.egg-info/PKG-INFO +1 -1
  11. {most_queue-1.40 → most_queue-1.41}/most_queue.egg-info/SOURCES.txt +9 -1
  12. {most_queue-1.40 → most_queue-1.41}/pyproject.toml +1 -1
  13. {most_queue-1.40 → most_queue-1.41}/setup.py +1 -1
  14. {most_queue-1.40 → most_queue-1.41}/LICENSE +0 -0
  15. {most_queue-1.40 → most_queue-1.41}/README.md +0 -0
  16. {most_queue-1.40 → most_queue-1.41}/most_queue/__init__.py +0 -0
  17. {most_queue-1.40 → most_queue-1.41}/most_queue/compare_fj_calc.py +0 -0
  18. {most_queue-1.40 → most_queue-1.41}/most_queue/flow_sum.py +0 -0
  19. {most_queue-1.40 → most_queue-1.41}/most_queue/general_utils/__init__.py +0 -0
  20. {most_queue-1.40 → most_queue-1.41}/most_queue/general_utils/approx_cdf_make.py +0 -0
  21. {most_queue-1.40 → most_queue-1.41}/most_queue/general_utils/conv.py +0 -0
  22. {most_queue-1.40 → most_queue-1.41}/most_queue/general_utils/tables.py +0 -0
  23. {most_queue-1.40 → most_queue-1.41}/most_queue/general_utils/vacations_paper_utils.py +0 -0
  24. {most_queue-1.40 → most_queue-1.41}/most_queue/rand_distribution.py +0 -0
  25. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/__init__.py +0 -0
  26. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/batch_sim.py +0 -0
  27. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/fj_delta_sim.py +0 -0
  28. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/fj_sim.py +0 -0
  29. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/flow_sum_sim.py +0 -0
  30. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/impatient_queue_sim.py +0 -0
  31. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/priority_network.py +0 -0
  32. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/priority_queue_sim.py +0 -0
  33. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/qs_sim.py +0 -0
  34. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/queue_finite_source_sim.py +0 -0
  35. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/__init__.py +0 -0
  36. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/distribution_utils.py +0 -0
  37. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/exceptions.py +0 -0
  38. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/phase.py +0 -0
  39. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/qs_queue.py +0 -0
  40. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/servers.py +0 -0
  41. {most_queue-1.40 → most_queue-1.41}/most_queue/sim/utils/tasks.py +0 -0
  42. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/__init__.py +0 -0
  43. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_batch.py +0 -0
  44. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_ek_d_n.py +0 -0
  45. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_engset.py +0 -0
  46. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_fj_delta.py +0 -0
  47. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_fj_im.py +0 -0
  48. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_gi_m_1_calc.py +0 -0
  49. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_gi_m_n_calc.py +0 -0
  50. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_impatience.py +0 -0
  51. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_m_d_n_calc.py +0 -0
  52. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_m_h2_h2warm.py +0 -0
  53. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_m_ph_n_prty.py +0 -0
  54. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mg1_calc.py +0 -0
  55. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mgn_tt.py +0 -0
  56. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mgn_with_h2_delay_cold_warm.py +0 -0
  57. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mmn3_pnz_cox_approx.py +0 -0
  58. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mmn_h2cold_h2warm.py +0 -0
  59. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_mmn_prty_pnz_approx.py +0 -0
  60. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_network_im_prty.py +0 -0
  61. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_qs_sim_prty.py +0 -0
  62. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_qs_sim_test.py +0 -0
  63. {most_queue-1.40 → most_queue-1.41}/most_queue/tests/test_queue_types.py +0 -0
  64. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/__init__.py +0 -0
  65. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/batch_mm1.py +0 -0
  66. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/ek_d_n_calc.py +0 -0
  67. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/engset_model.py +0 -0
  68. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/fj_calc.py +0 -0
  69. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/gi_m_1_calc.py +0 -0
  70. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/gi_m_n_calc.py +0 -0
  71. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/impatience_calc.py +0 -0
  72. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/m_d_n_calc.py +0 -0
  73. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/m_h2_h2warm.py +0 -0
  74. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/m_ph_n_prty.py +0 -0
  75. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mg1_calc.py +0 -0
  76. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mg1_warm_calc.py +0 -0
  77. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mgn_tt.py +0 -0
  78. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mgn_with_h2_delay_cold_warm.py +0 -0
  79. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mmn3_pnz_cox_approx.py +0 -0
  80. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mmn_prty_pnz_approx.py +0 -0
  81. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mmn_with_h2_cold_and_h2_warmup.py +0 -0
  82. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/mmnr_calc.py +0 -0
  83. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/network_calc.py +0 -0
  84. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/network_viewer.py +0 -0
  85. {most_queue-1.40 → most_queue-1.41}/most_queue/theory/priority_calc.py +0 -0
  86. {most_queue-1.40 → most_queue-1.41}/most_queue/weibull.py +0 -0
  87. {most_queue-1.40 → most_queue-1.41}/most_queue.egg-info/dependency_links.txt +0 -0
  88. {most_queue-1.40 → most_queue-1.41}/most_queue.egg-info/not-zip-safe +0 -0
  89. {most_queue-1.40 → most_queue-1.41}/most_queue.egg-info/top_level.txt +0 -0
  90. {most_queue-1.40 → most_queue-1.41}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: most_queue
3
- Version: 1.40
3
+ Version: 1.41
4
4
  Summary: Software package for calculation and simulation of queuing systems
5
5
  Home-page: https://github.com/xabarov/most-queue
6
6
  Author: Xabarov Roman
File without changes
@@ -0,0 +1,14 @@
1
+ from scipy import special
2
+
3
+
4
+ def calc_binom_probs(size, y1):
5
+ p = y1
6
+ q = 1.0 - y1
7
+ probs = []
8
+ for i in range(size):
9
+ probs.append(special.comb(size - 1, size - 1 - i) * pow(p, size - 1 - i) * pow(q, i))
10
+ return probs
11
+
12
+
13
+ if __name__ == '__main__':
14
+ print(calc_binom_probs(4, 0.4))
@@ -0,0 +1,30 @@
1
+ def diff5dots(f, h):
2
+ """
3
+ Численный расчет производной функции
4
+ :param f: массив значений функции, количество элементов от 3-5
5
+ :param h: шаг
6
+ :return: массив из 3х значений - 1,2,3 производной
7
+ """
8
+ res = [0] * 3
9
+
10
+ count = len(f)
11
+
12
+ if count == 3:
13
+ res[0] = (1.0 / (2.0 * h)) * (-f[2] + 4.0 * f[1] - 3.0 * f[0])
14
+ res[1] = (1.0 / (h * h)) * (f[2] - 2.0 * f[1] + f[0])
15
+ res[2] = 0
16
+ elif count == 4:
17
+ res[0] = (1.0 / (6.0 * h)) * (2.0 * f[3] - 9.0 * f[2] + 18.0 * f[1] - 11.0 * f[0])
18
+ res[1] = (1.0 / (h * h)) * (-f[3] + 4.0 * f[2] - 5.0 * f[1] + 2.0 * f[0])
19
+ res[2] = (1.0 / (h * h * h)) * (f[3] - 3.0 * f[2] + 3.0 * f[1] - f[0])
20
+ elif count == 5:
21
+ res[0] = (1.0 / (12.0 * h)) * (-3.0 * f[4] + 16.0 * f[3] - 36.0 * f[2] + 48.0 * f[1] - 25.0 * f[0])
22
+ res[1] = (1.0 / (12.0 * h * h)) * (
23
+ 11.0 * f[4] - 56.0 * f[3] + 114.0 * f[2] - 104.0 * f[1] + 35.0 * f[0])
24
+ res[2] = (1.0 / (2.0 * h * h * h)) * (
25
+ -3.0 * f[4] + 14.0 * f[3] - 24.0 * f[2] + 18.0 * f[1] - 5.0 * f[0])
26
+ else:
27
+ for i in range(3):
28
+ res[i] = 0
29
+
30
+ return res
@@ -0,0 +1,231 @@
1
+ import copy
2
+ import math
3
+
4
+ import matplotlib
5
+ import matplotlib.pyplot as plt
6
+
7
+ from most_queue.rand_distribution import H2_dist
8
+
9
+ matplotlib.use('TkAgg')
10
+
11
+
12
+ class SummatorNumeric:
13
+
14
+ def __init__(self, a, verbose=False, is_semi=False):
15
+ self.n = len(a)
16
+ self.a = a
17
+ self.num_of_moments = len(a[0])
18
+ self.is_semi = is_semi
19
+ self.verbose = verbose
20
+ self.coevs = []
21
+ self.result_flow = []
22
+ self.flows_ = []
23
+ self.a1_sum = []
24
+ self.a2_sum = []
25
+
26
+ def sum_flows(self):
27
+ """
28
+ суммирование n потоков
29
+ a[i][j] - i - номер потока, j номер начального момента интервалов между соседникми заявками i потока
30
+ """
31
+ n = len(self.a) # число суммируемых потоков
32
+
33
+ for i in range(n - 1):
34
+ if self.verbose:
35
+ print("Summation of flows. Start calculation {0} from {1}. ".format(
36
+ i + 1, n - 1))
37
+ if not self.is_semi:
38
+ f1 = self.sum_2_H2_flows(self.a[0], self.a[1])
39
+ else:
40
+ f1 = self.sum_2_flows_semiinvariants(self.a[0], self.a[1])
41
+
42
+ self.flows_.append(f1)
43
+ self.coevs.append(SummatorNumeric.get_coev(f1))
44
+ f = []
45
+ f.append(f1)
46
+
47
+ for j in range(len(self.a) - 2):
48
+ f.append(self.a[j + 2])
49
+
50
+ self.a = copy.deepcopy(f)
51
+
52
+ for i in range(len(self.flows_)):
53
+ self.a1_sum.append(self.flows_[i][0])
54
+ self.a2_sum.append(self.flows_[i][1])
55
+
56
+ self.result_flow = self.a[0]
57
+
58
+ @staticmethod
59
+ def get_residual_distr_moments(a):
60
+ f = [0.0] * (len(a) - 1)
61
+ for i in range(len(f)):
62
+ f[i] = a[i + 1] / ((i + 2) * a[0])
63
+ return f
64
+
65
+ @staticmethod
66
+ def get_v(k):
67
+ """
68
+ Вычисление нормированных семиинвариантов числа событий рекуррентного потока
69
+ """
70
+ v = []
71
+ v.append(1.0 / k[0])
72
+ if len(k) > 1:
73
+ v.append(k[1] / pow(k[0], 3))
74
+ if len(k) > 2:
75
+ v3 = 3 * pow(k[1], 2) / pow(k[0], 5)
76
+ v3 -= k[2] / pow(k[0], 4)
77
+ v.append(v3)
78
+ if len(k) > 3:
79
+ v4 = k[3] / pow(k[0], 5)
80
+ v4 -= 10 * k[1] * k[2] / pow(k[0], 6)
81
+ v4 += 15 * pow(k[1], 3) / pow(k[0], 7)
82
+ v.append(v4)
83
+
84
+ return v
85
+
86
+ @staticmethod
87
+ def get_k(a):
88
+ """
89
+ Вычисление семиинвариантов
90
+ """
91
+ k = []
92
+ k.append(a[0])
93
+ if len(a) > 1:
94
+ k.append(a[1] - pow(a[0], 2))
95
+ if len(a) > 2:
96
+ k.append(a[2] - 3 * a[1] * a[0] + 2 * pow(a[0], 3))
97
+ if len(a) > 3:
98
+ k.append(a[3] - 4 * a[2] * a[0] - 3 * pow(a[1], 2) +
99
+ 12 * a[1] * pow(a[0], 2) - 6 * pow(a[0], 4))
100
+
101
+ return k
102
+
103
+ @staticmethod
104
+ def get_k_by_v(v):
105
+ """
106
+ Вычисление семиинвариантов по v -нормированным семиинвариантам числа событий рекуррентного потока
107
+ """
108
+ k = []
109
+ k.append(1.0 / v[0])
110
+ if len(v) > 1:
111
+ k.append(v[1] / pow(v[0], 3))
112
+ if len(v) > 2:
113
+ k.append((3 * pow(v[1], 2) - v[0] * v[2]) / pow(v[0], 5))
114
+ if len(v) > 3:
115
+ k4 = v[3] / pow(v[0], 2) + 5 * v[1] * \
116
+ (3 * pow(v[1], 2) - 2 * v[0] * v[2])
117
+ k4 = k4 / pow(v[0], 7)
118
+ k.append(k4)
119
+ return k
120
+
121
+ @staticmethod
122
+ def get_a(k):
123
+ """
124
+ Вычисление нач моментов по семиинвариантам
125
+ """
126
+ a = []
127
+ a.append(k[0])
128
+ if len(k) > 1:
129
+ a.append(k[1] + pow(k[0], 2))
130
+ if len(k) > 2:
131
+ a.append(k[2] + 3 * k[0] * k[1] + pow(k[0], 3))
132
+ if len(k) > 3:
133
+ a.append(k[3] + 4 * k[2] * k[0] + 3 * pow(k[1], 2) +
134
+ 6 * k[1] * pow(k[0], 2) + pow(k[0], 4))
135
+
136
+ return a
137
+
138
+ @staticmethod
139
+ def get_coev(a):
140
+ D = a[1] - pow(a[0], 2)
141
+ coev = math.sqrt(D.real) / a[0].real
142
+ return coev
143
+
144
+ @staticmethod
145
+ def sum_2_flows_semiinvariants(a1, a2):
146
+
147
+ k1 = SummatorNumeric.get_k(a1)
148
+ k2 = SummatorNumeric.get_k(a2)
149
+
150
+ min_len = min(len(a1), len(a2))
151
+
152
+ v1 = SummatorNumeric.get_v(k1)
153
+ v2 = SummatorNumeric.get_v(k2)
154
+
155
+ v_sum = []
156
+ for i in range(min_len):
157
+ v_sum.append(v1[i] + v2[i])
158
+
159
+ k_sum = SummatorNumeric.get_k_by_v(v_sum)
160
+ a_sum = SummatorNumeric.get_a(k_sum)
161
+
162
+ return a_sum
163
+
164
+ @staticmethod
165
+ def get_error(test, real):
166
+ return 100*(test-real)/real
167
+
168
+ @staticmethod
169
+ def sum_2_H2_flows(a1, a2):
170
+ """
171
+ суммирование двух потоков c произвольными коэффициентами вариации
172
+ Аппроксимация H2-распределением с комплексными параметрами
173
+ a1 - список из начальных моментов интервалов между соседникми заявками первого потока
174
+ a2 - список из начальных моментов интервалов между соседникми заявками второго потока
175
+ """
176
+
177
+ # Вычисляем начальныем моменты первого произведения A1, A2*
178
+ y1_mus = H2_dist.get_params_clx(a1)
179
+ y = [y1_mus[0], 1.0 - y1_mus[0]]
180
+ mu = [y1_mus[1], y1_mus[2]]
181
+ y2_mus = H2_dist.get_params_clx(a2)
182
+ u1_lambdas = H2_dist.get_residual_params(y2_mus)
183
+ u = [u1_lambdas[0], 1.0 - u1_lambdas[0]]
184
+ lambdas = [u1_lambdas[1], u1_lambdas[2]]
185
+
186
+ f_first = []
187
+ for i in range(len(a1)):
188
+ f_first.append(0)
189
+
190
+ for k in range(len(a1)):
191
+ summ = 0
192
+ for i in range(2):
193
+ for j in range(2):
194
+ summ += y[i] * u[j] * \
195
+ math.factorial(k + 1) / pow(mu[i] + lambdas[j], k + 1)
196
+ f_first[k] = summ
197
+
198
+ # Вычисляем начальныем моменты второго произведения A1*, A2
199
+
200
+ y1_mus = H2_dist.get_params_clx(a2)
201
+ y = [y1_mus[0], 1.0 - y1_mus[0]]
202
+ mu = [y1_mus[1], y1_mus[2]]
203
+ y2_mus = H2_dist.get_params_clx(a1)
204
+ u1_lambdas = H2_dist.get_residual_params(y2_mus)
205
+ u = [u1_lambdas[0], 1.0 - u1_lambdas[0]]
206
+ lambdas = [u1_lambdas[1], u1_lambdas[2]]
207
+
208
+ f_second = []
209
+ for i in range(len(a1)):
210
+ f_second.append(0)
211
+
212
+ for k in range(len(a1)):
213
+ summ = 0
214
+ for i in range(2):
215
+ for j in range(2):
216
+ summ += y[i] * u[j] * \
217
+ math.factorial(k + 1) / pow(mu[i] + lambdas[j], k + 1)
218
+ f_second[k] = summ
219
+
220
+ # Итоговые моменты:
221
+ f = []
222
+ for i in range(len(a1)):
223
+ f.append(0)
224
+
225
+ l1 = 1 / a1[0]
226
+ l2 = 1 / a2[0]
227
+ l_sum = l1 + l2
228
+ for k in range(len(a1)):
229
+ f[k] = (l1 * f_first[k] + l2 * f_second[k]) / l_sum
230
+
231
+ return f