most-queue 1.44__tar.gz → 1.45__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.44 → most_queue-1.45}/PKG-INFO +74 -14
- {most_queue-1.44 → most_queue-1.45}/README.md +73 -13
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/fj_sim.py +14 -7
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/priority_network.py +13 -6
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/priority_queue_sim.py +12 -9
- most_queue-1.45/most_queue/sim/qs_sim.py +550 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/phase.py +27 -0
- most_queue-1.45/most_queue/sim/utils/stats_update.py +16 -0
- most_queue-1.45/most_queue/tests/test_ek_d_n.py +73 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mgn_with_h2_delay_cold_warm.py +11 -11
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mmn_h2cold_h2warm.py +1 -1
- {most_queue-1.44 → most_queue-1.45}/most_queue.egg-info/PKG-INFO +74 -14
- {most_queue-1.44 → most_queue-1.45}/most_queue.egg-info/SOURCES.txt +1 -0
- {most_queue-1.44 → most_queue-1.45}/pyproject.toml +1 -1
- {most_queue-1.44 → most_queue-1.45}/setup.py +1 -1
- most_queue-1.44/most_queue/sim/qs_sim.py +0 -627
- most_queue-1.44/most_queue/tests/test_ek_d_n.py +0 -72
- {most_queue-1.44 → most_queue-1.45}/LICENSE +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/general_utils/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/general_utils/approx_cdf_make.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/general_utils/conv.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/general_utils/tables.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/general_utils/vacations_paper_utils.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/rand_distribution.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/batch_sim.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/fj_delta_sim.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/flow_sum_sim.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/impatient_queue_sim.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/queue_finite_source_sim.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/distribution_utils.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/exceptions.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/qs_queue.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/servers.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/sim/utils/tasks.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_batch.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_engset.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_fj_delta.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_fj_im.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_gi_m_1_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_gi_m_n_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_impatience.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_m_d_n_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_m_h2_h2warm.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_m_ph_n_prty.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mg1_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mgn_tt.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mmn3_pnz_cox_approx.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_mmn_prty_pnz_approx.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_network_im_prty.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_qs_sim_prty.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_qs_sim_test.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/tests/test_queue_types.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/batch_mm1.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/ek_d_n_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/engset_model.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/fj_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/gi_m_1_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/gi_m_n_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/impatience_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/m_d_n_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/m_h2_h2warm.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/m_ph_n_prty.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mg1_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mg1_warm_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mgn_tt.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mgn_with_h2_delay_cold_warm.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mmn3_pnz_cox_approx.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mmn_prty_pnz_approx.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mmn_with_h2_cold_and_h2_warmup.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/mmnr_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/network_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/network_viewer.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/priority_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/__init__.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/binom_probs.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/diff5dots.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/flow_sum.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/passage_time.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/q_poisson_arrival_calc.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/student_stat.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue/theory/utils/weibull.py +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue.egg-info/dependency_links.txt +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue.egg-info/not-zip-safe +0 -0
- {most_queue-1.44 → most_queue-1.45}/most_queue.egg-info/top_level.txt +0 -0
- {most_queue-1.44 → most_queue-1.45}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: most_queue
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.45
|
|
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
|
|
@@ -32,8 +32,15 @@ Requires-Python: >=3.7
|
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
|
|
35
|
-
#
|
|
36
|
-
|
|
35
|
+
# MostQueue
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
Python package for calculation and simulation of queueing systems (QS) and networks.
|
|
40
|
+
Queueing theory. Numerical methods.
|
|
41
|
+
|
|
42
|
+
Пакет python для расчета и моделирования систем массового обслуживания (СМО) и сетей (СеМО).
|
|
43
|
+
Теория массового обслуживания. Численные методы.
|
|
37
44
|
|
|
38
45
|
## Authors
|
|
39
46
|
- [xabarov](https://github.com/xabarov)
|
|
@@ -42,12 +49,15 @@ Python package for calculation and simulation of queuing systems (QS) and networ
|
|
|
42
49
|
Install most-queue with pip
|
|
43
50
|
```bash
|
|
44
51
|
pip install most-queue
|
|
52
|
+
pip install -r requirements.txt
|
|
45
53
|
```
|
|
46
54
|
|
|
47
55
|
## DESCRIPTION
|
|
48
56
|
Most_queue consists of two main parts:
|
|
49
57
|
- **.theory** contains programs that implement methods for calculating queuing theory models.
|
|
50
58
|
- **.sim** contains simulation programs.
|
|
59
|
+
- **.tests** contains tests.
|
|
60
|
+
- **.rand_distribution** - A set of functions and classes designed to generate a random values and select parameters for distributions like H2, C2, Ek, Pa, Gamma
|
|
51
61
|
|
|
52
62
|
### Package .theory
|
|
53
63
|
| # | Package name | Description |
|
|
@@ -85,16 +95,66 @@ Most_queue consists of two main parts:
|
|
|
85
95
|
| 1. | fj_delta_sim | Simulation of QS fork-join with a delay in the start of processing between channels |
|
|
86
96
|
| 2. | fj_sim | Simulation of QS with fork-join process |
|
|
87
97
|
| 3. | priority_network | Simulation of queuing network with priorities in nodes |
|
|
88
|
-
| 4. |
|
|
89
|
-
| 5. |
|
|
90
|
-
| 6. |
|
|
91
|
-
| 7. |
|
|
92
|
-
| 8. |
|
|
93
|
-
| 9. |
|
|
94
|
-
| 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
98
|
+
| 4. | qs_sim | Simulation of QS GI/G/m/n |
|
|
99
|
+
| 5. | priority_queue_sim | Simulation of QS GI/G/m/n with priorities |
|
|
100
|
+
| 6. | flow_sum_sim | Simulation of flow summation |
|
|
101
|
+
| 7. | impatient_sim.py | Simulation of QS GI/G/m/n with impatience |
|
|
102
|
+
| 8. | batch_sim.py | Simulation of QS GI/G/m/n with batch arrival |
|
|
103
|
+
| 9. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
95
104
|
|
|
96
105
|
## Usage
|
|
97
|
-
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/
|
|
106
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/tests) for examples
|
|
107
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/tutorials) for jupyter tutorials
|
|
108
|
+
|
|
109
|
+
- Simple example: numeric calc for M/G/1 QS. Run simulation for verification
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
|
|
113
|
+
import numpy as np
|
|
114
|
+
|
|
115
|
+
from most_queue.general_utils.tables import probs_print, times_print
|
|
116
|
+
from most_queue.rand_distribution import H2_dist, Pareto_dist, Uniform_dist
|
|
117
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
118
|
+
from most_queue.theory.mg1_calc import get_p, get_v, get_w
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
"""
|
|
122
|
+
Test QS M/G/1
|
|
123
|
+
"""
|
|
124
|
+
arrival_lambda = 1 # arrival intensity
|
|
125
|
+
b1 = 0.7 # mean serving time
|
|
126
|
+
coev = 1.2 # standard deviation of serving time
|
|
127
|
+
num_of_jobs = 1000000 # jobs num for simulation
|
|
128
|
+
|
|
129
|
+
# get of parameters of the approximating H2-distribution for service time [y1, mu1, mu2]:
|
|
130
|
+
params = H2_dist.get_params_by_mean_and_coev(b1, coev)
|
|
131
|
+
b = H2_dist.calc_theory_moments(*params, 4)
|
|
132
|
+
|
|
133
|
+
# get wait moments, sojourn time, probs by numeric calc
|
|
134
|
+
w_ch = get_w(arrival_lambda, b)
|
|
135
|
+
v_ch = get_v(arrival_lambda, b)
|
|
136
|
+
p_ch = get_p(arrival_lambda, b, 100)
|
|
137
|
+
|
|
138
|
+
# run simulation for verification
|
|
139
|
+
qs = QueueingSystemSimulator(1) # 1 - num of channels
|
|
140
|
+
|
|
141
|
+
qs.set_servers(params, "H")
|
|
142
|
+
qs.set_sources(arrival_lambda, "M")
|
|
143
|
+
|
|
144
|
+
qs.run(num_of_jobs)
|
|
145
|
+
|
|
146
|
+
# get sim results
|
|
147
|
+
w_sim = qs.w
|
|
148
|
+
p_sim = qs.get_p()
|
|
149
|
+
v_sim = qs.v
|
|
150
|
+
|
|
151
|
+
print("M/H2/1")
|
|
152
|
+
|
|
153
|
+
times_print(w_sim, w_ch, True)
|
|
154
|
+
times_print(v_sim, v_ch, False)
|
|
155
|
+
probs_print(p_sim, p_ch, 10)
|
|
156
|
+
|
|
157
|
+
```
|
|
98
158
|
|
|
99
159
|
- As an example, we will provide the code for сomparison of calculation results by the Takahashi-Takami and Simulation.
|
|
100
160
|
|
|
@@ -102,10 +162,10 @@ Most_queue consists of two main parts:
|
|
|
102
162
|
|
|
103
163
|
import math
|
|
104
164
|
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
105
|
-
from most_queue.
|
|
165
|
+
from most_queue.rand_distribution import Gamma
|
|
106
166
|
import time
|
|
107
167
|
from most_queue.theory.mgn_tt import MGnCalc
|
|
108
|
-
from most_queue.
|
|
168
|
+
from most_queue.general_utils.tables import probs_print, times_print
|
|
109
169
|
|
|
110
170
|
n = 3 # number of channels
|
|
111
171
|
l = 1.0 # input flow intensity
|
|
@@ -147,7 +207,7 @@ Most_queue consists of two main parts:
|
|
|
147
207
|
|
|
148
208
|
# We set the parameters of the service channels using Gamma distribution.
|
|
149
209
|
# Select the distribution parameters
|
|
150
|
-
gamma_params =
|
|
210
|
+
gamma_params = Gamma.get_mu_alpha([b[0], b[1]])
|
|
151
211
|
qs.set_servers(gamma_params, 'Gamma')
|
|
152
212
|
|
|
153
213
|
# Run simulation
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# MostQueue
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Python package for calculation and simulation of queueing systems (QS) and networks.
|
|
6
|
+
Queueing theory. Numerical methods.
|
|
7
|
+
|
|
8
|
+
Пакет python для расчета и моделирования систем массового обслуживания (СМО) и сетей (СеМО).
|
|
9
|
+
Теория массового обслуживания. Численные методы.
|
|
3
10
|
|
|
4
11
|
## Authors
|
|
5
12
|
- [xabarov](https://github.com/xabarov)
|
|
@@ -8,12 +15,15 @@ Python package for calculation and simulation of queuing systems (QS) and networ
|
|
|
8
15
|
Install most-queue with pip
|
|
9
16
|
```bash
|
|
10
17
|
pip install most-queue
|
|
18
|
+
pip install -r requirements.txt
|
|
11
19
|
```
|
|
12
20
|
|
|
13
21
|
## DESCRIPTION
|
|
14
22
|
Most_queue consists of two main parts:
|
|
15
23
|
- **.theory** contains programs that implement methods for calculating queuing theory models.
|
|
16
24
|
- **.sim** contains simulation programs.
|
|
25
|
+
- **.tests** contains tests.
|
|
26
|
+
- **.rand_distribution** - A set of functions and classes designed to generate a random values and select parameters for distributions like H2, C2, Ek, Pa, Gamma
|
|
17
27
|
|
|
18
28
|
### Package .theory
|
|
19
29
|
| # | Package name | Description |
|
|
@@ -51,16 +61,66 @@ Most_queue consists of two main parts:
|
|
|
51
61
|
| 1. | fj_delta_sim | Simulation of QS fork-join with a delay in the start of processing between channels |
|
|
52
62
|
| 2. | fj_sim | Simulation of QS with fork-join process |
|
|
53
63
|
| 3. | priority_network | Simulation of queuing network with priorities in nodes |
|
|
54
|
-
| 4. |
|
|
55
|
-
| 5. |
|
|
56
|
-
| 6. |
|
|
57
|
-
| 7. |
|
|
58
|
-
| 8. |
|
|
59
|
-
| 9. |
|
|
60
|
-
| 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
64
|
+
| 4. | qs_sim | Simulation of QS GI/G/m/n |
|
|
65
|
+
| 5. | priority_queue_sim | Simulation of QS GI/G/m/n with priorities |
|
|
66
|
+
| 6. | flow_sum_sim | Simulation of flow summation |
|
|
67
|
+
| 7. | impatient_sim.py | Simulation of QS GI/G/m/n with impatience |
|
|
68
|
+
| 8. | batch_sim.py | Simulation of QS GI/G/m/n with batch arrival |
|
|
69
|
+
| 9. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
|
|
61
70
|
|
|
62
71
|
## Usage
|
|
63
|
-
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/
|
|
72
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/tests) for examples
|
|
73
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/tutorials) for jupyter tutorials
|
|
74
|
+
|
|
75
|
+
- Simple example: numeric calc for M/G/1 QS. Run simulation for verification
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
|
|
79
|
+
import numpy as np
|
|
80
|
+
|
|
81
|
+
from most_queue.general_utils.tables import probs_print, times_print
|
|
82
|
+
from most_queue.rand_distribution import H2_dist, Pareto_dist, Uniform_dist
|
|
83
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
84
|
+
from most_queue.theory.mg1_calc import get_p, get_v, get_w
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
Test QS M/G/1
|
|
89
|
+
"""
|
|
90
|
+
arrival_lambda = 1 # arrival intensity
|
|
91
|
+
b1 = 0.7 # mean serving time
|
|
92
|
+
coev = 1.2 # standard deviation of serving time
|
|
93
|
+
num_of_jobs = 1000000 # jobs num for simulation
|
|
94
|
+
|
|
95
|
+
# get of parameters of the approximating H2-distribution for service time [y1, mu1, mu2]:
|
|
96
|
+
params = H2_dist.get_params_by_mean_and_coev(b1, coev)
|
|
97
|
+
b = H2_dist.calc_theory_moments(*params, 4)
|
|
98
|
+
|
|
99
|
+
# get wait moments, sojourn time, probs by numeric calc
|
|
100
|
+
w_ch = get_w(arrival_lambda, b)
|
|
101
|
+
v_ch = get_v(arrival_lambda, b)
|
|
102
|
+
p_ch = get_p(arrival_lambda, b, 100)
|
|
103
|
+
|
|
104
|
+
# run simulation for verification
|
|
105
|
+
qs = QueueingSystemSimulator(1) # 1 - num of channels
|
|
106
|
+
|
|
107
|
+
qs.set_servers(params, "H")
|
|
108
|
+
qs.set_sources(arrival_lambda, "M")
|
|
109
|
+
|
|
110
|
+
qs.run(num_of_jobs)
|
|
111
|
+
|
|
112
|
+
# get sim results
|
|
113
|
+
w_sim = qs.w
|
|
114
|
+
p_sim = qs.get_p()
|
|
115
|
+
v_sim = qs.v
|
|
116
|
+
|
|
117
|
+
print("M/H2/1")
|
|
118
|
+
|
|
119
|
+
times_print(w_sim, w_ch, True)
|
|
120
|
+
times_print(v_sim, v_ch, False)
|
|
121
|
+
probs_print(p_sim, p_ch, 10)
|
|
122
|
+
|
|
123
|
+
```
|
|
64
124
|
|
|
65
125
|
- As an example, we will provide the code for сomparison of calculation results by the Takahashi-Takami and Simulation.
|
|
66
126
|
|
|
@@ -68,10 +128,10 @@ Most_queue consists of two main parts:
|
|
|
68
128
|
|
|
69
129
|
import math
|
|
70
130
|
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
71
|
-
from most_queue.
|
|
131
|
+
from most_queue.rand_distribution import Gamma
|
|
72
132
|
import time
|
|
73
133
|
from most_queue.theory.mgn_tt import MGnCalc
|
|
74
|
-
from most_queue.
|
|
134
|
+
from most_queue.general_utils.tables import probs_print, times_print
|
|
75
135
|
|
|
76
136
|
n = 3 # number of channels
|
|
77
137
|
l = 1.0 # input flow intensity
|
|
@@ -113,7 +173,7 @@ Most_queue consists of two main parts:
|
|
|
113
173
|
|
|
114
174
|
# We set the parameters of the service channels using Gamma distribution.
|
|
115
175
|
# Select the distribution parameters
|
|
116
|
-
gamma_params =
|
|
176
|
+
gamma_params = Gamma.get_mu_alpha([b[0], b[1]])
|
|
117
177
|
qs.set_servers(gamma_params, 'Gamma')
|
|
118
178
|
|
|
119
179
|
# Run simulation
|
|
@@ -163,15 +163,22 @@ class ForkJoinSim(QueueingSystemSimulator):
|
|
|
163
163
|
else:
|
|
164
164
|
self.serving(num_of_server_earlier)
|
|
165
165
|
|
|
166
|
-
def run(self, total_served, is_real_served=
|
|
166
|
+
def run(self, total_served, is_real_served=True):
|
|
167
167
|
|
|
168
168
|
if is_real_served:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
|
|
170
|
+
last_percent = 0
|
|
171
|
+
|
|
172
|
+
with tqdm(total=100, unit='jobs') as pbar:
|
|
173
|
+
while self.served < total_served:
|
|
174
|
+
self.run_one_step()
|
|
175
|
+
percent = int(100*(self.served/total_served))
|
|
176
|
+
if last_percent != percent:
|
|
177
|
+
last_percent = percent
|
|
178
|
+
pbar.update(1)
|
|
179
|
+
pbar.set_description(Fore.MAGENTA + '\rJob served: ' +
|
|
180
|
+
Fore.YELLOW + f'{self.served}/{total_served}' + Fore.LIGHTGREEN_EX)
|
|
181
|
+
|
|
175
182
|
else:
|
|
176
183
|
print(Fore.GREEN + '\rStart simulation')
|
|
177
184
|
print(Style.RESET_ALL)
|
|
@@ -6,8 +6,8 @@ import numpy as np
|
|
|
6
6
|
from colorama import Fore, Style, init
|
|
7
7
|
from tqdm import tqdm
|
|
8
8
|
|
|
9
|
-
from most_queue.sim.priority_queue_sim import PriorityQueueSimulator, Task
|
|
10
9
|
from most_queue.rand_distribution import Exp_dist
|
|
10
|
+
from most_queue.sim.priority_queue_sim import PriorityQueueSimulator, Task
|
|
11
11
|
|
|
12
12
|
init()
|
|
13
13
|
|
|
@@ -139,15 +139,22 @@ class PriorityNetwork:
|
|
|
139
139
|
|
|
140
140
|
self.smos[next_node].arrival(next_node_class, self.ttek, ts)
|
|
141
141
|
|
|
142
|
-
def run(self, job_served, is_real_served=
|
|
142
|
+
def run(self, job_served, is_real_served=True):
|
|
143
143
|
"""
|
|
144
144
|
Run simulation
|
|
145
145
|
"""
|
|
146
146
|
if is_real_served:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
last_percent = 0
|
|
148
|
+
|
|
149
|
+
with tqdm(total=100, unit='jobs') as pbar:
|
|
150
|
+
while sum(self.served) < job_served:
|
|
151
|
+
self.run_one_step()
|
|
152
|
+
percent = int(100*(sum(self.served)/job_served))
|
|
153
|
+
if last_percent != percent:
|
|
154
|
+
last_percent = percent
|
|
155
|
+
pbar.update(1)
|
|
156
|
+
pbar.set_description(Fore.MAGENTA + '\rJob served: ' +
|
|
157
|
+
Fore.YELLOW + f'{sum(self.served)}/{job_served}' + Fore.LIGHTGREEN_EX)
|
|
151
158
|
else:
|
|
152
159
|
print(Fore.GREEN + '\rStart simulation')
|
|
153
160
|
print(Style.RESET_ALL)
|
|
@@ -549,15 +549,18 @@ class PriorityQueueSimulator:
|
|
|
549
549
|
|
|
550
550
|
print(Fore.GREEN + '\rStart simulation')
|
|
551
551
|
if is_real_served:
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
552
|
+
|
|
553
|
+
last_percent = 0
|
|
554
|
+
|
|
555
|
+
with tqdm(total=100, unit='jobs') as pbar:
|
|
556
|
+
while sum(self.served) < total_served:
|
|
557
|
+
self.run_one_step()
|
|
558
|
+
percent = int(100*(sum(self.served)/total_served))
|
|
559
|
+
if last_percent != percent:
|
|
560
|
+
last_percent = percent
|
|
561
|
+
pbar.update(1)
|
|
562
|
+
pbar.set_description(Fore.MAGENTA + '\rJob served: ' +
|
|
563
|
+
Fore.YELLOW + f'{sum(self.served)}/{total_served}' + Fore.LIGHTGREEN_EX)
|
|
561
564
|
|
|
562
565
|
else:
|
|
563
566
|
for i in tqdm(range(total_served)):
|