most-queue 1.52__tar.gz → 1.53__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.53/PKG-INFO +154 -0
- most_queue-1.53/README.md +114 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/conv.py +7 -5
- {most_queue-1.52 → most_queue-1.53}/most_queue/misc/compare_fj_calc.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/most_queue/misc/flow_sum.py +1 -1
- {most_queue-1.52/most_queue/sim → most_queue-1.53/most_queue/sim/networks}/priority_network.py +1 -1
- {most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/sim/queueing_systems}/__init__.py +0 -0
- most_queue-1.52/most_queue/sim/batch_sim.py → most_queue-1.53/most_queue/sim/queueing_systems/batch.py +1 -1
- most_queue-1.52/most_queue/sim/queue_finite_source_sim.py → most_queue-1.53/most_queue/sim/queueing_systems/finite_source.py +64 -18
- most_queue-1.52/most_queue/sim/fj_sim.py → most_queue-1.53/most_queue/sim/queueing_systems/fork_join.py +1 -1
- most_queue-1.52/most_queue/sim/fj_delta_sim.py → most_queue-1.53/most_queue/sim/queueing_systems/fork_join_delta.py +1 -1
- most_queue-1.52/most_queue/sim/impatient_queue_sim.py → most_queue-1.53/most_queue/sim/queueing_systems/impatient.py +1 -1
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/qs_queue.py +3 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/servers.py +3 -4
- {most_queue-1.52/most_queue/theory/closed → most_queue-1.53/most_queue/theory}/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/networks/open_network.py +3 -3
- {most_queue-1.52/most_queue/theory/fork_join → most_queue-1.53/most_queue/theory/queueing_systems}/__init__.py +0 -0
- most_queue-1.52/most_queue/theory/closed/engset_model.py → most_queue-1.53/most_queue/theory/queueing_systems/closed/engset.py +2 -2
- most_queue-1.52/most_queue/theory/fifo/gi_m_1_calc.py → most_queue-1.53/most_queue/theory/queueing_systems/fifo/gi_m_1.py +2 -2
- most_queue-1.52/most_queue/theory/fifo/gi_m_n_calc.py → most_queue-1.53/most_queue/theory/queueing_systems/fifo/gi_m_n.py +2 -2
- most_queue-1.52/most_queue/theory/fifo/mmnr_calc.py → most_queue-1.53/most_queue/theory/queueing_systems/fifo/mmnr.py +2 -2
- most_queue-1.52/most_queue/theory/fork_join/sj_calc.py → most_queue-1.53/most_queue/theory/queueing_systems/fork_join/split_join.py +4 -4
- most_queue-1.52/most_queue/theory/impatience/impatience_mm1.py → most_queue-1.53/most_queue/theory/queueing_systems/impatience/mm1.py +3 -1
- most_queue-1.53/most_queue/theory/queueing_systems/priority/mgn_invar_approx.py +129 -0
- most_queue-1.53/most_queue/theory/queueing_systems/priority/non_preemptive/__init__.py +0 -0
- most_queue-1.53/most_queue/theory/queueing_systems/priority/non_preemptive/mg1.py +161 -0
- most_queue-1.53/most_queue/theory/queueing_systems/priority/preemptive/__init__.py +0 -0
- most_queue-1.53/most_queue/theory/queueing_systems/priority/preemptive/mg1.py +205 -0
- most_queue-1.52/most_queue/theory/priority/mmn3_pnz_cox_approx.py → most_queue-1.53/most_queue/theory/queueing_systems/priority/preemptive/mmn_3cls_busy_approx.py +1 -1
- most_queue-1.53/most_queue/theory/queueing_systems/vacations/__init__.py +0 -0
- most_queue-1.53/most_queue/theory/utils/__init__.py +0 -0
- most_queue-1.53/most_queue/theory/utils/busy_periods.py +64 -0
- {most_queue-1.52 → most_queue-1.53}/pyproject.toml +1 -1
- {most_queue-1.52 → most_queue-1.53}/setup.py +1 -1
- most_queue-1.53/tests/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/tests/test_batch.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_ek_d_n.py +2 -2
- most_queue-1.53/tests/test_engset.py +63 -0
- {most_queue-1.52 → most_queue-1.53}/tests/test_fj_delta.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_fj_im.py +3 -3
- {most_queue-1.52 → most_queue-1.53}/tests/test_gi_m_1_calc.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_gi_m_n_calc.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_impatience.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_m_d_n_calc.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_m_h2_h2warm.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_m_ph_n_prty.py +5 -4
- {most_queue-1.52 → most_queue-1.53}/tests/test_mg1_calc.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_mgn_tt.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_mgn_with_h2_delay_cold_warm.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_mmn3_pnz_cox_approx.py +4 -4
- {most_queue-1.52 → most_queue-1.53}/tests/test_mmn_h2cold_h2warm.py +3 -3
- {most_queue-1.52 → most_queue-1.53}/tests/test_mmn_prty_pnz_approx.py +2 -2
- {most_queue-1.52 → most_queue-1.53}/tests/test_network_im_prty.py +1 -1
- {most_queue-1.52 → most_queue-1.53}/tests/test_qs_sim_prty.py +6 -4
- {most_queue-1.52 → most_queue-1.53}/tests/test_qs_sim_test.py +3 -3
- {most_queue-1.52 → most_queue-1.53}/tests/test_queue_types.py +1 -1
- most_queue-1.53/tutorials/m_h2_h2warm.ipynb +336 -0
- {most_queue-1.52 → most_queue-1.53}/tutorials/mgn_takahasi_takami.ipynb +4 -4
- {most_queue-1.52 → most_queue-1.53}/tutorials/priority_queue.ipynb +6 -5
- {most_queue-1.52 → most_queue-1.53}/tutorials/queue_sim.ipynb +5 -5
- most_queue-1.52/Gamma vs H2.png +0 -0
- most_queue-1.52/PKG-INFO +0 -308
- most_queue-1.52/README.md +0 -268
- most_queue-1.52/most_queue/theory/priority/priority_calc.py +0 -567
- most_queue-1.52/tests/test_engset.py +0 -40
- most_queue-1.52/tutorials/m_h2_h2warm.ipynb +0 -347
- {most_queue-1.52 → most_queue-1.53}/.gitignore +0 -0
- {most_queue-1.52 → most_queue-1.53}/LICENSE +0 -0
- {most_queue-1.52 → most_queue-1.53}/assets/queue_long.png +0 -0
- {most_queue-1.52 → most_queue-1.53}/deploy.txt +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/Makefile +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/make.bat +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/conf.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/index.rst +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/modules.rst +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/most_queue.rst +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/most_queue.sim.rst +0 -0
- {most_queue-1.52 → most_queue-1.53}/docs/source/most_queue.theory.rst +0 -0
- {most_queue-1.52 → most_queue-1.53}/googleb31d3dccb40f969f.html +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/approx_cdf_make.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/distribution_params.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/interfaces.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/tables.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/general/vacations_paper_utils.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/misc/test_weibull.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/rand_distribution.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/__init__.py +0 -0
- /most_queue-1.52/most_queue/sim/flow_sum_sim.py → /most_queue-1.53/most_queue/sim/flow_sum.py +0 -0
- {most_queue-1.52/most_queue/sim/utils → most_queue-1.53/most_queue/sim/networks}/__init__.py +0 -0
- /most_queue-1.52/most_queue/sim/qs_sim.py → /most_queue-1.53/most_queue/sim/queueing_systems/fifo.py +0 -0
- /most_queue-1.52/most_queue/sim/priority_queue_sim.py → /most_queue-1.53/most_queue/sim/queueing_systems/priority.py +0 -0
- {most_queue-1.52/most_queue/theory/batch → most_queue-1.53/most_queue/sim/utils}/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/distribution_utils.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/exceptions.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/phase.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/qs.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/stats_update.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/sim/utils/tasks.py +0 -0
- {most_queue-1.52/most_queue/theory/fifo → most_queue-1.53/most_queue/theory/networks}/__init__.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/networks/network_viewer.py +0 -0
- {most_queue-1.52/most_queue/theory/impatience → most_queue-1.53/most_queue/theory/queueing_systems/batch}/__init__.py +0 -0
- /most_queue-1.52/most_queue/theory/batch/batch_mm1.py → /most_queue-1.53/most_queue/theory/queueing_systems/batch/mm1.py +0 -0
- {most_queue-1.52/most_queue/theory/networks → most_queue-1.53/most_queue/theory/queueing_systems/closed}/__init__.py +0 -0
- {most_queue-1.52/most_queue/theory/priority → most_queue-1.53/most_queue/theory/queueing_systems/fifo}/__init__.py +0 -0
- /most_queue-1.52/most_queue/theory/fifo/ek_d_n_calc.py → /most_queue-1.53/most_queue/theory/queueing_systems/fifo/ek_d_n.py +0 -0
- /most_queue-1.52/most_queue/theory/fifo/m_d_n_calc.py → /most_queue-1.53/most_queue/theory/queueing_systems/fifo/m_d_n.py +0 -0
- /most_queue-1.52/most_queue/theory/fifo/mg1_calc.py → /most_queue-1.53/most_queue/theory/queueing_systems/fifo/mg1.py +0 -0
- /most_queue-1.52/most_queue/theory/fifo/mgn_tt.py → /most_queue-1.53/most_queue/theory/queueing_systems/fifo/mgn_takahasi.py +0 -0
- {most_queue-1.52/most_queue/theory/utils → most_queue-1.53/most_queue/theory/queueing_systems/fork_join}/__init__.py +0 -0
- /most_queue-1.52/most_queue/theory/fork_join/fj_calc.py → /most_queue-1.53/most_queue/theory/queueing_systems/fork_join/m_m_n.py +0 -0
- {most_queue-1.52/most_queue/theory/vacations → most_queue-1.53/most_queue/theory/queueing_systems/impatience}/__init__.py +0 -0
- {most_queue-1.52/tests → most_queue-1.53/most_queue/theory/queueing_systems/priority}/__init__.py +0 -0
- /most_queue-1.52/most_queue/theory/priority/m_ph_n_prty.py → /most_queue-1.53/most_queue/theory/queueing_systems/priority/preemptive/m_ph_n_busy_approx.py +0 -0
- /most_queue-1.52/most_queue/theory/priority/mmn_prty_pnz_approx.py → /most_queue-1.53/most_queue/theory/queueing_systems/priority/preemptive/mmn_2cls_pr_busy_approx.py +0 -0
- {most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/theory/queueing_systems}/vacations/m_h2_h2warm.py +0 -0
- {most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/theory/queueing_systems}/vacations/mg1_warm_calc.py +0 -0
- {most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/theory/queueing_systems}/vacations/mgn_with_h2_delay_cold_warm.py +0 -0
- {most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/theory/queueing_systems}/vacations/mmn_with_h2_cold_and_h2_warmup.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/r_example.gexf +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/binom_probs.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/diff5dots.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/flow_sum.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/passage_time.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/q_poisson_arrival_calc.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/student_stat.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/transforms.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/most_queue/theory/utils/weibull.py +0 -0
- {most_queue-1.52 → most_queue-1.53}/requirements.txt +0 -0
- {most_queue-1.52 → most_queue-1.53}/tests/n_test/ro_0.700.json +0 -0
- {most_queue-1.52 → most_queue-1.53}/tests/ro_test/n_3.json +0 -0
most_queue-1.53/PKG-INFO
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: most_queue
|
|
3
|
+
Version: 1.53
|
|
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
|
+

