most-queue 1.33__tar.gz → 1.35__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 (84) hide show
  1. {most_queue-1.33 → most_queue-1.35}/LICENSE +0 -0
  2. {most_queue-1.33 → most_queue-1.35}/PKG-INFO +178 -104
  3. {most_queue-1.33 → most_queue-1.35}/README.md +75 -1
  4. {most_queue-1.33 → most_queue-1.35}/most_queue.egg-info/PKG-INFO +178 -104
  5. most_queue-1.35/most_queue.egg-info/SOURCES.txt +9 -0
  6. {most_queue-1.33 → most_queue-1.35}/most_queue.egg-info/not-zip-safe +1 -1
  7. most_queue-1.35/most_queue.egg-info/top_level.txt +1 -0
  8. {most_queue-1.33 → most_queue-1.35}/pyproject.toml +1 -1
  9. {most_queue-1.33 → most_queue-1.35}/setup.cfg +4 -4
  10. {most_queue-1.33 → most_queue-1.35}/setup.py +2 -2
  11. most_queue-1.33/most_queue/__init__.py +0 -0
  12. most_queue-1.33/most_queue/sim/__init__.py +0 -3
  13. most_queue-1.33/most_queue/sim/batch_sim.py +0 -117
  14. most_queue-1.33/most_queue/sim/fj_delta_sim.py +0 -368
  15. most_queue-1.33/most_queue/sim/fj_sim.py +0 -329
  16. most_queue-1.33/most_queue/sim/flow_sum_sim.py +0 -270
  17. most_queue-1.33/most_queue/sim/impatient_queue_sim.py +0 -192
  18. most_queue-1.33/most_queue/sim/priority_network.py +0 -245
  19. most_queue-1.33/most_queue/sim/priority_queue_sim.py +0 -882
  20. most_queue-1.33/most_queue/sim/qs_sim.py +0 -970
  21. most_queue-1.33/most_queue/sim/queue_finite_source_sim.py +0 -303
  22. most_queue-1.33/most_queue/sim/rand_destribution.py +0 -1030
  23. most_queue-1.33/most_queue/tests/__init__.py +0 -0
  24. most_queue-1.33/most_queue/tests/ek_d_n.py +0 -66
  25. most_queue-1.33/most_queue/tests/fj_calc.py +0 -117
  26. most_queue-1.33/most_queue/tests/fj_im.py +0 -103
  27. most_queue-1.33/most_queue/tests/flow_sum.py +0 -98
  28. most_queue-1.33/most_queue/tests/gi_m_1_calc.py +0 -110
  29. most_queue-1.33/most_queue/tests/gi_m_n_calc.py +0 -113
  30. most_queue-1.33/most_queue/tests/m_d_n_calc.py +0 -52
  31. most_queue-1.33/most_queue/tests/m_h2_h2warm.py +0 -73
  32. most_queue-1.33/most_queue/tests/m_ph_n_prty.py +0 -152
  33. most_queue-1.33/most_queue/tests/mg1_calc.py +0 -83
  34. most_queue-1.33/most_queue/tests/mg1_warm_calc.py +0 -29
  35. most_queue-1.33/most_queue/tests/mgn_tt.py +0 -84
  36. most_queue-1.33/most_queue/tests/mmn3_pnz_cox_approx.py +0 -79
  37. most_queue-1.33/most_queue/tests/mmn_prty_pnz_approx.py +0 -68
  38. most_queue-1.33/most_queue/tests/network_im_prty.py +0 -127
  39. most_queue-1.33/most_queue/tests/smo_im.py +0 -58
  40. most_queue-1.33/most_queue/tests/smo_im_prty.py +0 -105
  41. most_queue-1.33/most_queue/tests/weibull.py +0 -36
  42. most_queue-1.33/most_queue/theory/__init__.py +0 -1
  43. most_queue-1.33/most_queue/theory/batch_mm1.py +0 -100
  44. most_queue-1.33/most_queue/theory/convolution_sum_calc.py +0 -23
  45. most_queue-1.33/most_queue/theory/diff5dots.py +0 -30
  46. most_queue-1.33/most_queue/theory/ek_d_n_calc.py +0 -176
  47. most_queue-1.33/most_queue/theory/engset_model.py +0 -167
  48. most_queue-1.33/most_queue/theory/fj_calc.py +0 -681
  49. most_queue-1.33/most_queue/theory/flow_sum.py +0 -295
  50. most_queue-1.33/most_queue/theory/generate_pareto_noise.py +0 -51
  51. most_queue-1.33/most_queue/theory/gi_m_1_calc.py +0 -147
  52. most_queue-1.33/most_queue/theory/gi_m_n_calc.py +0 -209
  53. most_queue-1.33/most_queue/theory/impatience_calc.py +0 -103
  54. most_queue-1.33/most_queue/theory/m_d_n_calc.py +0 -133
  55. most_queue-1.33/most_queue/theory/m_h2_h2warm.py +0 -761
  56. most_queue-1.33/most_queue/theory/m_ph_n_prty.py +0 -788
  57. most_queue-1.33/most_queue/theory/mg1_calc.py +0 -149
  58. most_queue-1.33/most_queue/theory/mg1_warm_calc.py +0 -54
  59. most_queue-1.33/most_queue/theory/mgn_tt.py +0 -504
  60. most_queue-1.33/most_queue/theory/mgn_with_h2_delay_cold_warm.py +0 -863
  61. most_queue-1.33/most_queue/theory/mmn3_pnz_cox_approx.py +0 -532
  62. most_queue-1.33/most_queue/theory/mmn_prty_pnz_approx.py +0 -661
  63. most_queue-1.33/most_queue/theory/mmn_with_h2_cold_and_h2_warmup.py +0 -691
  64. most_queue-1.33/most_queue/theory/mmnr_calc.py +0 -74
  65. most_queue-1.33/most_queue/theory/network_calc.py +0 -189
  66. most_queue-1.33/most_queue/theory/network_viewer.py +0 -88
  67. most_queue-1.33/most_queue/theory/passage_time.py +0 -1032
  68. most_queue-1.33/most_queue/theory/priority_calc.py +0 -548
  69. most_queue-1.33/most_queue/theory/q_poisson_arrival_calc.py +0 -60
  70. most_queue-1.33/most_queue/theory/student_stat.py +0 -184
  71. most_queue-1.33/most_queue/theory/weibull.py +0 -113
  72. most_queue-1.33/most_queue/utils/__init__.py +0 -0
  73. most_queue-1.33/most_queue/utils/approx_cdf_make.py +0 -79
  74. most_queue-1.33/most_queue/utils/binom_probs.py +0 -14
  75. most_queue-1.33/most_queue/utils/tables.py +0 -82
  76. most_queue-1.33/most_queue/visualisation/__init__.py +0 -0
  77. most_queue-1.33/most_queue/visualisation/smo_im_vis.py +0 -959
  78. most_queue-1.33/most_queue/visualisation/utils/__init__.py +0 -0
  79. most_queue-1.33/most_queue/visualisation/utils/result_table.py +0 -78
  80. most_queue-1.33/most_queue/visualisation/utils/settings_window.py +0 -357
  81. most_queue-1.33/most_queue/visualisation/utils/splash_screen.py +0 -49
  82. most_queue-1.33/most_queue.egg-info/SOURCES.txt +0 -80
  83. most_queue-1.33/most_queue.egg-info/top_level.txt +0 -1
  84. {most_queue-1.33 → most_queue-1.35}/most_queue.egg-info/dependency_links.txt +0 -0
