most-queue 1.52__tar.gz → 1.54__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 (135) hide show
  1. most_queue-1.54/PKG-INFO +159 -0
  2. most_queue-1.54/README.md +119 -0
  3. {most_queue-1.52 → most_queue-1.54}/most_queue/general/conv.py +19 -9
  4. {most_queue-1.52 → most_queue-1.54}/most_queue/general/tables.py +2 -2
  5. {most_queue-1.52 → most_queue-1.54}/most_queue/misc/compare_fj_calc.py +2 -2
  6. {most_queue-1.52 → most_queue-1.54}/most_queue/misc/flow_sum.py +1 -1
  7. {most_queue-1.52 → most_queue-1.54}/most_queue/rand_distribution.py +5 -5
  8. {most_queue-1.52/most_queue/sim → most_queue-1.54/most_queue/sim/networks}/priority_network.py +1 -1
  9. {most_queue-1.52/most_queue/theory → most_queue-1.54/most_queue/sim/queueing_systems}/__init__.py +0 -0
  10. most_queue-1.52/most_queue/sim/batch_sim.py → most_queue-1.54/most_queue/sim/queueing_systems/batch.py +1 -1
  11. most_queue-1.52/most_queue/sim/queue_finite_source_sim.py → most_queue-1.54/most_queue/sim/queueing_systems/finite_source.py +64 -18
  12. most_queue-1.52/most_queue/sim/fj_sim.py → most_queue-1.54/most_queue/sim/queueing_systems/fork_join.py +1 -1
  13. most_queue-1.52/most_queue/sim/fj_delta_sim.py → most_queue-1.54/most_queue/sim/queueing_systems/fork_join_delta.py +1 -1
  14. most_queue-1.52/most_queue/sim/impatient_queue_sim.py → most_queue-1.54/most_queue/sim/queueing_systems/impatient.py +1 -1
  15. most_queue-1.54/most_queue/sim/queueing_systems/negative.py +482 -0
  16. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/distribution_utils.py +30 -30
  17. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/qs_queue.py +27 -0
  18. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/servers.py +3 -4
  19. {most_queue-1.52/most_queue/theory/closed → most_queue-1.54/most_queue/theory}/__init__.py +0 -0
  20. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/networks/open_network.py +3 -3
  21. {most_queue-1.52/most_queue/theory/fork_join → most_queue-1.54/most_queue/theory/queueing_systems}/__init__.py +0 -0
  22. most_queue-1.52/most_queue/theory/closed/engset_model.py → most_queue-1.54/most_queue/theory/queueing_systems/closed/engset.py +2 -2
  23. most_queue-1.52/most_queue/theory/fifo/gi_m_1_calc.py → most_queue-1.54/most_queue/theory/queueing_systems/fifo/gi_m_1.py +2 -2
  24. most_queue-1.52/most_queue/theory/fifo/gi_m_n_calc.py → most_queue-1.54/most_queue/theory/queueing_systems/fifo/gi_m_n.py +2 -2
  25. most_queue-1.52/most_queue/theory/fifo/mgn_tt.py → most_queue-1.54/most_queue/theory/queueing_systems/fifo/mgn_takahasi.py +1 -9
  26. most_queue-1.52/most_queue/theory/fifo/mmnr_calc.py → most_queue-1.54/most_queue/theory/queueing_systems/fifo/mmnr.py +2 -2
  27. most_queue-1.52/most_queue/theory/fork_join/sj_calc.py → most_queue-1.54/most_queue/theory/queueing_systems/fork_join/split_join.py +4 -4
  28. most_queue-1.52/most_queue/theory/impatience/impatience_mm1.py → most_queue-1.54/most_queue/theory/queueing_systems/impatience/mm1.py +3 -1
  29. most_queue-1.54/most_queue/theory/queueing_systems/negative/mgn_rcs.py +579 -0
  30. most_queue-1.54/most_queue/theory/queueing_systems/priority/mgn_invar_approx.py +129 -0
  31. most_queue-1.54/most_queue/theory/queueing_systems/priority/non_preemptive/__init__.py +0 -0
  32. most_queue-1.54/most_queue/theory/queueing_systems/priority/non_preemptive/mg1.py +161 -0
  33. most_queue-1.54/most_queue/theory/queueing_systems/priority/preemptive/__init__.py +0 -0
  34. most_queue-1.54/most_queue/theory/queueing_systems/priority/preemptive/mg1.py +205 -0
  35. most_queue-1.52/most_queue/theory/priority/mmn3_pnz_cox_approx.py → most_queue-1.54/most_queue/theory/queueing_systems/priority/preemptive/mmn_3cls_busy_approx.py +1 -1
  36. most_queue-1.54/most_queue/theory/queueing_systems/vacations/__init__.py +0 -0
  37. {most_queue-1.52/most_queue/theory → most_queue-1.54/most_queue/theory/queueing_systems}/vacations/m_h2_h2warm.py +3 -11
  38. {most_queue-1.52/most_queue/theory → most_queue-1.54/most_queue/theory/queueing_systems}/vacations/mgn_with_h2_delay_cold_warm.py +5 -16
  39. {most_queue-1.52/most_queue/theory → most_queue-1.54/most_queue/theory/queueing_systems}/vacations/mmn_with_h2_cold_and_h2_warmup.py +1 -12
  40. most_queue-1.54/most_queue/theory/utils/__init__.py +0 -0
  41. most_queue-1.54/most_queue/theory/utils/busy_periods.py +64 -0
  42. {most_queue-1.52 → most_queue-1.54}/pyproject.toml +1 -1
  43. {most_queue-1.52 → most_queue-1.54}/setup.py +1 -1
  44. most_queue-1.54/tests/__init__.py +0 -0
  45. {most_queue-1.52 → most_queue-1.54}/tests/test_batch.py +2 -2
  46. {most_queue-1.52 → most_queue-1.54}/tests/test_ek_d_n.py +2 -2
  47. most_queue-1.54/tests/test_engset.py +63 -0
  48. {most_queue-1.52 → most_queue-1.54}/tests/test_fj_delta.py +2 -2
  49. {most_queue-1.52 → most_queue-1.54}/tests/test_fj_im.py +3 -3
  50. {most_queue-1.52 → most_queue-1.54}/tests/test_gi_m_1_calc.py +2 -2
  51. {most_queue-1.52 → most_queue-1.54}/tests/test_gi_m_n_calc.py +2 -2
  52. {most_queue-1.52 → most_queue-1.54}/tests/test_impatience.py +2 -2
  53. {most_queue-1.52 → most_queue-1.54}/tests/test_m_d_n_calc.py +2 -2
  54. {most_queue-1.52 → most_queue-1.54}/tests/test_m_h2_h2warm.py +3 -3
  55. {most_queue-1.52 → most_queue-1.54}/tests/test_m_ph_n_prty.py +5 -4
  56. {most_queue-1.52 → most_queue-1.54}/tests/test_mg1_calc.py +2 -2
  57. most_queue-1.54/tests/test_mgn_rcs.py +72 -0
  58. {most_queue-1.52 → most_queue-1.54}/tests/test_mgn_tt.py +2 -2
  59. {most_queue-1.52 → most_queue-1.54}/tests/test_mgn_with_h2_delay_cold_warm.py +2 -2
  60. {most_queue-1.52 → most_queue-1.54}/tests/test_mmn3_pnz_cox_approx.py +4 -4
  61. {most_queue-1.52 → most_queue-1.54}/tests/test_mmn_h2cold_h2warm.py +3 -3
  62. {most_queue-1.52 → most_queue-1.54}/tests/test_mmn_prty_pnz_approx.py +2 -2
  63. {most_queue-1.52 → most_queue-1.54}/tests/test_network_im_prty.py +1 -1
  64. {most_queue-1.52 → most_queue-1.54}/tests/test_qs_sim_prty.py +6 -4
  65. {most_queue-1.52 → most_queue-1.54}/tests/test_qs_sim_test.py +3 -3
  66. {most_queue-1.52 → most_queue-1.54}/tests/test_queue_types.py +1 -1
  67. most_queue-1.54/tutorials/m_h2_h2warm.ipynb +336 -0
  68. {most_queue-1.52 → most_queue-1.54}/tutorials/mgn_takahasi_takami.ipynb +4 -4
  69. {most_queue-1.52 → most_queue-1.54}/tutorials/priority_queue.ipynb +6 -5
  70. {most_queue-1.52 → most_queue-1.54}/tutorials/queue_sim.ipynb +5 -5
  71. most_queue-1.52/Gamma vs H2.png +0 -0
  72. most_queue-1.52/PKG-INFO +0 -308
  73. most_queue-1.52/README.md +0 -268
  74. most_queue-1.52/most_queue/theory/priority/priority_calc.py +0 -567
  75. most_queue-1.52/tests/test_engset.py +0 -40
  76. most_queue-1.52/tutorials/m_h2_h2warm.ipynb +0 -347
  77. {most_queue-1.52 → most_queue-1.54}/.gitignore +0 -0
  78. {most_queue-1.52 → most_queue-1.54}/LICENSE +0 -0
  79. {most_queue-1.52 → most_queue-1.54}/assets/queue_long.png +0 -0
  80. {most_queue-1.52 → most_queue-1.54}/deploy.txt +0 -0
  81. {most_queue-1.52 → most_queue-1.54}/docs/Makefile +0 -0
  82. {most_queue-1.52 → most_queue-1.54}/docs/make.bat +0 -0
  83. {most_queue-1.52 → most_queue-1.54}/docs/source/conf.py +0 -0
  84. {most_queue-1.52 → most_queue-1.54}/docs/source/index.rst +0 -0
  85. {most_queue-1.52 → most_queue-1.54}/docs/source/modules.rst +0 -0
  86. {most_queue-1.52 → most_queue-1.54}/docs/source/most_queue.rst +0 -0
  87. {most_queue-1.52 → most_queue-1.54}/docs/source/most_queue.sim.rst +0 -0
  88. {most_queue-1.52 → most_queue-1.54}/docs/source/most_queue.theory.rst +0 -0
  89. {most_queue-1.52 → most_queue-1.54}/googleb31d3dccb40f969f.html +0 -0
  90. {most_queue-1.52 → most_queue-1.54}/most_queue/__init__.py +0 -0
  91. {most_queue-1.52 → most_queue-1.54}/most_queue/general/__init__.py +0 -0
  92. {most_queue-1.52 → most_queue-1.54}/most_queue/general/approx_cdf_make.py +0 -0
  93. {most_queue-1.52 → most_queue-1.54}/most_queue/general/distribution_params.py +0 -0
  94. {most_queue-1.52 → most_queue-1.54}/most_queue/general/interfaces.py +0 -0
  95. {most_queue-1.52 → most_queue-1.54}/most_queue/general/vacations_paper_utils.py +0 -0
  96. {most_queue-1.52 → most_queue-1.54}/most_queue/misc/test_weibull.py +0 -0
  97. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/__init__.py +0 -0
  98. /most_queue-1.52/most_queue/sim/flow_sum_sim.py → /most_queue-1.54/most_queue/sim/flow_sum.py +0 -0
  99. {most_queue-1.52/most_queue/sim/utils → most_queue-1.54/most_queue/sim/networks}/__init__.py +0 -0
  100. /most_queue-1.52/most_queue/sim/qs_sim.py → /most_queue-1.54/most_queue/sim/queueing_systems/fifo.py +0 -0
  101. /most_queue-1.52/most_queue/sim/priority_queue_sim.py → /most_queue-1.54/most_queue/sim/queueing_systems/priority.py +0 -0
  102. {most_queue-1.52/most_queue/theory/batch → most_queue-1.54/most_queue/sim/utils}/__init__.py +0 -0
  103. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/exceptions.py +0 -0
  104. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/phase.py +0 -0
  105. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/qs.py +0 -0
  106. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/stats_update.py +0 -0
  107. {most_queue-1.52 → most_queue-1.54}/most_queue/sim/utils/tasks.py +0 -0
  108. {most_queue-1.52/most_queue/theory/fifo → most_queue-1.54/most_queue/theory/networks}/__init__.py +0 -0
  109. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/networks/network_viewer.py +0 -0
  110. {most_queue-1.52/most_queue/theory/impatience → most_queue-1.54/most_queue/theory/queueing_systems/batch}/__init__.py +0 -0
  111. /most_queue-1.52/most_queue/theory/batch/batch_mm1.py → /most_queue-1.54/most_queue/theory/queueing_systems/batch/mm1.py +0 -0
  112. {most_queue-1.52/most_queue/theory/networks → most_queue-1.54/most_queue/theory/queueing_systems/closed}/__init__.py +0 -0
  113. {most_queue-1.52/most_queue/theory/priority → most_queue-1.54/most_queue/theory/queueing_systems/fifo}/__init__.py +0 -0
  114. /most_queue-1.52/most_queue/theory/fifo/ek_d_n_calc.py → /most_queue-1.54/most_queue/theory/queueing_systems/fifo/ek_d_n.py +0 -0
  115. /most_queue-1.52/most_queue/theory/fifo/m_d_n_calc.py → /most_queue-1.54/most_queue/theory/queueing_systems/fifo/m_d_n.py +0 -0
  116. /most_queue-1.52/most_queue/theory/fifo/mg1_calc.py → /most_queue-1.54/most_queue/theory/queueing_systems/fifo/mg1.py +0 -0
  117. {most_queue-1.52/most_queue/theory/utils → most_queue-1.54/most_queue/theory/queueing_systems/fork_join}/__init__.py +0 -0
  118. /most_queue-1.52/most_queue/theory/fork_join/fj_calc.py → /most_queue-1.54/most_queue/theory/queueing_systems/fork_join/m_m_n.py +0 -0
  119. {most_queue-1.52/most_queue/theory/vacations → most_queue-1.54/most_queue/theory/queueing_systems/impatience}/__init__.py +0 -0
  120. {most_queue-1.52/tests → most_queue-1.54/most_queue/theory/queueing_systems/priority}/__init__.py +0 -0
  121. /most_queue-1.52/most_queue/theory/priority/m_ph_n_prty.py → /most_queue-1.54/most_queue/theory/queueing_systems/priority/preemptive/m_ph_n_busy_approx.py +0 -0
  122. /most_queue-1.52/most_queue/theory/priority/mmn_prty_pnz_approx.py → /most_queue-1.54/most_queue/theory/queueing_systems/priority/preemptive/mmn_2cls_pr_busy_approx.py +0 -0
  123. {most_queue-1.52/most_queue/theory → most_queue-1.54/most_queue/theory/queueing_systems}/vacations/mg1_warm_calc.py +0 -0
  124. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/r_example.gexf +0 -0
  125. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/binom_probs.py +0 -0
  126. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/diff5dots.py +0 -0
  127. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/flow_sum.py +0 -0
  128. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/passage_time.py +0 -0
  129. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/q_poisson_arrival_calc.py +0 -0
  130. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/student_stat.py +0 -0
  131. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/transforms.py +0 -0
  132. {most_queue-1.52 → most_queue-1.54}/most_queue/theory/utils/weibull.py +0 -0
  133. {most_queue-1.52 → most_queue-1.54}/requirements.txt +0 -0
  134. {most_queue-1.52 → most_queue-1.54}/tests/n_test/ro_0.700.json +0 -0
  135. {most_queue-1.52 → most_queue-1.54}/tests/ro_test/n_3.json +0 -0
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: most_queue
3
+ Version: 1.54
4
+ Summary: Software package for calculation and simulation of queuing systems
5
+ Project-URL: Homepage, https://github.com/xabarov/most-queue
6
+ Author-email: Xabarov Roman <xabarov1985@gmail.com>
7
+ License: Copyright (c) 2018 The Python Packaging Authority
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ License-File: LICENSE
27
+ Classifier: License :: OSI Approved :: MIT License
28
+ Classifier: Operating System :: OS Independent
29
+ Classifier: Programming Language :: Python :: 3
30
+ Requires-Python: >=3.9
31
+ Requires-Dist: colorama
32
+ Requires-Dist: graphviz
33
+ Requires-Dist: matplotlib
34
+ Requires-Dist: networkx
35
+ Requires-Dist: numpy
36
+ Requires-Dist: pandas
37
+ Requires-Dist: scipy==1.13.0
38
+ Requires-Dist: tqdm
39
+ Description-Content-Type: text/markdown
40
+
41
+ # Queueing Systems: Simulation & Numerical Methods
42
+
43
+ ![Queue](assets/queue_long.png)
44
+
45
+ A Python package for simulating and analyzing queueing systems (QS) and networks.
46
+
47
+ ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/xabarov/most-queue)
48
+
49
+
50
+ ## About
51
+ This repository focuses on solving steady-state problems in queueing theory.
52
+
53
+ Key Features:
54
+ - Simulate various types of queueing systems and networks.
55
+ - Numerical methods for solving queueing theory problems.
56
+ - Analyze system performance metrics such as waiting times, soujourn times, load factor and etc.
57
+
58
+
59
+ ## Use Cases
60
+ - Modeling cloud computing infrastructure.
61
+ - Designing efficient call centers.
62
+ - Optimizing transportation systems.
63
+ - Network traffic analysis.
64
+
65
+ ## Contributing
66
+ Contributions are welcome! If you find any issues or have suggestions, please open an [issue](https://github.com/xabarov/most-queue/issues). Your pull requests are also appreciated. You can write me at [xabarov1985@gmail.com](mailto:xabarov1985@gmail.com)
67
+
68
+ ---
69
+
70
+ ## Installation
71
+ - install most-queue with pip
72
+ ```bash
73
+ pip install most-queue
74
+ ```
75
+
76
+ - install most-queue from repository
77
+ ```bash
78
+ pip install -e .
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Description of the Project
84
+
85
+ Most_queue consists of two main parts:
86
+ - **most_queue.theory** contains programs that implement methods for calculating queueing theory models.
87
+ - **most_queue.sim** contains simulation programs.
88
+
89
+ ## See examples in the tests folder:
90
+
91
+ ### FIFO QS
92
+ | # | Kendall Notations | Description | Example | Tutorial |
93
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
94
+ | 1. | Ek/D/c | Numerical calculation of a multi-channel system Ek/D/n | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_ek_d_n.py) | |
95
+ | 2. | GI/M/1 | Solving for QS GI/M/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_1_calc.py) | |
96
+ | 3. | GI/M/c | Solving for QS GI/M/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_n_calc.py) | |
97
+ | 4. | M/D/c | Solving for QS M/D/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_d_n_calc.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/queue_sim.ipynb) |
98
+ | 5. | M/G/1 | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
99
+ | 6. | M/H<SUB>2</SUB>/c | Numerical calculation of QS M/H<SUB>2</SUB>/c by the Takahashi-Takami method with complex parameters when approximating the serving time by the H<SUB>2</SUB>-distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mgn_tt.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/mgn_takahasi_takami.ipynb) |
100
+ | 7. | M/M/c/r | Solving for QS M/M/c/r | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_test.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/queue_sim.ipynb) |
101
+
102
+
103
+ ### QS with priorities
104
+
105
+ | # | Kendall Notations | Description | Example | Tutorial |
106
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
107
+ | 1. | M/Ph/c/PR | Numerical calculation of QS M/Ph/c with 2 classes and PR - priority. Based on the approximation of busy periods | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_ph_n_prty.py) | |
108
+ | 2. | M/M/c/PR | Numerical calculation of QS M/M/c with 2 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of the busy period by the Cox distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn_prty_pnz_approx.py) | |
109
+ | 3. | M/M/c/PR | Numerical calculation of QS M/M/c with 3 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of busy period by the Cox distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn3_pnz_cox_approx.py) | |
110
+ | 4. | M/G/1/PR | Calculating QS with preemtive priorities (single-channel). | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
111
+ | 5. | M/G/1/NP | Calculating QS with non-preemtive priorities (single-channel). | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
112
+ | 6. | M/G/c/Priority | Calculating QS with NP and PR (multi-channel) by method of relation | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
113
+
114
+
115
+ ### Fork-Join QS
116
+
117
+ | # | Kendall Notations | Description | Example | Tutorial |
118
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
119
+ | 1. | M/M/c/Fork-Join | Solving for Fork-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
120
+ | 1. | M/G/c/Split-Join | Solving for Split-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
121
+
122
+
123
+ ### QS with Batch Arrival
124
+ | # | Kendall Notations | Description | Example | Tutorial |
125
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
126
+ | 1. | M<sup>x</sup>/M/1 | Solving for the of M<sup>x</sup>/M/1 QS with batch arrival | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_batch.py) | |
127
+
128
+ ### QS with Vacations
129
+ | # | Kendall Notations | Description | Example | Tutorial |
130
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
131
+ | 1. | M/H<SUB>2</SUB>/c | Numerical calculation of the M/H<SUB>2</SUB>/c system with H<SUB>2</SUB>-warming using the Takahasi-Takagi method. | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_h2_h2warm.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/m_h2_h2warm.ipynb)| |
132
+ | 2. | M/G/1 | Solving for QS M/G/1 with warm-up | | |
133
+ | 3. | M/Ph/c | Multichannel queuing system with H<SUB>2</SUB>-serving time, H<SUB>2</SUB>-warm-up, H<SUB>2</SUB>-cold delay and H<SUB>2</SUB>-cold (vacations). The system uses complex parameters, which allows you to calculate systems with arbitrary serving, warm-up, cold-delay and cold variation coefficients | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mgn_with_h2_delay_cold_warm.py) | |
134
+ | 4. | M/M/c | Multichannel queuing system with exp serving time, H<SUB>2</SUB>-warm-up and H<SUB>2</SUB>-cold (vacations). The system uses complex parameters, which allows to calculate systems with arbitrary warm-up and cold variation coefficients | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn_h2cold_h2warm.py) | |
135
+
136
+ ### QS with Impatience
137
+ | # | Kendall Notations | Description | Example | Tutorial |
138
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
139
+ | 1. | M/M/1/D | Solving for M/M/1 with exponential impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
140
+
141
+ ### Closed QS (with finite number of sources)
142
+ | # | Kendall Notations | Description | Example | Tutorial |
143
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
144
+ | 1. | M/M/1/N | Solving for the Engset model for M/M/1 with a finite number of sources. | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_engset.py) | |
145
+
146
+ ### Queuing Networks
147
+
148
+ | # | Kendall Notations | Description | Example | Tutorial |
149
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
150
+ | 1. | General Network | Numerical calculation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
151
+
152
+
153
+ ### Usage
154
+ - Look [here](https://github.com/xabarov/most-queue/tree/main/tests) for examples
155
+ - Look [here](https://github.com/xabarov/most-queue/tree/main/tutorials) for jupyter tutorials
156
+
157
+
158
+
159
+
@@ -0,0 +1,119 @@
1
+ # Queueing Systems: Simulation & Numerical Methods
2
+
3
+ ![Queue](assets/queue_long.png)
4
+
5
+ A Python package for simulating and analyzing queueing systems (QS) and networks.
6
+
7
+ ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/xabarov/most-queue)
8
+
9
+
10
+ ## About
11
+ This repository focuses on solving steady-state problems in queueing theory.
12
+
13
+ Key Features:
14
+ - Simulate various types of queueing systems and networks.
15
+ - Numerical methods for solving queueing theory problems.
16
+ - Analyze system performance metrics such as waiting times, soujourn times, load factor and etc.
17
+
18
+
19
+ ## Use Cases
20
+ - Modeling cloud computing infrastructure.
21
+ - Designing efficient call centers.
22
+ - Optimizing transportation systems.
23
+ - Network traffic analysis.
24
+
25
+ ## Contributing
26
+ Contributions are welcome! If you find any issues or have suggestions, please open an [issue](https://github.com/xabarov/most-queue/issues). Your pull requests are also appreciated. You can write me at [xabarov1985@gmail.com](mailto:xabarov1985@gmail.com)
27
+
28
+ ---
29
+
30
+ ## Installation
31
+ - install most-queue with pip
32
+ ```bash
33
+ pip install most-queue
34
+ ```
35
+
36
+ - install most-queue from repository
37
+ ```bash
38
+ pip install -e .
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Description of the Project
44
+
45
+ Most_queue consists of two main parts:
46
+ - **most_queue.theory** contains programs that implement methods for calculating queueing theory models.
47
+ - **most_queue.sim** contains simulation programs.
48
+
49
+ ## See examples in the tests folder:
50
+
51
+ ### FIFO QS
52
+ | # | Kendall Notations | Description | Example | Tutorial |
53
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
54
+ | 1. | Ek/D/c | Numerical calculation of a multi-channel system Ek/D/n | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_ek_d_n.py) | |
55
+ | 2. | GI/M/1 | Solving for QS GI/M/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_1_calc.py) | |
56
+ | 3. | GI/M/c | Solving for QS GI/M/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_n_calc.py) | |
57
+ | 4. | M/D/c | Solving for QS M/D/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_d_n_calc.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/queue_sim.ipynb) |
58
+ | 5. | M/G/1 | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
59
+ | 6. | M/H<SUB>2</SUB>/c | Numerical calculation of QS M/H<SUB>2</SUB>/c by the Takahashi-Takami method with complex parameters when approximating the serving time by the H<SUB>2</SUB>-distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mgn_tt.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/mgn_takahasi_takami.ipynb) |
60
+ | 7. | M/M/c/r | Solving for QS M/M/c/r | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_test.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/queue_sim.ipynb) |
61
+
62
+
63
+ ### QS with priorities
64
+
65
+ | # | Kendall Notations | Description | Example | Tutorial |
66
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
67
+ | 1. | M/Ph/c/PR | Numerical calculation of QS M/Ph/c with 2 classes and PR - priority. Based on the approximation of busy periods | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_ph_n_prty.py) | |
68
+ | 2. | M/M/c/PR | Numerical calculation of QS M/M/c with 2 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of the busy period by the Cox distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn_prty_pnz_approx.py) | |
69
+ | 3. | M/M/c/PR | Numerical calculation of QS M/M/c with 3 classes, PR - priority by the Takahashi-Takami numerical method based on the approximation of busy period by the Cox distribution | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn3_pnz_cox_approx.py) | |
70
+ | 4. | M/G/1/PR | Calculating QS with preemtive priorities (single-channel). | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
71
+ | 5. | M/G/1/NP | Calculating QS with non-preemtive priorities (single-channel). | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
72
+ | 6. | M/G/c/Priority | Calculating QS with NP and PR (multi-channel) by method of relation | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_qs_sim_prty.py) |[link](https://github.com/xabarov/most-queue/blob/main/tutorials/priority_queue.ipynb) |
73
+
74
+
75
+ ### Fork-Join QS
76
+
77
+ | # | Kendall Notations | Description | Example | Tutorial |
78
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
79
+ | 1. | M/M/c/Fork-Join | Solving for Fork-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
80
+ | 1. | M/G/c/Split-Join | Solving for Split-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
81
+
82
+
83
+ ### QS with Batch Arrival
84
+ | # | Kendall Notations | Description | Example | Tutorial |
85
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
86
+ | 1. | M<sup>x</sup>/M/1 | Solving for the of M<sup>x</sup>/M/1 QS with batch arrival | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_batch.py) | |
87
+
88
+ ### QS with Vacations
89
+ | # | Kendall Notations | Description | Example | Tutorial |
90
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
91
+ | 1. | M/H<SUB>2</SUB>/c | Numerical calculation of the M/H<SUB>2</SUB>/c system with H<SUB>2</SUB>-warming using the Takahasi-Takagi method. | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_m_h2_h2warm.py) | [link](https://github.com/xabarov/most-queue/blob/main/tutorials/m_h2_h2warm.ipynb)| |
92
+ | 2. | M/G/1 | Solving for QS M/G/1 with warm-up | | |
93
+ | 3. | M/Ph/c | Multichannel queuing system with H<SUB>2</SUB>-serving time, H<SUB>2</SUB>-warm-up, H<SUB>2</SUB>-cold delay and H<SUB>2</SUB>-cold (vacations). The system uses complex parameters, which allows you to calculate systems with arbitrary serving, warm-up, cold-delay and cold variation coefficients | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mgn_with_h2_delay_cold_warm.py) | |
94
+ | 4. | M/M/c | Multichannel queuing system with exp serving time, H<SUB>2</SUB>-warm-up and H<SUB>2</SUB>-cold (vacations). The system uses complex parameters, which allows to calculate systems with arbitrary warm-up and cold variation coefficients | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn_h2cold_h2warm.py) | |
95
+
96
+ ### QS with Impatience
97
+ | # | Kendall Notations | Description | Example | Tutorial |
98
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
99
+ | 1. | M/M/1/D | Solving for M/M/1 with exponential impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
100
+
101
+ ### Closed QS (with finite number of sources)
102
+ | # | Kendall Notations | Description | Example | Tutorial |
103
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
104
+ | 1. | M/M/1/N | Solving for the Engset model for M/M/1 with a finite number of sources. | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_engset.py) | |
105
+
106
+ ### Queuing Networks
107
+
108
+ | # | Kendall Notations | Description | Example | Tutorial |
109
+ |-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
110
+ | 1. | General Network | Numerical calculation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
111
+
112
+
113
+ ### Usage
114
+ - Look [here](https://github.com/xabarov/most-queue/tree/main/tests) for examples
115
+ - Look [here](https://github.com/xabarov/most-queue/tree/main/tutorials) for jupyter tutorials
116
+
117
+
118
+
119
+
@@ -1,9 +1,9 @@
1
1
  """
2
2
  Functions for calculating convolutions of distributions.
3
3
  """
4
+ import numpy as np
4
5
 
5
-
6
- def get_moments(a: list[float], b: list[float], num: int = 3) -> list[float]:
6
+ def conv_moments(a: list[float], b: list[float], num: int = 3) -> list[float]:
7
7
  """
8
8
  Calculates the moments of the convolution of two distributions.
9
9
  :param a: Moments of the first distribution.
@@ -14,9 +14,11 @@ def get_moments(a: list[float], b: list[float], num: int = 3) -> list[float]:
14
14
  num = min(num, 3)
15
15
  res = [0] * num
16
16
  res[0] = a[0] + b[0]
17
- res[1] = a[1] + b[1] + 2 * a[0] * b[0]
18
- res[2] = a[2] + b[2] + 3 * a[1] * b[0] + 3 * a[0] * b[1]
19
- return res
17
+ if num > 1:
18
+ res[1] = a[1] + b[1] + 2 * a[0] * b[0]
19
+ if num > 2:
20
+ res[2] = a[2] + b[2] + 3 * a[1] * b[0] + 3 * a[0] * b[1]
21
+ return np.array(res)
20
22
 
21
23
 
22
24
  def get_self_conv_moments(b: list[float], n_times, num: int = 3) -> list[float]:
@@ -30,11 +32,11 @@ def get_self_conv_moments(b: list[float], n_times, num: int = 3) -> list[float]:
30
32
  num = min(num, 3)
31
33
  res = [0] * num
32
34
  for i in range(n_times):
33
- res = get_moments(res, b, num)
35
+ res = conv_moments(res, b, num)
34
36
  return res
35
37
 
36
38
 
37
- def get_moments_minus(a: list[float], b: list[float], num: int = 3) -> list[float]:
39
+ def conv_moments_minus(a: list[float], b: list[float], num: int = 3) -> list[float]:
38
40
  """
39
41
  b = conv(a, x)
40
42
  Calculates the moments of x from the moments of a and b.
@@ -46,6 +48,14 @@ def get_moments_minus(a: list[float], b: list[float], num: int = 3) -> list[floa
46
48
  num = min(num, 3)
47
49
  res = [0] * num
48
50
  res[0] = a[0] - b[0]
49
- res[1] = a[1] - b[1] - 2 * a[0] * b[0]
50
- res[2] = a[2] - b[2] - 3 * a[1] * b[0] - 3 * a[0] * b[1]
51
+ if num > 1:
52
+ res[1] = a[1] - b[1] - 2 * a[0] * b[0]
53
+ if num > 2:
54
+ res[2] = a[2] - b[2] - 3 * a[1] * b[0] - 3 * a[0] * b[1]
51
55
  return res
56
+
57
+ def get_residual_distr_moments(a):
58
+ f = [0.0] * (len(a) - 1)
59
+ for i in range(len(f)):
60
+ f[i] = a[i + 1] / ((i + 2) * a[0])
61
+ return f
@@ -226,11 +226,11 @@ def print_mrx(mrx, is_short=False):
226
226
  color = Fore.RED
227
227
  else:
228
228
  color = Fore.GREEN
229
- if is_short:
229
+ if is_short or mrx[i, j].imag == 0.0:
230
230
  print(f"{color}{mrx[i, j].real:^4.2f} | ", end="")
231
231
  else:
232
232
  print(f"{color}{mrx[i, j]:^5.3f} | ", end="")
233
- print("\n" + "-------" * col if is_short else "\n" + "---------------" * col)
233
+ print("\n" + "-------" * col if is_short or mrx[i, j].imag == 0.0 else "\n" + "---------------" * col)
234
234
  Fore.RESET # Reset colors after each row
235
235
 
236
236
 
@@ -1,8 +1,8 @@
1
1
  import matplotlib
2
2
  import matplotlib.pyplot as plt
3
3
 
4
- from most_queue.sim.fj_sim import ForkJoinSim
5
- from most_queue.theory.fork_join.fj_calc import (
4
+ from most_queue.sim.queueing_systems.fork_join import ForkJoinSim
5
+ from most_queue.theory.fork_join.m_m_n import (
6
6
  get_v1_fj_nelson_tantawi,
7
7
  get_v1_fj_varki_merchant,
8
8
  get_v1_fj_varma,
@@ -3,7 +3,7 @@ import matplotlib.pyplot as plt
3
3
 
4
4
  from most_queue.theory.utils.flow_sum import SummatorNumeric
5
5
  from most_queue.rand_distribution import GammaDistribution
6
- from most_queue.sim.flow_sum_sim import FlowSumSim
6
+ from most_queue.sim.flow_sum import FlowSumSim
7
7
 
8
8
  matplotlib.use('TkAgg')
9
9
 
@@ -572,21 +572,21 @@ class DeterministicDistribution(Distribution):
572
572
  return DeterministicDistribution.generate_static(self.b)
573
573
 
574
574
  @staticmethod
575
- def generate_static(b):
575
+ def generate_static(params, generator=None):
576
576
  """
577
577
  Generate a constant value b. Static method for use without creating an instance of the class.
578
578
  """
579
- return b
579
+ return params
580
580
 
581
581
  @staticmethod
582
- def calc_theory_moments(b, num: int) -> list[float]:
582
+ def calc_theory_moments(params, num: int) -> list[float]:
583
583
  """
584
584
  Calculates theoretical moments of the distribution up to the specified order.
585
- :param b: constant value.
585
+ :param params = b: constant value.
586
586
  :param num: number of moments to calculate.
587
587
  :return: list[float]
588
588
  """
589
- moments = [b**i for i in range(1, num+1)]
589
+ moments = [params**i for i in range(1, num+1)]
590
590
  return moments
591
591
 
592
592
  @staticmethod
@@ -8,7 +8,7 @@ from colorama import Fore, Style, init
8
8
  from tqdm import tqdm
9
9
 
10
10
  from most_queue.rand_distribution import ExpDistribution
11
- from most_queue.sim.priority_queue_sim import PriorityQueueSimulator
11
+ from most_queue.sim.queueing_systems.priority import PriorityQueueSimulator
12
12
  from most_queue.sim.utils.tasks import TaskPriority
13
13
 
14
14
  init()
@@ -3,7 +3,7 @@ Queueing system with batch arrivals.
3
3
  """
4
4
  import numpy as np
5
5
 
6
- from most_queue.sim.qs_sim import QueueingSystemSimulator, Task
6
+ from most_queue.sim.queueing_systems.fifo import QueueingSystemSimulator, Task
7
7
 
8
8
 
9
9
  class QueueingSystemBatchSim(QueueingSystemSimulator):
@@ -1,9 +1,13 @@
1
1
  """
2
2
  Simulating a queueing system with finite number of sources.
3
3
  """
4
+ import time
5
+
6
+ import numpy as np
4
7
  from colorama import Fore, Style, init
8
+ from tqdm import tqdm
5
9
 
6
- from most_queue.sim.qs_sim import QueueingSystemSimulator, Task
10
+ from most_queue.sim.queueing_systems.fifo import QueueingSystemSimulator, Task
7
11
  from most_queue.sim.utils.distribution_utils import create_distribution
8
12
 
9
13
  init()
@@ -13,7 +17,7 @@ class QueueingFiniteSourceSim(QueueingSystemSimulator):
13
17
  Simulating a queueing system with finite number of sources.
14
18
  """
15
19
 
16
- def __init__(self, num_of_channels, m, buffer=None, verbose=True):
20
+ def __init__(self, num_of_channels: int, m: int, buffer=None, verbose=True):
17
21
  """
18
22
  num_of_channels - number of channels in the system.
19
23
  m - number of sources.
@@ -35,7 +39,7 @@ class QueueingFiniteSourceSim(QueueingSystemSimulator):
35
39
 
36
40
  """
37
41
  self.m = m
38
- self.sources_left = m # сколько источников готовы посылать заявки
42
+ self.sources_left = m # how many sources are ready to send requests
39
43
 
40
44
  super().__init__(num_of_channels, buffer=buffer, verbose=verbose)
41
45
 
@@ -80,7 +84,8 @@ class QueueingFiniteSourceSim(QueueingSystemSimulator):
80
84
  self.arrival_times[self.arrived_num] = 1e10
81
85
 
82
86
  if self.free_channels == 0:
83
- if self.buffer == None: # не задана длина очереди, т.е бесконечная очередь
87
+ if self.buffer is None: # infinite queue
88
+
84
89
  new_tsk = Task(self.ttek)
85
90
  new_tsk.start_waiting_time = self.ttek
86
91
  self.queue.append(new_tsk)
@@ -160,32 +165,73 @@ class QueueingFiniteSourceSim(QueueingSystemSimulator):
160
165
 
161
166
  def run_one_step(self):
162
167
  """
163
- Run one step of the simulation.
164
- This method is called repeatedly until the end of the simulation.
168
+ Run Open step of simulation
165
169
  """
166
170
 
167
171
  num_of_server_earlier = -1
168
- serv_earl = 1e10
169
- arr_earl = 1e10
170
- self.arrived_num = -1
171
-
172
- if self.sources_left != 0:
173
- for i, a in enumerate(self.arrival_times):
174
- if a < arr_earl:
175
- arr_earl = a
176
- self.arrived_num = i
172
+ serv_earl = 1e16
177
173
 
178
174
  for c in range(self.n):
179
175
  if self.servers[c].time_to_end_service < serv_earl:
180
176
  serv_earl = self.servers[c].time_to_end_service
181
177
  num_of_server_earlier = c
182
178
 
183
- # Key moment:
179
+ # Global warm-up is set. Need to track
180
+ # including the moment of warm-up end
181
+ times = [serv_earl, self.warm_phase.end_time,
182
+ self.cold_phase.end_time, self.cold_delay_phase.end_time]
183
+ for t in self.arrival_times: # Arrival times
184
+ times.append(t)
184
185
 
185
- if arr_earl < serv_earl:
186
+ min_time_num = np.argmin(times)
187
+ if min_time_num == 0:
188
+ # Serving
189
+ self.serving(num_of_server_earlier)
190
+ elif min_time_num == 1:
191
+ # Warm-up ends
192
+ self.on_end_warming()
193
+ elif min_time_num == 2:
194
+ # Cold ends
195
+ self.on_end_cold()
196
+ elif min_time_num == 3:
197
+ # Cold delay ends
198
+ self.on_end_cold_delay()
199
+ else:
200
+ self.arrived_num = min_time_num - 4
201
+ # Arrival of a new customer
186
202
  self.arrival()
203
+
204
+ def run(self, total_served, is_real_served=True):
205
+ """
206
+ Run simulation process
207
+ """
208
+ start = time.process_time()
209
+
210
+ print(Fore.GREEN + '\rStart simulation')
211
+
212
+ if is_real_served:
213
+
214
+ last_percent = 0
215
+
216
+ with tqdm(total=100) as pbar:
217
+ while self.served < total_served:
218
+ self.run_one_step()
219
+ percent = int(100*(self.served/total_served))
220
+ if last_percent != percent:
221
+ last_percent = percent
222
+ pbar.update(1)
223
+ pbar.set_description(Fore.MAGENTA + '\rJob served: ' +
224
+ Fore.YELLOW + f'{self.served}/{total_served}' +
225
+ Fore.LIGHTGREEN_EX)
226
+
187
227
  else:
188
- self.serving(num_of_server_earlier)
228
+ for _ in tqdm(range(total_served)):
229
+ self.run_one_step()
230
+
231
+ print(Fore.GREEN + '\rSimulation is finished')
232
+ print(Style.RESET_ALL)
233
+
234
+ self.time_spent = time.process_time() - start
189
235
 
190
236
  def get_p(self):
191
237
  """
@@ -6,7 +6,7 @@ import math
6
6
  from colorama import Fore, Style, init
7
7
  from tqdm import tqdm
8
8
 
9
- from most_queue.sim.qs_sim import QueueingSystemSimulator
9
+ from most_queue.sim.queueing_systems.fifo import QueueingSystemSimulator
10
10
  from most_queue.sim.utils.tasks import ForkJoinTask
11
11
 
12
12
  init()
@@ -5,7 +5,7 @@ from colorama import Fore, Style, init
5
5
 
6
6
  from most_queue.general.conv import get_self_conv_moments
7
7
  from most_queue.rand_distribution import GammaDistribution
8
- from most_queue.sim.fj_sim import ForkJoinSim
8
+ from most_queue.sim.queueing_systems.fork_join import ForkJoinSim
9
9
  from most_queue.sim.utils.tasks import ForkJoinTask
10
10
 
11
11
  init()
@@ -3,7 +3,7 @@ Simulation model for queueing systems with impatient tasks
3
3
  """
4
4
  from colorama import Fore, Style, init
5
5
 
6
- from most_queue.sim.qs_sim import QueueingSystemSimulator
6
+ from most_queue.sim.queueing_systems.fifo import QueueingSystemSimulator
7
7
  from most_queue.sim.utils.distribution_utils import create_distribution
8
8
  from most_queue.sim.utils.tasks import ImpatientTask
9
9