most-queue 1.34__tar.gz → 1.36__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.
- {most_queue-1.34 → most_queue-1.36}/PKG-INFO +78 -4
- {most_queue-1.34 → most_queue-1.36}/README.md +75 -1
- {most_queue-1.34 → most_queue-1.36}/most_queue.egg-info/PKG-INFO +78 -4
- most_queue-1.36/most_queue.egg-info/SOURCES.txt +9 -0
- {most_queue-1.34 → most_queue-1.36}/most_queue.egg-info/dependency_links.txt +0 -0
- most_queue-1.34/most_queue.egg-info/top_level.txt → most_queue-1.36/most_queue.egg-info/not-zip-safe +0 -0
- most_queue-1.34/most_queue.egg-info/not-zip-safe → most_queue-1.36/most_queue.egg-info/top_level.txt +1 -1
- {most_queue-1.34 → most_queue-1.36}/pyproject.toml +2 -2
- {most_queue-1.34 → most_queue-1.36}/setup.py +4 -9
- most_queue-1.34/most_queue/sim/__init__.py +0 -3
- most_queue-1.34/most_queue/sim/batch_sim.py +0 -83
- most_queue-1.34/most_queue/sim/fj_delta_sim.py +0 -302
- most_queue-1.34/most_queue/sim/fj_sim.py +0 -279
- most_queue-1.34/most_queue/sim/flow_sum_sim.py +0 -270
- most_queue-1.34/most_queue/sim/impatient_queue_sim.py +0 -166
- most_queue-1.34/most_queue/sim/priority_network.py +0 -157
- most_queue-1.34/most_queue/sim/priority_queue_sim.py +0 -813
- most_queue-1.34/most_queue/sim/qs_sim.py +0 -924
- most_queue-1.34/most_queue/sim/queue_finite_source_sim.py +0 -274
- most_queue-1.34/most_queue/sim/rand_destribution.py +0 -1030
- most_queue-1.34/most_queue/theory/__init__.py +0 -0
- most_queue-1.34/most_queue/theory/batch_mm1.py +0 -81
- most_queue-1.34/most_queue/theory/convolution_sum_calc.py +0 -23
- most_queue-1.34/most_queue/theory/diff5dots.py +0 -30
- most_queue-1.34/most_queue/theory/ek_d_n_calc.py +0 -150
- most_queue-1.34/most_queue/theory/engset_model.py +0 -124
- most_queue-1.34/most_queue/theory/fj_calc.py +0 -576
- most_queue-1.34/most_queue/theory/flow_sum.py +0 -299
- most_queue-1.34/most_queue/theory/generate_pareto_noise.py +0 -54
- most_queue-1.34/most_queue/theory/gi_m_1_calc.py +0 -88
- most_queue-1.34/most_queue/theory/gi_m_n_calc.py +0 -147
- most_queue-1.34/most_queue/theory/impatience_calc.py +0 -103
- most_queue-1.34/most_queue/theory/m_d_n_calc.py +0 -112
- most_queue-1.34/most_queue/theory/m_h2_h2warm.py +0 -679
- most_queue-1.34/most_queue/theory/m_ph_n_prty.py +0 -648
- most_queue-1.34/most_queue/theory/mg1_calc.py +0 -79
- most_queue-1.34/most_queue/theory/mg1_warm_calc.py +0 -30
- most_queue-1.34/most_queue/theory/mgn_tt.py +0 -449
- most_queue-1.34/most_queue/theory/mgn_with_h2_delay_cold_warm.py +0 -745
- most_queue-1.34/most_queue/theory/mmn3_pnz_cox_approx.py +0 -468
- most_queue-1.34/most_queue/theory/mmn_prty_pnz_approx.py +0 -599
- most_queue-1.34/most_queue/theory/mmn_with_h2_cold_and_h2_warmup.py +0 -602
- most_queue-1.34/most_queue/theory/mmnr_calc.py +0 -75
- most_queue-1.34/most_queue/theory/network_calc.py +0 -189
- most_queue-1.34/most_queue/theory/network_viewer.py +0 -88
- most_queue-1.34/most_queue/theory/passage_time.py +0 -1032
- most_queue-1.34/most_queue/theory/priority_calc.py +0 -548
- most_queue-1.34/most_queue/theory/q_poisson_arrival_calc.py +0 -60
- most_queue-1.34/most_queue/theory/student_stat.py +0 -184
- most_queue-1.34/most_queue/theory/weibull.py +0 -113
- most_queue-1.34/most_queue/utils/__init__.py +0 -0
- most_queue-1.34/most_queue/utils/approx_cdf_make.py +0 -79
- most_queue-1.34/most_queue/utils/binom_probs.py +0 -14
- most_queue-1.34/most_queue/utils/tables.py +0 -82
- most_queue-1.34/most_queue.egg-info/SOURCES.txt +0 -54
- {most_queue-1.34 → most_queue-1.36}/LICENSE +0 -0
- {most_queue-1.34 → most_queue-1.36}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: most_queue
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.36
|
|
4
4
|
Summary: Software package for calculation and simulation of queuing systems
|
|
5
|
-
Home-page: https://github.com/xabarov/
|
|
5
|
+
Home-page: https://github.com/xabarov/most-queue
|
|
6
6
|
Author: Xabarov Roman
|
|
7
7
|
Author-email: Xabarov Roman <xabarov1985@gmail.com>
|
|
8
8
|
License: Copyright (c) 2018 The Python Packaging Authority
|
|
@@ -24,7 +24,7 @@ License: Copyright (c) 2018 The Python Packaging Authority
|
|
|
24
24
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/xabarov/
|
|
27
|
+
Project-URL: Homepage, https://github.com/xabarov/most-queue
|
|
28
28
|
Classifier: Programming Language :: Python :: 3
|
|
29
29
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
@@ -94,7 +94,81 @@ Most_queue consists of two main parts:
|
|
|
94
94
|
| 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
95
95
|
|
|
96
96
|
## Usage
|
|
97
|
-
Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/
|
|
97
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/pytests) for examples
|
|
98
|
+
|
|
99
|
+
- As an example, we will provide the code for сomparison of calculation results by the Takahashi-Takami and Simulation.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
|
|
103
|
+
import math
|
|
104
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
105
|
+
from most_queue.sim import rand_destribution as rd
|
|
106
|
+
import time
|
|
107
|
+
from most_queue.theory.mgn_tt import MGnCalc
|
|
108
|
+
from most_queue.utils.tables import probs_print, times_print
|
|
109
|
+
|
|
110
|
+
n = 3 # number of channels
|
|
111
|
+
l = 1.0 # input flow intensity
|
|
112
|
+
ro = 0.8 # utilization
|
|
113
|
+
b1 = n * ro / l # mean service time
|
|
114
|
+
num_of_jobs = 300000 # num of simulation jobs
|
|
115
|
+
b_coev = 1.5 # service time coefficient of variation
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Calculation of initial moments of service time based on a given average and coefficient of variation
|
|
119
|
+
b = [0.0] * 3
|
|
120
|
+
alpha = 1 / (b_coev ** 2)
|
|
121
|
+
b[0] = b1
|
|
122
|
+
b[1] = math.pow(b[0], 2) * (math.pow(b_coev, 2) + 1)
|
|
123
|
+
b[2] = b[1] * b[0] * (1.0 + 2 / alpha)
|
|
124
|
+
|
|
125
|
+
tt_start = time.process_time()
|
|
126
|
+
|
|
127
|
+
# Run of the Takahashi-Takami method
|
|
128
|
+
tt = MGnCalc(n, l, b)
|
|
129
|
+
tt.run()
|
|
130
|
+
|
|
131
|
+
# obtaining results of numerical calculations
|
|
132
|
+
|
|
133
|
+
p_tt = tt.get_p()
|
|
134
|
+
v_tt = tt.get_v()
|
|
135
|
+
tt_time = time.process_time() - tt_start
|
|
136
|
+
|
|
137
|
+
# You can also find out how many iterations were required
|
|
138
|
+
num_of_iter = tt.num_of_iter_
|
|
139
|
+
|
|
140
|
+
# Run simulation to verify results
|
|
141
|
+
im_start = time.process_time()
|
|
142
|
+
|
|
143
|
+
qs = QueueingSystemSimulator(n)
|
|
144
|
+
|
|
145
|
+
# we set the input flow of jobs. M is exponential with intensity l
|
|
146
|
+
qs.set_sources(l, 'M')
|
|
147
|
+
|
|
148
|
+
# We set the parameters of the service channels using Gamma distribution.
|
|
149
|
+
# Select the distribution parameters
|
|
150
|
+
gamma_params = rd.Gamma.get_mu_alpha([b[0], b[1]])
|
|
151
|
+
qs.set_servers(gamma_params, 'Gamma')
|
|
152
|
+
|
|
153
|
+
# Run simulation
|
|
154
|
+
qs.run(num_of_jobs)
|
|
155
|
+
|
|
156
|
+
# Get sim results
|
|
157
|
+
p = qs.get_p()
|
|
158
|
+
v_sim = qs.v
|
|
159
|
+
im_time = time.process_time() - im_start
|
|
160
|
+
|
|
161
|
+
print("\nComparison of calculation results by the Takahashi-Takami and simulation.\n"
|
|
162
|
+
"Sim- M/Gamma/{0:^2d}\nTT- M/H2/{0:^2d}"
|
|
163
|
+
"Utilization: {1:^1.2f}\nService time coef of variation: {2:^1.2f}\n".format(n, ro, b_coev))
|
|
164
|
+
print("T-T iterations num: {0:^4d}".format(num_of_iter))
|
|
165
|
+
print("TT run time: {0:^5.3f} c".format(tt_time))
|
|
166
|
+
print("Sim run time: {0:^5.3f} c".format(im_time))
|
|
167
|
+
probs_print(p, p_tt, 10)
|
|
168
|
+
|
|
169
|
+
times_print(v_sim, v_tt, False)
|
|
170
|
+
|
|
171
|
+
```
|
|
98
172
|
|
|
99
173
|
|
|
100
174
|
|
|
@@ -60,7 +60,81 @@ Most_queue consists of two main parts:
|
|
|
60
60
|
| 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
61
61
|
|
|
62
62
|
## Usage
|
|
63
|
-
Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/
|
|
63
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/pytests) for examples
|
|
64
|
+
|
|
65
|
+
- As an example, we will provide the code for сomparison of calculation results by the Takahashi-Takami and Simulation.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
|
|
69
|
+
import math
|
|
70
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
71
|
+
from most_queue.sim import rand_destribution as rd
|
|
72
|
+
import time
|
|
73
|
+
from most_queue.theory.mgn_tt import MGnCalc
|
|
74
|
+
from most_queue.utils.tables import probs_print, times_print
|
|
75
|
+
|
|
76
|
+
n = 3 # number of channels
|
|
77
|
+
l = 1.0 # input flow intensity
|
|
78
|
+
ro = 0.8 # utilization
|
|
79
|
+
b1 = n * ro / l # mean service time
|
|
80
|
+
num_of_jobs = 300000 # num of simulation jobs
|
|
81
|
+
b_coev = 1.5 # service time coefficient of variation
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# Calculation of initial moments of service time based on a given average and coefficient of variation
|
|
85
|
+
b = [0.0] * 3
|
|
86
|
+
alpha = 1 / (b_coev ** 2)
|
|
87
|
+
b[0] = b1
|
|
88
|
+
b[1] = math.pow(b[0], 2) * (math.pow(b_coev, 2) + 1)
|
|
89
|
+
b[2] = b[1] * b[0] * (1.0 + 2 / alpha)
|
|
90
|
+
|
|
91
|
+
tt_start = time.process_time()
|
|
92
|
+
|
|
93
|
+
# Run of the Takahashi-Takami method
|
|
94
|
+
tt = MGnCalc(n, l, b)
|
|
95
|
+
tt.run()
|
|
96
|
+
|
|
97
|
+
# obtaining results of numerical calculations
|
|
98
|
+
|
|
99
|
+
p_tt = tt.get_p()
|
|
100
|
+
v_tt = tt.get_v()
|
|
101
|
+
tt_time = time.process_time() - tt_start
|
|
102
|
+
|
|
103
|
+
# You can also find out how many iterations were required
|
|
104
|
+
num_of_iter = tt.num_of_iter_
|
|
105
|
+
|
|
106
|
+
# Run simulation to verify results
|
|
107
|
+
im_start = time.process_time()
|
|
108
|
+
|
|
109
|
+
qs = QueueingSystemSimulator(n)
|
|
110
|
+
|
|
111
|
+
# we set the input flow of jobs. M is exponential with intensity l
|
|
112
|
+
qs.set_sources(l, 'M')
|
|
113
|
+
|
|
114
|
+
# We set the parameters of the service channels using Gamma distribution.
|
|
115
|
+
# Select the distribution parameters
|
|
116
|
+
gamma_params = rd.Gamma.get_mu_alpha([b[0], b[1]])
|
|
117
|
+
qs.set_servers(gamma_params, 'Gamma')
|
|
118
|
+
|
|
119
|
+
# Run simulation
|
|
120
|
+
qs.run(num_of_jobs)
|
|
121
|
+
|
|
122
|
+
# Get sim results
|
|
123
|
+
p = qs.get_p()
|
|
124
|
+
v_sim = qs.v
|
|
125
|
+
im_time = time.process_time() - im_start
|
|
126
|
+
|
|
127
|
+
print("\nComparison of calculation results by the Takahashi-Takami and simulation.\n"
|
|
128
|
+
"Sim- M/Gamma/{0:^2d}\nTT- M/H2/{0:^2d}"
|
|
129
|
+
"Utilization: {1:^1.2f}\nService time coef of variation: {2:^1.2f}\n".format(n, ro, b_coev))
|
|
130
|
+
print("T-T iterations num: {0:^4d}".format(num_of_iter))
|
|
131
|
+
print("TT run time: {0:^5.3f} c".format(tt_time))
|
|
132
|
+
print("Sim run time: {0:^5.3f} c".format(im_time))
|
|
133
|
+
probs_print(p, p_tt, 10)
|
|
134
|
+
|
|
135
|
+
times_print(v_sim, v_tt, False)
|
|
136
|
+
|
|
137
|
+
```
|
|
64
138
|
|
|
65
139
|
|
|
66
140
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: most_queue
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.36
|
|
4
4
|
Summary: Software package for calculation and simulation of queuing systems
|
|
5
|
-
Home-page: https://github.com/xabarov/
|
|
5
|
+
Home-page: https://github.com/xabarov/most-queue
|
|
6
6
|
Author: Xabarov Roman
|
|
7
7
|
Author-email: Xabarov Roman <xabarov1985@gmail.com>
|
|
8
8
|
License: Copyright (c) 2018 The Python Packaging Authority
|
|
@@ -24,7 +24,7 @@ License: Copyright (c) 2018 The Python Packaging Authority
|
|
|
24
24
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/xabarov/
|
|
27
|
+
Project-URL: Homepage, https://github.com/xabarov/most-queue
|
|
28
28
|
Classifier: Programming Language :: Python :: 3
|
|
29
29
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
@@ -94,7 +94,81 @@ Most_queue consists of two main parts:
|
|
|
94
94
|
| 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
95
95
|
|
|
96
96
|
## Usage
|
|
97
|
-
Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/
|
|
97
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/pytests) for examples
|
|
98
|
+
|
|
99
|
+
- As an example, we will provide the code for сomparison of calculation results by the Takahashi-Takami and Simulation.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
|
|
103
|
+
import math
|
|
104
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
105
|
+
from most_queue.sim import rand_destribution as rd
|
|
106
|
+
import time
|
|
107
|
+
from most_queue.theory.mgn_tt import MGnCalc
|
|
108
|
+
from most_queue.utils.tables import probs_print, times_print
|
|
109
|
+
|
|
110
|
+
n = 3 # number of channels
|
|
111
|
+
l = 1.0 # input flow intensity
|
|
112
|
+
ro = 0.8 # utilization
|
|
113
|
+
b1 = n * ro / l # mean service time
|
|
114
|
+
num_of_jobs = 300000 # num of simulation jobs
|
|
115
|
+
b_coev = 1.5 # service time coefficient of variation
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Calculation of initial moments of service time based on a given average and coefficient of variation
|
|
119
|
+
b = [0.0] * 3
|
|
120
|
+
alpha = 1 / (b_coev ** 2)
|
|
121
|
+
b[0] = b1
|
|
122
|
+
b[1] = math.pow(b[0], 2) * (math.pow(b_coev, 2) + 1)
|
|
123
|
+
b[2] = b[1] * b[0] * (1.0 + 2 / alpha)
|
|
124
|
+
|
|
125
|
+
tt_start = time.process_time()
|
|
126
|
+
|
|
127
|
+
# Run of the Takahashi-Takami method
|
|
128
|
+
tt = MGnCalc(n, l, b)
|
|
129
|
+
tt.run()
|
|
130
|
+
|
|
131
|
+
# obtaining results of numerical calculations
|
|
132
|
+
|
|
133
|
+
p_tt = tt.get_p()
|
|
134
|
+
v_tt = tt.get_v()
|
|
135
|
+
tt_time = time.process_time() - tt_start
|
|
136
|
+
|
|
137
|
+
# You can also find out how many iterations were required
|
|
138
|
+
num_of_iter = tt.num_of_iter_
|
|
139
|
+
|
|
140
|
+
# Run simulation to verify results
|
|
141
|
+
im_start = time.process_time()
|
|
142
|
+
|
|
143
|
+
qs = QueueingSystemSimulator(n)
|
|
144
|
+
|
|
145
|
+
# we set the input flow of jobs. M is exponential with intensity l
|
|
146
|
+
qs.set_sources(l, 'M')
|
|
147
|
+
|
|
148
|
+
# We set the parameters of the service channels using Gamma distribution.
|
|
149
|
+
# Select the distribution parameters
|
|
150
|
+
gamma_params = rd.Gamma.get_mu_alpha([b[0], b[1]])
|
|
151
|
+
qs.set_servers(gamma_params, 'Gamma')
|
|
152
|
+
|
|
153
|
+
# Run simulation
|
|
154
|
+
qs.run(num_of_jobs)
|
|
155
|
+
|
|
156
|
+
# Get sim results
|
|
157
|
+
p = qs.get_p()
|
|
158
|
+
v_sim = qs.v
|
|
159
|
+
im_time = time.process_time() - im_start
|
|
160
|
+
|
|
161
|
+
print("\nComparison of calculation results by the Takahashi-Takami and simulation.\n"
|
|
162
|
+
"Sim- M/Gamma/{0:^2d}\nTT- M/H2/{0:^2d}"
|
|
163
|
+
"Utilization: {1:^1.2f}\nService time coef of variation: {2:^1.2f}\n".format(n, ro, b_coev))
|
|
164
|
+
print("T-T iterations num: {0:^4d}".format(num_of_iter))
|
|
165
|
+
print("TT run time: {0:^5.3f} c".format(tt_time))
|
|
166
|
+
print("Sim run time: {0:^5.3f} c".format(im_time))
|
|
167
|
+
probs_print(p, p_tt, 10)
|
|
168
|
+
|
|
169
|
+
times_print(v_sim, v_tt, False)
|
|
170
|
+
|
|
171
|
+
```
|
|
98
172
|
|
|
99
173
|
|
|
100
174
|
|
|
File without changes
|
most_queue-1.34/most_queue.egg-info/top_level.txt → most_queue-1.36/most_queue.egg-info/not-zip-safe
RENAMED
|
File without changes
|
most_queue-1.34/most_queue.egg-info/not-zip-safe → most_queue-1.36/most_queue.egg-info/top_level.txt
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "most_queue"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.36"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="Xabarov Roman", email="xabarov1985@gmail.com" },
|
|
6
6
|
]
|
|
@@ -15,4 +15,4 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
|
|
17
17
|
[project.urls]
|
|
18
|
-
"Homepage" = "https://github.com/xabarov/
|
|
18
|
+
"Homepage" = "https://github.com/xabarov/most-queue"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
3
|
setup(name='most-queue',
|
|
4
|
-
version='1.
|
|
4
|
+
version='1.36',
|
|
5
5
|
description="Software package for calculation and simulation of queuing systems",
|
|
6
6
|
author='Xabarov Roman',
|
|
7
7
|
author_email='xabarov1985@gmail.com',
|
|
8
|
-
url='https://github.com/xabarov/
|
|
8
|
+
url='https://github.com/xabarov/most-queue',
|
|
9
9
|
classifiers=[
|
|
10
10
|
'Development Status :: 3 - Alpha',
|
|
11
11
|
'License :: OSI Approved :: MIT License',
|
|
@@ -16,16 +16,11 @@ setup(name='most-queue',
|
|
|
16
16
|
packages=find_packages(),
|
|
17
17
|
install_requires=[
|
|
18
18
|
"matplotlib",
|
|
19
|
-
"matplotlib-inline",
|
|
20
|
-
"numba",
|
|
21
19
|
"numpy",
|
|
22
20
|
"pandas",
|
|
23
21
|
"scipy",
|
|
24
22
|
"tqdm",
|
|
25
|
-
"
|
|
26
|
-
'networkx',
|
|
27
|
-
'graphviz',
|
|
28
|
-
'colorama'
|
|
23
|
+
"colorama"
|
|
29
24
|
],
|
|
30
25
|
include_package_data=True,
|
|
31
|
-
zip_safe=False)
|
|
26
|
+
zip_safe=False)
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
from qs_sim import QueueingSystemSimulator, Task
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class QueueingSystemBatchSim(QueueingSystemSimulator):
|
|
7
|
-
def __init__(self, num_of_channels, batch_prob, buffer=None, verbose=True):
|
|
8
|
-
super().__init__(num_of_channels, buffer, verbose)
|
|
9
|
-
|
|
10
|
-
self.batch_prob = batch_prob
|
|
11
|
-
self.calc_cdf_prob()
|
|
12
|
-
|
|
13
|
-
def calc_cdf_prob(self):
|
|
14
|
-
summ = 0
|
|
15
|
-
self.batch_cdf = []
|
|
16
|
-
for p in self.batch_prob:
|
|
17
|
-
summ += p
|
|
18
|
-
self.batch_cdf.append(summ)
|
|
19
|
-
|
|
20
|
-
def arrival(self):
|
|
21
|
-
|
|
22
|
-
"""
|
|
23
|
-
Действия по прибытию заявки в СМО.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
p = np.random.random()
|
|
27
|
-
batch_size = 0
|
|
28
|
-
for i, batch_prob in enumerate(self.batch_cdf):
|
|
29
|
-
if p < batch_prob:
|
|
30
|
-
batch_size = i + 1
|
|
31
|
-
break
|
|
32
|
-
|
|
33
|
-
self.ttek = self.arrival_time
|
|
34
|
-
self.t_old = self.ttek
|
|
35
|
-
|
|
36
|
-
if self.cuda:
|
|
37
|
-
self.arrival_time = self.ttek + self.source_random_vars[self.tek_source_num]
|
|
38
|
-
self.tek_source_num += 1
|
|
39
|
-
if self.tek_source_num == len(self.source_random_vars):
|
|
40
|
-
self.tek_source_num = 0
|
|
41
|
-
else:
|
|
42
|
-
self.arrival_time = self.ttek + self.source.generate()
|
|
43
|
-
|
|
44
|
-
for tsk in range(batch_size):
|
|
45
|
-
self.arrived += 1
|
|
46
|
-
self.p[self.in_sys] += self.arrival_time - self.t_old
|
|
47
|
-
|
|
48
|
-
self.in_sys += 1
|
|
49
|
-
|
|
50
|
-
if self.free_channels == 0:
|
|
51
|
-
if self.buffer == None: # не задана длина очередиб т.е бесконечная очередь
|
|
52
|
-
new_tsk = Task(self.ttek)
|
|
53
|
-
new_tsk.start_waiting_time = self.ttek
|
|
54
|
-
self.queue.append(new_tsk)
|
|
55
|
-
else:
|
|
56
|
-
if len(self.queue) < self.buffer:
|
|
57
|
-
new_tsk = Task(self.ttek)
|
|
58
|
-
new_tsk.start_waiting_time = self.ttek
|
|
59
|
-
self.queue.append(new_tsk)
|
|
60
|
-
else:
|
|
61
|
-
self.dropped += 1
|
|
62
|
-
self.in_sys -= 1
|
|
63
|
-
|
|
64
|
-
else: # there are free channels:
|
|
65
|
-
|
|
66
|
-
# check if its a warm phase:
|
|
67
|
-
is_warm_start = False
|
|
68
|
-
if len(self.queue) == 0 and self.free_channels == self.n and self.is_set_warm:
|
|
69
|
-
is_warm_start = True
|
|
70
|
-
|
|
71
|
-
for s in self.servers:
|
|
72
|
-
if s.is_free:
|
|
73
|
-
self.taked += 1
|
|
74
|
-
s.start_service(Task(self.ttek), self.ttek, is_warm_start)
|
|
75
|
-
self.free_channels -= 1
|
|
76
|
-
|
|
77
|
-
# Проверям, не наступил ли ПНЗ:
|
|
78
|
-
if self.free_channels == 0:
|
|
79
|
-
if self.in_sys == self.n:
|
|
80
|
-
self.start_ppnz = self.ttek
|
|
81
|
-
break
|
|
82
|
-
|
|
83
|
-
|