File without changes
@@ -1,104 +1,178 @@
1
- Metadata-Version: 2.1
2
- Name: most_queue
3
- Version: 1.33
4
- Summary: Software package for calculation and simulation of queuing systems
5
- Home-page: https://github.com/xabarov/mps
6
- Author: Xabarov Roman
7
- Author-email: Xabarov Roman <xabarov1985@gmail.com>
8
- License: Copyright (c) 2018 The Python Packaging Authority
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
- Project-URL: Homepage, https://github.com/xabarov/mps
28
- Classifier: Programming Language :: Python :: 3
29
- Classifier: License :: OSI Approved :: MIT License
30
- Classifier: Operating System :: OS Independent
31
- Requires-Python: >=3.7
32
- Description-Content-Type: text/markdown
33
- License-File: LICENSE
34
-
35
- # most_queue
36
- Python package for calculation and simulation of queuing systems (QS) and networks
37
-
38
- ## Authors
39
- - [xabarov](https://github.com/xabarov)
40
-
41
- ## Installation
42
- Install most-queue with pip
43
- ```bash
44
- pip install most-queue
45
- ```
46
-
47
- ## DESCRIPTION
48
- Most_queue consists of two main parts:
49
- - **.theory** contains programs that implement methods for calculating queuing theory models.
50
- - **.sim** contains simulation programs.
51
-
52
- ### Package .theory
53
- | # | Package name | Description |
54
- |-----|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55
- | 1. | diff5dots | Numerical calculation of the derivative of a function |
56
- | 2. | fj_calc | Numerical calculation of the initial moments of the random variables maximum distribution |
57
- | 3. | m_ph_n_prty | Numerical calculation of QS M/Ph/n with 2 classes and PR - priority. Based on the approximation of busy periods |
58
- | 4. | mg1_calc | Numerical calculation of QS M/G/1 |
59
- | 5. | gi_m_1_calc | Numerical calculation of QS GI/M/1 |
60
- | 6. | gi_m_n_calc | Numerical calculation of QS GI/M/n |
61
- | 7. | m_d_n_calc | Numerical calculation of QS M/D/n |
62
- | 8. | ek_d_n_calc | Numerical calculation of QS Ek/D/n |
63
- | 9. | mg1_warm_calc | Numerical calculation of QS M/G/1 with "warm-up" |
64
- | 10. | mgn_tt | Numerical calculation of QS M/H2/n by the Takahashi-Takami method with complex parameters when approximating the serving time by the H2 distribution |
65
- | 11. | mmn3_pnz_cox_approx | Calculation of QS M/M/2 with 3 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of busy period by the Cox distribution |
66
- | 12. | mmn_prty_pnz_approx | Calculation of QS M/M/2 with 2 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of the busy period by the Cox distribution |
67
- | 13. | mmnr_calc | Calculation of QS M/M/n/r |
68
- | 14. | network_calc | Calculation of queuing network with priorities in nodes |
69
- | 15. | passage_time | Calculation of the initial transition times between arbitrary tiers of the Markov chain |
70
- | 16. | priority_calc | A set of functions for calculating QS with priorities (single-channel, multi-channel). The multichannel calculation is carried out by the method of relation invariants |
71
- | 17. | student_stat | Calculation of confidence probability, confidence intervals for random variable with unknown RMS based on Student's t-distribution. |
72
- | 18. | convolution_sum_calc | Calculate the initial moments of sums of random variables |
73
- | 19. | weibull | Selection of Weibull distribution parameters, calculation of CDF, PDF, Tail values |
74
- | 20. | flow_sum | Flow summation, numerical calculation |
75
- | 21. | impatience_calc | Calculation of M/M/1 with exponential impatience |
76
- | 22. | batch_mm1 | Calculation of QS M/M/1 with batch arrival |
77
- | 23. | engset_model.py | Calculation of QS M/M/1 with finite sources |
78
- | 24. | generate_pareto_noise.py.py | Create noise by Pareto dist |
79
- | 25. | network_viewer.py | Utility to view network structure |
80
- | 26. | mmn_with_h2_cold_h2_warmup.py | Multichannel queuing system with exp serving time, H2 warm-up and H2 cold (vacations). The system uses complex parameters, which allows to calculate systems with arbitrary warm-up and cold variation coefficients |
81
- | 27. | mgn_with_h2_delay_cold_warm.py | Multichannel queuing system with H2 serving time, H2 warm-up, H2 cold delay and H2 cold (vacations). The system uses complex parameters, which allows you to calculate systems with arbitrary serving, warm-up, cold-delay and cold variation coefficients |
82
- ### Package .sim
83
- | # | Package name | Description |
84
- | ------------- |----------------------------|------------- |
85
- | 1. | fj_delta_sim | Simulation of QS fork-join with a delay in the start of processing between channels |
86
- | 2. | fj_sim | Simulation of QS with fork-join process |
87
- | 3. | priority_network | Simulation of queuing network with priorities in nodes |
88
- | 4. | rand_distribution | A set of functions and classes designed to generate a PRNG and select parameters for distributions H2, C2, Ek, Pa, Gamma |
89
- | 5. | qs_sim | Simulation of QS GI/G/m/n |
90
- | 6. | priority_queue_sim | Simulation of QS GI/G/m/n with priorities |
91
- | 7. | flow_sum_sim | Simulation of flow summation |
92
- | 8. | impatient_sim.py | Simulation of QS GI/G/m/n with impatience |
93
- | 9. | batch_sim.py | Simulation of QS GI/G/m/n with batch arrival |
94
- | 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
95
-
96
- ## Usage
97
- Look [here](https://github.com/xabarov/most-queue/tree/main/most_queue/tests) for examples
98
-
99
-
100
-
101
-
102
-
103
-
104
-
1
+ Metadata-Version: 2.1
2
+ Name: most_queue
3
+ Version: 1.35
4
+ Summary: Software package for calculation and simulation of queuing systems
5
+ Home-page: https://github.com/xabarov/mps
6
+ Author: Xabarov Roman
7
+ Author-email: Xabarov Roman <xabarov1985@gmail.com>
8
+ License: Copyright (c) 2018 The Python Packaging Authority
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/xabarov/mps
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.7
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+
35
+ # most_queue
36
+ Python package for calculation and simulation of queuing systems (QS) and networks
37
+
38
+ ## Authors
39
+ - [xabarov](https://github.com/xabarov)
40
+
41
+ ## Installation
42
+ Install most-queue with pip
43
+ ```bash
44
+ pip install most-queue
45
+ ```
46
+
47
+ ## DESCRIPTION
48
+ Most_queue consists of two main parts:
49
+ - **.theory** contains programs that implement methods for calculating queuing theory models.
50
+ - **.sim** contains simulation programs.
51
+
52
+ ### Package .theory
53
+ | # | Package name | Description |
54
+ |-----|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55
+ | 1. | diff5dots | Numerical calculation of the derivative of a function |
56
+ | 2. | fj_calc | Numerical calculation of the initial moments of the random variables maximum distribution |
57
+ | 3. | m_ph_n_prty | Numerical calculation of QS M/Ph/n with 2 classes and PR - priority. Based on the approximation of busy periods |
58
+ | 4. | mg1_calc | Numerical calculation of QS M/G/1 |
59
+ | 5. | gi_m_1_calc | Numerical calculation of QS GI/M/1 |
60
+ | 6. | gi_m_n_calc | Numerical calculation of QS GI/M/n |
61
+ | 7. | m_d_n_calc | Numerical calculation of QS M/D/n |
62
+ | 8. | ek_d_n_calc | Numerical calculation of QS Ek/D/n |
63
+ | 9. | mg1_warm_calc | Numerical calculation of QS M/G/1 with "warm-up" |
64
+ | 10. | mgn_tt | Numerical calculation of QS M/H2/n by the Takahashi-Takami method with complex parameters when approximating the serving time by the H2 distribution |
65
+ | 11. | mmn3_pnz_cox_approx | Calculation of QS M/M/2 with 3 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of busy period by the Cox distribution |
66
+ | 12. | mmn_prty_pnz_approx | Calculation of QS M/M/2 with 2 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of the busy period by the Cox distribution |
67
+ | 13. | mmnr_calc | Calculation of QS M/M/n/r |
68
+ | 14. | network_calc | Calculation of queuing network with priorities in nodes |
69
+ | 15. | passage_time | Calculation of the initial transition times between arbitrary tiers of the Markov chain |
70
+ | 16. | priority_calc | A set of functions for calculating QS with priorities (single-channel, multi-channel). The multichannel calculation is carried out by the method of relation invariants |
71
+ | 17. | student_stat | Calculation of confidence probability, confidence intervals for random variable with unknown RMS based on Student's t-distribution. |
72
+ | 18. | convolution_sum_calc | Calculate the initial moments of sums of random variables |
73
+ | 19. | weibull | Selection of Weibull distribution parameters, calculation of CDF, PDF, Tail values |
74
+ | 20. | flow_sum | Flow summation, numerical calculation |
75
+ | 21. | impatience_calc | Calculation of M/M/1 with exponential impatience |
76
+ | 22. | batch_mm1 | Calculation of QS M/M/1 with batch arrival |
77
+ | 23. | engset_model.py | Calculation of QS M/M/1 with finite sources |
78
+ | 24. | generate_pareto_noise.py.py | Create noise by Pareto dist |
79
+ | 25. | network_viewer.py | Utility to view network structure |
80
+ | 26. | mmn_with_h2_cold_h2_warmup.py | Multichannel queuing system with exp serving time, H2 warm-up and H2 cold (vacations). The system uses complex parameters, which allows to calculate systems with arbitrary warm-up and cold variation coefficients |
81
+ | 27. | mgn_with_h2_delay_cold_warm.py | Multichannel queuing system with H2 serving time, H2 warm-up, H2 cold delay and H2 cold (vacations). The system uses complex parameters, which allows you to calculate systems with arbitrary serving, warm-up, cold-delay and cold variation coefficients |
82
+ ### Package .sim
83
+ | # | Package name | Description |
84
+ | ------------- |----------------------------|------------- |
85
+ | 1. | fj_delta_sim | Simulation of QS fork-join with a delay in the start of processing between channels |
86
+ | 2. | fj_sim | Simulation of QS with fork-join process |
87
+ | 3. | priority_network | Simulation of queuing network with priorities in nodes |
88
+ | 4. | rand_distribution | A set of functions and classes designed to generate a PRNG and select parameters for distributions H2, C2, Ek, Pa, Gamma |
89
+ | 5. | qs_sim | Simulation of QS GI/G/m/n |
90
+ | 6. | priority_queue_sim | Simulation of QS GI/G/m/n with priorities |
91
+ | 7. | flow_sum_sim | Simulation of flow summation |
92
+ | 8. | impatient_sim.py | Simulation of QS GI/G/m/n with impatience |
93
+ | 9. | batch_sim.py | Simulation of QS GI/G/m/n with batch arrival |
94
+ | 10. | queue_finite_source_sim.py | Simulation of QS GI/G/m/n with finite sources |
95
+
96
+ ## Usage
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
+ ```
172
+
173
+
174
+
175
+
176
+
177
+
178
+
@@ -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/tests) for examples
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