|
|
44
|
+
|
|
45
|
+
A Python package for simulating and analyzing queueing systems (QS) and networks.
|
|
46
|
+
|
|
47
|
+

|
|
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
|
+
---
|
|
77
|
+
|
|
78
|
+
## Description of the Project
|
|
79
|
+
|
|
80
|
+
Most_queue consists of two main parts:
|
|
81
|
+
- **most_queue.theory** contains programs that implement methods for calculating queueing theory models.
|
|
82
|
+
- **most_queue.sim** contains simulation programs.
|
|
83
|
+
|
|
84
|
+
## See examples in the tests folder:
|
|
85
|
+
|
|
86
|
+
### FIFO QS
|
|
87
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
88
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
89
|
+
| 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) | |
|
|
90
|
+
| 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) | |
|
|
91
|
+
| 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) | |
|
|
92
|
+
| 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) |
|
|
93
|
+
| 5. | M/G/1 | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
|
|
94
|
+
| 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) |
|
|
95
|
+
| 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) |
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### QS with priorities
|
|
99
|
+
|
|
100
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
101
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
102
|
+
| 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) | |
|
|
103
|
+
| 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) | |
|
|
104
|
+
| 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) | |
|
|
105
|
+
| 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) |
|
|
106
|
+
| 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) |
|
|
107
|
+
| 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) |
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Fork-Join QS
|
|
111
|
+
|
|
112
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
113
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
114
|
+
| 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) | |
|
|
115
|
+
| 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) | |
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### QS with Batch Arrival
|
|
119
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
120
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
121
|
+
| 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) | |
|
|
122
|
+
|
|
123
|
+
### QS with Vacations
|
|
124
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
125
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
126
|
+
| 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)| |
|
|
127
|
+
| 2. | M/G/1 | Solving for QS M/G/1 with warm-up | | |
|
|
128
|
+
| 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) | |
|
|
129
|
+
| 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) | |
|
|
130
|
+
|
|
131
|
+
### QS with Impatience
|
|
132
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
133
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
134
|
+
| 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) | |
|
|
135
|
+
|
|
136
|
+
### Closed QS (with finite number of sources)
|
|
137
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
138
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
139
|
+
| 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) | |
|
|
140
|
+
|
|
141
|
+
### Queuing Networks
|
|
142
|
+
|
|
143
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
144
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
145
|
+
| 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) | |
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Usage
|
|
149
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tests) for examples
|
|
150
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tutorials) for jupyter tutorials
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
Install most-queue with pip
|
|
32
|
+
```bash
|
|
33
|
+
pip install most-queue
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Description of the Project
|
|
39
|
+
|
|
40
|
+
Most_queue consists of two main parts:
|
|
41
|
+
- **most_queue.theory** contains programs that implement methods for calculating queueing theory models.
|
|
42
|
+
- **most_queue.sim** contains simulation programs.
|
|
43
|
+
|
|
44
|
+
## See examples in the tests folder:
|
|
45
|
+
|
|
46
|
+
### FIFO QS
|
|
47
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
48
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
49
|
+
| 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) | |
|
|
50
|
+
| 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) | |
|
|
51
|
+
| 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) | |
|
|
52
|
+
| 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) |
|
|
53
|
+
| 5. | M/G/1 | Solving for QS M/G/1 | [link](https://github.com/xabarov/most-queue/blob/main/tests/test_mg1_calc.py) | |
|
|
54
|
+
| 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) |
|
|
55
|
+
| 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) |
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### QS with priorities
|
|
59
|
+
|
|
60
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
61
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
62
|
+
| 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) | |
|
|
63
|
+
| 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) | |
|
|
64
|
+
| 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) | |
|
|
65
|
+
| 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) |
|
|
66
|
+
| 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) |
|
|
67
|
+
| 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) |
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Fork-Join QS
|
|
71
|
+
|
|
72
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
73
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
74
|
+
| 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) | |
|
|
75
|
+
| 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) | |
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### QS with Batch Arrival
|
|
79
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
80
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
81
|
+
| 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) | |
|
|
82
|
+
|
|
83
|
+
### QS with Vacations
|
|
84
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
85
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
86
|
+
| 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)| |
|
|
87
|
+
| 2. | M/G/1 | Solving for QS M/G/1 with warm-up | | |
|
|
88
|
+
| 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) | |
|
|
89
|
+
| 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) | |
|
|
90
|
+
|
|
91
|
+
### QS with Impatience
|
|
92
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
93
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
94
|
+
| 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) | |
|
|
95
|
+
|
|
96
|
+
### Closed QS (with finite number of sources)
|
|
97
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
98
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
99
|
+
| 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) | |
|
|
100
|
+
|
|
101
|
+
### Queuing Networks
|
|
102
|
+
|
|
103
|
+
| # | Kendall Notations | Description | Example | Tutorial |
|
|
104
|
+
|-----|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------|
|
|
105
|
+
| 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) | |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Usage
|
|
109
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tests) for examples
|
|
110
|
+
- Look [here](https://github.com/xabarov/most-queue/tree/main/tutorials) for jupyter tutorials
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
@@ -3,7 +3,7 @@ Functions for calculating convolutions of distributions.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def
|
|
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,8 +14,10 @@ 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
|
-
|
|
18
|
-
|
|
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]
|
|
19
21
|
return res
|
|
20
22
|
|
|
21
23
|
|
|
@@ -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 =
|
|
35
|
+
res = conv_moments(res, b, num)
|
|
34
36
|
return res
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
def
|
|
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.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import matplotlib
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
3
|
|
|
4
|
-
from most_queue.sim.
|
|
5
|
-
from most_queue.theory.fork_join.
|
|
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.
|
|
6
|
+
from most_queue.sim.flow_sum import FlowSumSim
|
|
7
7
|
|
|
8
8
|
matplotlib.use('TkAgg')
|
|
9
9
|
|
{most_queue-1.52/most_queue/sim → most_queue-1.53/most_queue/sim/networks}/priority_network.py
RENAMED
|
@@ -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.
|
|
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()
|
{most_queue-1.52/most_queue/theory → most_queue-1.53/most_queue/sim/queueing_systems}/__init__.py
RENAMED
|
File without changes
|
|
@@ -3,7 +3,7 @@ Queueing system with batch arrivals.
|
|
|
3
3
|
"""
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
|
-
from most_queue.sim.
|
|
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.
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
|
@@ -3,7 +3,7 @@ QS channels or servers
|
|
|
3
3
|
"""
|
|
4
4
|
from colorama import Fore, Style
|
|
5
5
|
|
|
6
|
-
from most_queue.general.conv import
|
|
6
|
+
from most_queue.general.conv import conv_moments
|
|
7
7
|
from most_queue.rand_distribution import (
|
|
8
8
|
CoxDistribution,
|
|
9
9
|
ExpDistribution,
|
|
@@ -132,7 +132,7 @@ class ServerWarmUp(Server):
|
|
|
132
132
|
else:
|
|
133
133
|
raise ValueError("Unknown distribution type")
|
|
134
134
|
|
|
135
|
-
f_summ =
|
|
135
|
+
f_summ = conv_moments(b, self.delta)
|
|
136
136
|
# variance = f_summ[1] - math.pow(f_summ[0], 2)
|
|
137
137
|
# coev = math.sqrt(variance)/f_summ[0]
|
|
138
138
|
params = GammaDistribution.get_params(f_summ)
|
|
@@ -232,6 +232,5 @@ class ServerPriority:
|
|
|
232
232
|
res += f"{Fore.GREEN}\tFree\n{Style.RESET_ALL}"
|
|
233
233
|
else:
|
|
234
234
|
res += f"{Fore.YELLOW}\tServing...\n{Style.RESET_ALL}"
|
|
235
|
-
res += "\tTask on service:\n"
|
|
236
|
-
res += f"\t\t{self.tsk_on_service.__str__('\t')}"
|
|
235
|
+
res += f"\tTask on service:\t{self.tsk_on_service}\n"
|
|
237
236
|
return res
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ Calculates queueing network.
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
6
|
from most_queue.rand_distribution import GammaDistribution
|
|
7
|
-
from most_queue.theory.priority.
|
|
7
|
+
from most_queue.theory.priority.mgn_invar_approx import MGnInvarApproximation
|
|
8
8
|
from most_queue.theory.utils.diff5dots import diff5dots
|
|
9
9
|
|
|
10
10
|
|
|
@@ -115,8 +115,8 @@ class OpenNetworkCalc:
|
|
|
115
115
|
b_sr = np.mean(b_order[i], axis=0)
|
|
116
116
|
|
|
117
117
|
res['loads'][i] = l_sum * b_sr[0] / self.n[i]
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
invar_calc = MGnInvarApproximation(l_order[i], b_order[i], self.n[i])
|
|
119
|
+
res['v_node'].append(invar_calc.get_v(priority=self.prty[i]))
|
|
120
120
|
for k in range(k_num):
|
|
121
121
|
res['v_node'][i][self.nodes_prty[i][k]] = res['v_node'][i][k]
|
|
122
122
|
|
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Calculation of the Engset model for M/M/1 with a finite number of sources.
|
|
3
3
|
"""
|
|
4
4
|
from most_queue.theory.utils.diff5dots import diff5dots
|
|
5
|
-
from most_queue.general.conv import
|
|
5
|
+
from most_queue.general.conv import conv_moments
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Engset:
|
|
@@ -115,7 +115,7 @@ class Engset:
|
|
|
115
115
|
"""
|
|
116
116
|
w = self.get_w()
|
|
117
117
|
b = [1.0 / self.mu, 2.0 / pow(self.mu, 2), 6.0 / pow(self.mu, 3)]
|
|
118
|
-
return
|
|
118
|
+
return conv_moments(w, b)
|
|
119
119
|
|
|
120
120
|
def _calc_m_i(self):
|
|
121
121
|
m_i = []
|
|
@@ -3,7 +3,7 @@ Calculation of the GI/M/1 queueing system
|
|
|
3
3
|
"""
|
|
4
4
|
import math
|
|
5
5
|
|
|
6
|
-
from most_queue.general.conv import
|
|
6
|
+
from most_queue.general.conv import conv_moments_minus
|
|
7
7
|
from most_queue.rand_distribution import GammaDistribution, ParetoDistribution
|
|
8
8
|
from most_queue.theory.utils.q_poisson_arrival_calc import get_q_Gamma
|
|
9
9
|
|
|
@@ -74,7 +74,7 @@ class GiM1:
|
|
|
74
74
|
|
|
75
75
|
b = [1.0 / self.mu, 2.0 /
|
|
76
76
|
pow(self.mu, 2), 6.0 / pow(self.mu, 3), 24.0 / pow(self.mu, 4)]
|
|
77
|
-
w =
|
|
77
|
+
w = conv_moments_minus(self.v, b, num)
|
|
78
78
|
|
|
79
79
|
return w
|
|
80
80
|
|
|
@@ -5,7 +5,7 @@ import math
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from most_queue.general.conv import
|
|
8
|
+
from most_queue.general.conv import conv_moments
|
|
9
9
|
from most_queue.rand_distribution import GammaDistribution, ParetoDistribution
|
|
10
10
|
from most_queue.theory.utils.diff5dots import diff5dots
|
|
11
11
|
|
|
@@ -47,7 +47,7 @@ class GiMn:
|
|
|
47
47
|
|
|
48
48
|
b = [1 / self.mu, 2 / pow(self.mu, 2), 6 /
|
|
49
49
|
pow(self.mu, 3), 24 / pow(self.mu, 4)]
|
|
50
|
-
v =
|
|
50
|
+
v = conv_moments(w, b, len(w))
|
|
51
51
|
return v
|
|
52
52
|
|
|
53
53
|
def get_w(self) -> list[float]:
|