most-queue 1.51__tar.gz → 1.52__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.52/Gamma vs H2.png +0 -0
- {most_queue-1.51 → most_queue-1.52}/PKG-INFO +69 -31
- most_queue-1.52/README.md +268 -0
- most_queue-1.52/docs/Makefile +20 -0
- most_queue-1.52/docs/make.bat +35 -0
- most_queue-1.52/docs/source/conf.py +35 -0
- most_queue-1.52/docs/source/index.rst +19 -0
- most_queue-1.52/docs/source/modules.rst +7 -0
- most_queue-1.52/docs/source/most_queue.rst +30 -0
- most_queue-1.52/docs/source/most_queue.sim.rst +71 -0
- most_queue-1.52/docs/source/most_queue.theory.rst +182 -0
- most_queue-1.52/googleb31d3dccb40f969f.html +1 -0
- most_queue-1.52/most_queue/general/approx_cdf_make.py +83 -0
- most_queue-1.52/most_queue/general/conv.py +51 -0
- most_queue-1.52/most_queue/general/distribution_params.py +71 -0
- most_queue-1.52/most_queue/general/interfaces.py +62 -0
- most_queue-1.52/most_queue/general/tables.py +236 -0
- {most_queue-1.51/most_queue/general_utils → most_queue-1.52/most_queue/general}/vacations_paper_utils.py +29 -13
- {most_queue-1.51 → most_queue-1.52}/most_queue/misc/compare_fj_calc.py +1 -1
- {most_queue-1.51 → most_queue-1.52}/most_queue/misc/flow_sum.py +17 -10
- most_queue-1.52/most_queue/rand_distribution.py +1089 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/batch_sim.py +2 -1
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/fj_delta_sim.py +4 -4
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/fj_sim.py +3 -3
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/flow_sum_sim.py +22 -17
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/impatient_queue_sim.py +11 -32
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/priority_network.py +7 -7
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/priority_queue_sim.py +0 -5
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/qs_sim.py +17 -42
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/distribution_utils.py +28 -28
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/phase.py +3 -3
- most_queue-1.51/most_queue/theory/__init__.py → most_queue-1.52/most_queue/sim/utils/qs.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/servers.py +27 -9
- {most_queue-1.51/most_queue/theory/utils → most_queue-1.52/most_queue/theory}/__init__.py +0 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/batch}/batch_mm1.py +16 -18
- most_queue-1.52/most_queue/theory/closed/__init__.py +0 -0
- most_queue-1.52/most_queue/theory/closed/engset_model.py +141 -0
- most_queue-1.52/most_queue/theory/fifo/__init__.py +0 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/fifo}/ek_d_n_calc.py +5 -5
- most_queue-1.52/most_queue/theory/fifo/gi_m_1_calc.py +133 -0
- most_queue-1.52/most_queue/theory/fifo/gi_m_n_calc.py +190 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/fifo}/m_d_n_calc.py +67 -59
- most_queue-1.52/most_queue/theory/fifo/mg1_calc.py +91 -0
- most_queue-1.52/most_queue/theory/fifo/mgn_tt.py +398 -0
- most_queue-1.52/most_queue/theory/fifo/mmnr_calc.py +116 -0
- most_queue-1.52/most_queue/theory/fork_join/__init__.py +0 -0
- most_queue-1.52/most_queue/theory/fork_join/fj_calc.py +254 -0
- most_queue-1.52/most_queue/theory/fork_join/sj_calc.py +284 -0
- most_queue-1.52/most_queue/theory/impatience/__init__.py +0 -0
- most_queue-1.52/most_queue/theory/impatience/impatience_mm1.py +115 -0
- most_queue-1.52/most_queue/theory/networks/__init__.py +0 -0
- most_queue-1.52/most_queue/theory/networks/open_network.py +152 -0
- most_queue-1.52/most_queue/theory/priority/__init__.py +0 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/priority}/m_ph_n_prty.py +236 -221
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/priority}/mmn3_pnz_cox_approx.py +12 -24
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/priority}/mmn_prty_pnz_approx.py +30 -22
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/priority}/priority_calc.py +49 -32
- most_queue-1.52/most_queue/theory/utils/__init__.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/flow_sum.py +15 -15
- most_queue-1.52/most_queue/theory/utils/passage_time.py +585 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/q_poisson_arrival_calc.py +2 -2
- most_queue-1.52/most_queue/theory/utils/transforms.py +8 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/weibull.py +49 -7
- most_queue-1.52/most_queue/theory/vacations/__init__.py +0 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/vacations}/m_h2_h2warm.py +175 -183
- most_queue-1.52/most_queue/theory/vacations/mg1_warm_calc.py +53 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/vacations}/mgn_with_h2_delay_cold_warm.py +251 -304
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/vacations}/mmn_with_h2_cold_and_h2_warmup.py +9 -21
- {most_queue-1.51 → most_queue-1.52}/pyproject.toml +1 -1
- {most_queue-1.51 → most_queue-1.52}/setup.py +1 -1
- most_queue-1.52/tests/__init__.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/tests/test_batch.py +11 -4
- {most_queue-1.51 → most_queue-1.52}/tests/test_ek_d_n.py +19 -14
- most_queue-1.52/tests/test_engset.py +40 -0
- {most_queue-1.51 → most_queue-1.52}/tests/test_fj_delta.py +20 -19
- {most_queue-1.51 → most_queue-1.52}/tests/test_fj_im.py +58 -65
- most_queue-1.52/tests/test_gi_m_1_calc.py +98 -0
- most_queue-1.52/tests/test_gi_m_n_calc.py +98 -0
- most_queue-1.52/tests/test_impatience.py +46 -0
- most_queue-1.52/tests/test_m_d_n_calc.py +52 -0
- most_queue-1.52/tests/test_m_h2_h2warm.py +85 -0
- most_queue-1.52/tests/test_m_ph_n_prty.py +137 -0
- {most_queue-1.51 → most_queue-1.52}/tests/test_mg1_calc.py +32 -23
- most_queue-1.52/tests/test_mgn_tt.py +92 -0
- {most_queue-1.51 → most_queue-1.52}/tests/test_mgn_with_h2_delay_cold_warm.py +131 -71
- {most_queue-1.51 → most_queue-1.52}/tests/test_mmn3_pnz_cox_approx.py +7 -5
- {most_queue-1.51 → most_queue-1.52}/tests/test_mmn_h2cold_h2warm.py +5 -11
- {most_queue-1.51 → most_queue-1.52}/tests/test_mmn_prty_pnz_approx.py +1 -3
- most_queue-1.52/tests/test_network_im_prty.py +118 -0
- {most_queue-1.51 → most_queue-1.52}/tests/test_qs_sim_prty.py +7 -6
- {most_queue-1.51 → most_queue-1.52}/tests/test_qs_sim_test.py +9 -6
- {most_queue-1.51 → most_queue-1.52}/tests/test_queue_types.py +2 -2
- {most_queue-1.51 → most_queue-1.52}/tutorials/m_h2_h2warm.ipynb +8 -8
- {most_queue-1.51 → most_queue-1.52}/tutorials/mgn_takahasi_takami.ipynb +1 -1
- {most_queue-1.51 → most_queue-1.52}/tutorials/priority_queue.ipynb +5 -5
- {most_queue-1.51 → most_queue-1.52}/tutorials/queue_sim.ipynb +6 -5
- most_queue-1.51/README.md +0 -230
- most_queue-1.51/most_queue/general_utils/approx_cdf_make.py +0 -79
- most_queue-1.51/most_queue/general_utils/conv.py +0 -24
- most_queue-1.51/most_queue/general_utils/tables.py +0 -119
- most_queue-1.51/most_queue/rand_distribution.py +0 -1031
- most_queue-1.51/most_queue/theory/engset_model.py +0 -127
- most_queue-1.51/most_queue/theory/fj_calc.py +0 -391
- most_queue-1.51/most_queue/theory/gi_m_1_calc.py +0 -89
- most_queue-1.51/most_queue/theory/gi_m_n_calc.py +0 -147
- most_queue-1.51/most_queue/theory/impatience_calc.py +0 -103
- most_queue-1.51/most_queue/theory/mg1_calc.py +0 -79
- most_queue-1.51/most_queue/theory/mg1_warm_calc.py +0 -29
- most_queue-1.51/most_queue/theory/mgn_tt.py +0 -450
- most_queue-1.51/most_queue/theory/mmnr_calc.py +0 -76
- most_queue-1.51/most_queue/theory/network_calc.py +0 -190
- most_queue-1.51/most_queue/theory/utils/passage_time.py +0 -1033
- most_queue-1.51/tests/test_engset.py +0 -52
- most_queue-1.51/tests/test_gi_m_1_calc.py +0 -116
- most_queue-1.51/tests/test_gi_m_n_calc.py +0 -117
- most_queue-1.51/tests/test_impatience.py +0 -35
- most_queue-1.51/tests/test_m_d_n_calc.py +0 -56
- most_queue-1.51/tests/test_m_h2_h2warm.py +0 -78
- most_queue-1.51/tests/test_m_ph_n_prty.py +0 -153
- most_queue-1.51/tests/test_mgn_tt.py +0 -91
- most_queue-1.51/tests/test_network_im_prty.py +0 -136
- {most_queue-1.51 → most_queue-1.52}/.gitignore +0 -0
- {most_queue-1.51 → most_queue-1.52}/LICENSE +0 -0
- {most_queue-1.51 → most_queue-1.52}/assets/queue_long.png +0 -0
- {most_queue-1.51 → most_queue-1.52}/deploy.txt +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/__init__.py +0 -0
- {most_queue-1.51/most_queue/general_utils → most_queue-1.52/most_queue/general}/__init__.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/misc/test_weibull.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/__init__.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/queue_finite_source_sim.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/__init__.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/exceptions.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/qs_queue.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/stats_update.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/sim/utils/tasks.py +0 -0
- {most_queue-1.51/tests → most_queue-1.52/most_queue/theory/batch}/__init__.py +0 -0
- {most_queue-1.51/most_queue/theory → most_queue-1.52/most_queue/theory/networks}/network_viewer.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/r_example.gexf +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/binom_probs.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/diff5dots.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/most_queue/theory/utils/student_stat.py +0 -0
- {most_queue-1.51 → most_queue-1.52}/requirements.txt +0 -0
- {most_queue-1.51 → most_queue-1.52}/tests/n_test/ro_0.700.json +0 -0
- {most_queue-1.51 → most_queue-1.52}/tests/ro_test/n_3.json +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: most_queue
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.52
|
|
4
4
|
Summary: Software package for calculation and simulation of queuing systems
|
|
5
5
|
Project-URL: Homepage, https://github.com/xabarov/most-queue
|
|
6
6
|
Author-email: Xabarov Roman <xabarov1985@gmail.com>
|
|
@@ -84,29 +84,66 @@ Most_queue consists of two main parts:
|
|
|
84
84
|
- **most_queue.sim** contains simulation programs.
|
|
85
85
|
### Package most_queue.theory
|
|
86
86
|
|
|
87
|
+
Package consist of following submodules:
|
|
88
|
+
|
|
89
|
+
#### Batch
|
|
90
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
91
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
92
|
+
| 1. | M<sup>x</sup>/M/1 | batch.batch_mm1 | 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) | |
|
|
93
|
+
|
|
94
|
+
#### Closed
|
|
95
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
96
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
97
|
+
| 1. | M/M/1/N | closed.engset_model | 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) | |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
#### Fork-Join
|
|
101
|
+
|
|
102
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
103
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
104
|
+
| 1. | M/M/c/Fork-Join | fork_join.fj_calc | Solving for Fork-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
#### Priority Queueing Systems
|
|
108
|
+
|
|
109
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
110
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
111
|
+
| 1. | M/Ph/c/PR | priority.m_ph_n_prty | 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) | |
|
|
112
|
+
| 2. | M/M/c/PR | priority.mmn_prty_pnz_approx | 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) | |
|
|
113
|
+
| 3. | M/M/c/PR | priority.mmn3_pnz_cox_approx | 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) | |
|
|
114
|
+
| 4. | M/G/1 | priority.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 | [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) |
|
|
115
|
+
|
|
116
|
+
#### FIFO Queueing Systems
|
|
117
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
118
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
119
|
+
| 1. | Ek/D/c | fifo.ek_d_n_calc | 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) | |
|
|
120
|
+
| 2. | GI/M/1 | fifo.gi_m_1_calc | Solving for QS GI/M/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_1_calc.py) | |
|
|
121
|
+
| 3. | GI/M/c | fifo.gi_m_n_calc | Solving for QS GI/M/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_n_calc.py) | |
|
|
122
|
+
| 4. | M/D/c | fifo.m_d_n_calc | 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) |
|
|
123
|
+
| 5. | M/G/1 | fifo.mg1_calc | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
|
|
124
|
+
| 6. | M/H<SUB>2</SUB>/c | fifo.mgn_tt | 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) |
|
|
125
|
+
| 7. | M/M/c/r | fifo.mmnr_calc | 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) |
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
#### Networks
|
|
129
|
+
|
|
130
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
131
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
132
|
+
| 1. | General Network | network_calc | Numerical calculation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
|
|
133
|
+
| 2. | - | networks.network_viewer | Utility to view network structure | | |
|
|
134
|
+
|
|
135
|
+
#### Vacations
|
|
136
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
137
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
138
|
+
| 1. | M/H<SUB>2</SUB>/c | vacations.m_h2_h2warm | 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)| |
|
|
139
|
+
| 2. | M/G/1 | vacations.mg1_warm_calc | Solving for QS M/G/1 with warm-up | | |
|
|
140
|
+
| 3. | M/Ph/c | vacations.mgn_with_h2_delay_cold_warm | 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) | |
|
|
141
|
+
| 4. | M/M/c | vacations.mmn_with_h2_cold_h2_warmup | 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) | |
|
|
142
|
+
|
|
143
|
+
#### Impatience
|
|
87
144
|
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
88
145
|
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
89
|
-
| 1. | M
|
|
90
|
-
| 2. | Ek/D/c | ek_d_n_calc | 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) | |
|
|
91
|
-
| 3. | M/M/1/N | engset_model | 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) | |
|
|
92
|
-
| 4. | M/M/c/Fork-Join | fj_calc | Solving for Fork-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
|
|
93
|
-
| 5. | GI/M/1 | gi_m_1_calc | Solving for QS GI/M/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_1.py) | |
|
|
94
|
-
| 6. | GI/M/c | gi_m_n_calc | Solving for QS GI/M/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_n.py) | |
|
|
95
|
-
| 7. | M/M/1/D | impatience_calc | Solving for M/M/1 with exponential impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
|
|
96
|
-
| 8. | M/D/c | m_d_n_calc | 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) |
|
|
97
|
-
| 9. | M/H2/c | m_h2_h2warm | Numerical calculation of the M/H2/c system with H2-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)|
|
|
98
|
-
| 10. | M/Ph/c/PR | m_ph_n_prty | 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) | |
|
|
99
|
-
| 11. | M/G/1 | mg1_calc | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
|
|
100
|
-
| 12. | M/G/1 | mg1_warm_calc | Solving for QS M/G/1 with "warm-up" | | |
|
|
101
|
-
| 13. | M/H2/c | mgn_tt | Numerical calculation of QS M/H2/c by the Takahashi-Takami method with complex parameters when approximating the serving time by the H2 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) |
|
|
102
|
-
| 14. | M/Ph/c | mgn_with_h2_delay_cold_warm | 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 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mgn_with_h2_delay_cold_warm.py) | |
|
|
103
|
-
| 15. | M/M/c/PR | mmn_prty_pnz_approx | 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) | |
|
|
104
|
-
| 16. | M/M/c | mmn_with_h2_cold_h2_warmup | 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 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mmn_h2cold_h2warm.py) | |
|
|
105
|
-
| 17. | M/M/c/PR | mmn3_pnz_cox_approx | 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) | |
|
|
106
|
-
| 18. | M/M/c/r | mmnr_calc | 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) |
|
|
107
|
-
| 19. | General Network | network_calc | Numerical calculation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
|
|
108
|
-
| 20. | - | network_viewer | Utility to view network structure | | |
|
|
109
|
-
| 21. | M/G/1 | 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 | [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) |
|
|
146
|
+
| 1. | M/M/1/D | impatience.impatience_mm1 | Solving for M/M/1 with exponential impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
|
|
110
147
|
|
|
111
148
|
### Package most_queue.sim
|
|
112
149
|
|
|
@@ -133,9 +170,9 @@ Most_queue consists of two main parts:
|
|
|
133
170
|
import numpy as np
|
|
134
171
|
|
|
135
172
|
from most_queue.general_utils.tables import probs_print, times_print
|
|
136
|
-
from most_queue.rand_distribution import
|
|
173
|
+
from most_queue.rand_distribution import H2Distribution
|
|
137
174
|
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
138
|
-
from most_queue.theory.mg1_calc import
|
|
175
|
+
from most_queue.theory.mg1_calc import MG1Calculation
|
|
139
176
|
|
|
140
177
|
l = 1 # input flow intensity
|
|
141
178
|
b1 = 0.7 # average service time
|
|
@@ -143,13 +180,14 @@ coev = 1.2 # coefficient of variation of service time
|
|
|
143
180
|
num_of_jobs = 1000000 # number of jobs for simulation
|
|
144
181
|
|
|
145
182
|
# selecting parameters of the approximating H2-distribution for service time [y1, mu1, mu2]:
|
|
146
|
-
params =
|
|
147
|
-
b =
|
|
183
|
+
params = H2Distribution.get_params_by_mean_and_coev(b1, coev)
|
|
184
|
+
b = H2Distribution.calc_theory_moments(params, 4)
|
|
148
185
|
|
|
149
186
|
# calculation using numerical methods
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
mg1_num = MG1Calculation(l, b)
|
|
188
|
+
w_ch = mg1_num.get_w()
|
|
189
|
+
p_ch = mg1_num.get_p()
|
|
190
|
+
v_ch = mg1_num.get_v()
|
|
153
191
|
|
|
154
192
|
# running simulation for verification of results
|
|
155
193
|
qs = QueueingSystemSimulator(1)
|
|
@@ -198,11 +236,11 @@ ro = lsum * b_sr / n
|
|
|
198
236
|
# and add them to the list of parameters params
|
|
199
237
|
params = []
|
|
200
238
|
for i in range(k):
|
|
201
|
-
params.append(
|
|
239
|
+
params.append(GammaDistribution.get_params([b1[i], b2[i]]))
|
|
202
240
|
|
|
203
241
|
b = []
|
|
204
242
|
for j in range(k):
|
|
205
|
-
b.append(
|
|
243
|
+
b.append(GammaDistribution.calc_theory_moments(params[j], 4))
|
|
206
244
|
|
|
207
245
|
print("\nComparison of data from the simulation and results calculated using the method of invariant relations (R) \n"
|
|
208
246
|
"time spent in a multi-channel queue with priorities")
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Queueing Systems: Simulation & Numerical Methods
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A Python package for simulating and analyzing queueing systems (QS) and networks.
|
|
6
|
+
|
|
7
|
+

|
|
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
|
+
## Roadmap
|
|
29
|
+
- Expand support for more queueing models.
|
|
30
|
+
- Implement advanced numerical solution methods.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
Install most-queue with pip
|
|
36
|
+
```bash
|
|
37
|
+
pip install most-queue
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Description of the Project
|
|
41
|
+
|
|
42
|
+
Most_queue consists of two main parts:
|
|
43
|
+
- **most_queue.theory** contains programs that implement methods for calculating queuing theory models.
|
|
44
|
+
- **most_queue.sim** contains simulation programs.
|
|
45
|
+
### Package most_queue.theory
|
|
46
|
+
|
|
47
|
+
Package consist of following submodules:
|
|
48
|
+
|
|
49
|
+
#### Batch
|
|
50
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
51
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
52
|
+
| 1. | M<sup>x</sup>/M/1 | batch.batch_mm1 | 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) | |
|
|
53
|
+
|
|
54
|
+
#### Closed
|
|
55
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
56
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
57
|
+
| 1. | M/M/1/N | closed.engset_model | 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) | |
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#### Fork-Join
|
|
61
|
+
|
|
62
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
63
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
64
|
+
| 1. | M/M/c/Fork-Join | fork_join.fj_calc | Solving for Fork-Join queueing system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
#### Priority Queueing Systems
|
|
68
|
+
|
|
69
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
70
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
71
|
+
| 1. | M/Ph/c/PR | priority.m_ph_n_prty | 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) | |
|
|
72
|
+
| 2. | M/M/c/PR | priority.mmn_prty_pnz_approx | 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) | |
|
|
73
|
+
| 3. | M/M/c/PR | priority.mmn3_pnz_cox_approx | 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) | |
|
|
74
|
+
| 4. | M/G/1 | priority.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 | [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) |
|
|
75
|
+
|
|
76
|
+
#### FIFO Queueing Systems
|
|
77
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
78
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
79
|
+
| 1. | Ek/D/c | fifo.ek_d_n_calc | 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) | |
|
|
80
|
+
| 2. | GI/M/1 | fifo.gi_m_1_calc | Solving for QS GI/M/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_1_calc.py) | |
|
|
81
|
+
| 3. | GI/M/c | fifo.gi_m_n_calc | Solving for QS GI/M/c | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_gi_m_n_calc.py) | |
|
|
82
|
+
| 4. | M/D/c | fifo.m_d_n_calc | 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) |
|
|
83
|
+
| 5. | M/G/1 | fifo.mg1_calc | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
|
|
84
|
+
| 6. | M/H<SUB>2</SUB>/c | fifo.mgn_tt | 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) |
|
|
85
|
+
| 7. | M/M/c/r | fifo.mmnr_calc | 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) |
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#### Networks
|
|
89
|
+
|
|
90
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
91
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
92
|
+
| 1. | General Network | network_calc | Numerical calculation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
|
|
93
|
+
| 2. | - | networks.network_viewer | Utility to view network structure | | |
|
|
94
|
+
|
|
95
|
+
#### Vacations
|
|
96
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
97
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
98
|
+
| 1. | M/H<SUB>2</SUB>/c | vacations.m_h2_h2warm | 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)| |
|
|
99
|
+
| 2. | M/G/1 | vacations.mg1_warm_calc | Solving for QS M/G/1 with warm-up | | |
|
|
100
|
+
| 3. | M/Ph/c | vacations.mgn_with_h2_delay_cold_warm | 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) | |
|
|
101
|
+
| 4. | M/M/c | vacations.mmn_with_h2_cold_h2_warmup | 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) | |
|
|
102
|
+
|
|
103
|
+
#### Impatience
|
|
104
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
105
|
+
|-----|-------------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
106
|
+
| 1. | M/M/1/D | impatience.impatience_mm1 | Solving for M/M/1 with exponential impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
|
|
107
|
+
|
|
108
|
+
### Package most_queue.sim
|
|
109
|
+
|
|
110
|
+
| # | Kendall Notations | Package Name | Description | Example | Tutorial |
|
|
111
|
+
|-----|-------------------|----------------------------|-------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
112
|
+
| 1. | M<sup>x</sup>/M/c | batch_sim | Simulation of QS in a batch system | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_batch.py) | |
|
|
113
|
+
| 2. | M/G/c/Fork-Join | fj_delta_sim | Simulation of QS fork-join with a delay in the start of processing between channels | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_delta.py) | |
|
|
114
|
+
| 3. | M/M/c | fj_sim | Simulation of QS with fork-join process | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_fj_im.py) | |
|
|
115
|
+
| 4. | - | flow_sum_sim | Simulation of flow summation | | |
|
|
116
|
+
| 5. | GI/G/c | impatient_queue_sim | Simulation of QS GI/G/m/n with impatience | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_impatience.py) | |
|
|
117
|
+
| 6. | QN | priority_network | Simulation of queuing network with priorities in nodes | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_network_im_prty.py) | |
|
|
118
|
+
| 7. | GI/G/c/n/Pri | priority_queue_sim | Simulation of QS GI/G/c/n with priorities | [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) |
|
|
119
|
+
| 8. | GI/G/c/n | qs_sim | Simulation of QS GI/G/c/n | [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/mgn_takahasi_takami.ipynb) |
|
|
120
|
+
| 9. | GI/G/c/n/N | queue_finite_source_sim | Simulation of QS GI/G/c/n with finite sources | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_engset.py) | |
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Usage
|
|
124
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tests) for examples
|
|
125
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tutorials) for jupyter tutorials
|
|
126
|
+
|
|
127
|
+
### Simple example: Calculate M/G/1 queueing system calculation with `most_queue` library. Run simulation and compare results with theory.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
import numpy as np
|
|
131
|
+
|
|
132
|
+
from most_queue.general_utils.tables import probs_print, times_print
|
|
133
|
+
from most_queue.rand_distribution import H2Distribution
|
|
134
|
+
from most_queue.sim.qs_sim import QueueingSystemSimulator
|
|
135
|
+
from most_queue.theory.mg1_calc import MG1Calculation
|
|
136
|
+
|
|
137
|
+
l = 1 # input flow intensity
|
|
138
|
+
b1 = 0.7 # average service time
|
|
139
|
+
coev = 1.2 # coefficient of variation of service time
|
|
140
|
+
num_of_jobs = 1000000 # number of jobs for simulation
|
|
141
|
+
|
|
142
|
+
# selecting parameters of the approximating H2-distribution for service time [y1, mu1, mu2]:
|
|
143
|
+
params = H2Distribution.get_params_by_mean_and_coev(b1, coev)
|
|
144
|
+
b = H2Distribution.calc_theory_moments(params, 4)
|
|
145
|
+
|
|
146
|
+
# calculation using numerical methods
|
|
147
|
+
mg1_num = MG1Calculation(l, b)
|
|
148
|
+
w_ch = mg1_num.get_w()
|
|
149
|
+
p_ch = mg1_num.get_p()
|
|
150
|
+
v_ch = mg1_num.get_v()
|
|
151
|
+
|
|
152
|
+
# running simulation for verification of results
|
|
153
|
+
qs = QueueingSystemSimulator(1)
|
|
154
|
+
qs.set_servers(params, "H")
|
|
155
|
+
qs.set_sources(l, "M")
|
|
156
|
+
qs.run(num_of_jobs)
|
|
157
|
+
w_sim = qs.w
|
|
158
|
+
p_sim = qs.get_p()
|
|
159
|
+
v_sim = qs.v
|
|
160
|
+
|
|
161
|
+
# outputting the results
|
|
162
|
+
print("M/H2/1")
|
|
163
|
+
|
|
164
|
+
times_print(w_sim, w_ch, True)
|
|
165
|
+
times_print(v_sim, v_ch, False)
|
|
166
|
+
probs_print(p_sim, p_ch, 10)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Priority queue example. For verification, comparing results with those calculated using the method of [invariant relations](https://cyberleninka.ru/article/n/raschet-mnogokanalnyh-sistem-obsluzhivaniya-s-absolyutnym-i-otnositelnym-prioritetami-na-osnove-invariantov-otnosheniya)
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
n = 5 # number of servers
|
|
173
|
+
k = 3 # number of classes of requests
|
|
174
|
+
l = [0.2, 0.3, 0.4] # service intensities by request classes
|
|
175
|
+
lsum = sum(l)
|
|
176
|
+
num_of_jobs = 300000 # number of jobs for the simulation
|
|
177
|
+
|
|
178
|
+
# Set up the parameters for service times at initial moments.
|
|
179
|
+
# Set average service times by class
|
|
180
|
+
b1 = [0.45 * n, 0.9 * n, 1.35 * n]
|
|
181
|
+
|
|
182
|
+
# Coefficient of variation of service time let's be the same for all classes
|
|
183
|
+
coev = 0.577
|
|
184
|
+
|
|
185
|
+
# second initial moments
|
|
186
|
+
b2 = [0] * k
|
|
187
|
+
for i in range(k):
|
|
188
|
+
b2[i] = (b1[i] ** 2) * (1 + coev ** 2)
|
|
189
|
+
|
|
190
|
+
b_sr = sum(b1) / k
|
|
191
|
+
|
|
192
|
+
# get the coefficient of load
|
|
193
|
+
ro = lsum * b_sr / n
|
|
194
|
+
|
|
195
|
+
# now, given the two initial moments, select parameters for the approximating Gamma distribution
|
|
196
|
+
# and add them to the list of parameters params
|
|
197
|
+
params = []
|
|
198
|
+
for i in range(k):
|
|
199
|
+
params.append(GammaDistribution.get_params([b1[i], b2[i]]))
|
|
200
|
+
|
|
201
|
+
b = []
|
|
202
|
+
for j in range(k):
|
|
203
|
+
b.append(GammaDistribution.calc_theory_moments(params[j], 4))
|
|
204
|
+
|
|
205
|
+
print("\nComparison of data from the simulation and results calculated using the method of invariant relations (R) \n"
|
|
206
|
+
"time spent in a multi-channel queue with priorities")
|
|
207
|
+
print("Number of servers: " + str(n) + "\nNumber of classes: " + str(k) + "\nCoefficient of load: {0:<1.2f}".format(ro) +
|
|
208
|
+
"\nCoefficient of variation of service time: " + str(coev) + "\n")
|
|
209
|
+
print("PR (Preamptive) priority")
|
|
210
|
+
|
|
211
|
+
# when creating the simulation, pass the number of servers, number of classes and type of priority.
|
|
212
|
+
# PR - absolute with re-service of requests
|
|
213
|
+
qs = PriorityQueueSimulator(n, k, "PR")
|
|
214
|
+
|
|
215
|
+
# to set up sources of requests and service servers, we need to specify a set of dictionaries with fields
|
|
216
|
+
# type - distribution type,
|
|
217
|
+
# params - its parameters.
|
|
218
|
+
# The number of such dictionaries in the lists sources and servers_params corresponds to the number of classes
|
|
219
|
+
|
|
220
|
+
sources = []
|
|
221
|
+
servers_params = []
|
|
222
|
+
for j in range(k):
|
|
223
|
+
sources.append({'type': 'M', 'params': l[j]})
|
|
224
|
+
servers_params.append({'type': 'Gamma', 'params': params[j]})
|
|
225
|
+
|
|
226
|
+
qs.set_sources(sources)
|
|
227
|
+
qs.set_servers(servers_params)
|
|
228
|
+
|
|
229
|
+
# start the simulation
|
|
230
|
+
qs.run(num_of_jobs)
|
|
231
|
+
|
|
232
|
+
# get the initial moments of time spent
|
|
233
|
+
|
|
234
|
+
v_sim = qs.v
|
|
235
|
+
|
|
236
|
+
# calculate them as well using the method of invariant relations (for comparison)
|
|
237
|
+
v_teor = priority_calc.get_v_prty_invar(l, b, n, 'PR')
|
|
238
|
+
|
|
239
|
+
assert abs(v_sim[0][0] - v_teor[0][0]) < 0.3
|
|
240
|
+
|
|
241
|
+
times_print_with_classes(v_sim, v_teor, False)
|
|
242
|
+
|
|
243
|
+
print("NP (Non-preamptive) priority")
|
|
244
|
+
|
|
245
|
+
# The same for relative priority (NP)
|
|
246
|
+
qs = PriorityQueueSimulator(n, k, "NP")
|
|
247
|
+
sources = []
|
|
248
|
+
servers_params = []
|
|
249
|
+
for j in range(k):
|
|
250
|
+
sources.append({'type': 'M', 'params': l[j]})
|
|
251
|
+
servers_params.append({'type': 'Gamma', 'params': params[j]})
|
|
252
|
+
|
|
253
|
+
qs.set_sources(sources)
|
|
254
|
+
qs.set_servers(servers_params)
|
|
255
|
+
|
|
256
|
+
qs.run(num_of_jobs)
|
|
257
|
+
|
|
258
|
+
v_sim = qs.v
|
|
259
|
+
|
|
260
|
+
v_teor = priority_calc.get_v_prty_invar(l, b, n, 'NP')
|
|
261
|
+
|
|
262
|
+
times_print_with_classes(v_sim, v_teor, False)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### References
|
|
266
|
+
- [(Ryzhikov Y.I. *Computational Methods*. BHV-Petersburg, 2007.)](https://www.litres.ru/book/uriy-ryzhikov/vychislitelnye-metody-uchebnoe-posobie-644835/)
|
|
267
|
+
|
|
268
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
# -- Project information -----------------------------------------------------
|
|
9
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
project = 'most-queue'
|
|
13
|
+
copyright = '2025, xabarov'
|
|
14
|
+
author = 'xabarov'
|
|
15
|
+
release = '1.51'
|
|
16
|
+
|
|
17
|
+
# -- General configuration ---------------------------------------------------
|
|
18
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
19
|
+
sys.path.insert(0, os.path.abspath('../most_queue'))
|
|
20
|
+
|
|
21
|
+
extensions = ['sphinx.ext.autodoc',
|
|
22
|
+
'sphinx.ext.napoleon',
|
|
23
|
+
'autodocsumm',
|
|
24
|
+
'sphinx.ext.coverage']
|
|
25
|
+
|
|
26
|
+
auto_doc_default_options = {'autosummary': True}
|
|
27
|
+
templates_path = ['_templates']
|
|
28
|
+
exclude_patterns = []
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# -- Options for HTML output -------------------------------------------------
|
|
32
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
33
|
+
|
|
34
|
+
html_theme = 'sphinx_book_theme'
|
|
35
|
+
html_static_path = ['_static']
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.. most-queue documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Mon Apr 21 20:24:55 2025.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
Most Queue Documentation
|
|
7
|
+
========================
|
|
8
|
+
|
|
9
|
+
Add your content using ``reStructuredText`` syntax. See the
|
|
10
|
+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
|
|
11
|
+
documentation for details.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.. toctree::
|
|
15
|
+
:maxdepth: 10
|
|
16
|
+
:caption: Contents:
|
|
17
|
+
|
|
18
|
+
modules
|
|
19
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
most\_queue package
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
Subpackages
|
|
5
|
+
-----------
|
|
6
|
+
|
|
7
|
+
.. toctree::
|
|
8
|
+
:maxdepth: 4
|
|
9
|
+
|
|
10
|
+
most_queue.sim
|
|
11
|
+
most_queue.theory
|
|
12
|
+
|
|
13
|
+
Submodules
|
|
14
|
+
----------
|
|
15
|
+
|
|
16
|
+
most\_queue.rand\_distribution module
|
|
17
|
+
-------------------------------------
|
|
18
|
+
|
|
19
|
+
.. automodule:: most_queue.rand_distribution
|
|
20
|
+
:members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
:undoc-members:
|
|
23
|
+
|
|
24
|
+
Module contents
|
|
25
|
+
---------------
|
|
26
|
+
|
|
27
|
+
.. automodule:: most_queue
|
|
28
|
+
:members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
:undoc-members:
|