most-queue 1.57__tar.gz → 1.58__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of most-queue might be problematic. Click here for more details.

Files changed (180) hide show
  1. {most_queue-1.57 → most_queue-1.58}/PKG-INFO +1 -1
  2. {most_queue-1.57/most_queue/misc → most_queue-1.58/most_queue/sim}/__init__.py +0 -0
  3. {most_queue-1.57/most_queue/sim → most_queue-1.58/most_queue/sim/networks}/__init__.py +0 -0
  4. {most_queue-1.57/most_queue/sim/utils → most_queue-1.58/most_queue/theory}/__init__.py +0 -0
  5. {most_queue-1.57/most_queue/theory → most_queue-1.58/most_queue/theory/batch}/__init__.py +0 -0
  6. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/mgn_takahasi.py +2 -0
  7. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/preemptive/m_ph_n_busy_approx.py +52 -193
  8. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/vacations/m_h2_h2warm.py +2 -0
  9. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/vacations/mgn_with_h2_delay_cold_warm.py +2 -0
  10. {most_queue-1.57 → most_queue-1.58}/pyproject.toml +1 -1
  11. {most_queue-1.57 → most_queue-1.58}/setup.py +9 -10
  12. {most_queue-1.57 → most_queue-1.58}/tests/test_m_ph_n_prty.py +1 -4
  13. {most_queue-1.57 → most_queue-1.58}/tutorials/queue_sim.ipynb +1 -1
  14. most_queue-1.58/works/vacations/results/cooling/cooling_probs_vs_cool_ave.png +0 -0
  15. most_queue-1.58/works/vacations/results/cooling/cooling_probs_vs_cool_cv.png +0 -0
  16. most_queue-1.58/works/vacations/results/cooling/w1_error_vs_cool_ave.png +0 -0
  17. most_queue-1.58/works/vacations/results/cooling/w1_error_vs_cool_cv.png +0 -0
  18. most_queue-1.58/works/vacations/results/cooling/w1_vs_cool_ave.png +0 -0
  19. most_queue-1.58/works/vacations/results/cooling/w1_vs_cool_cv.png +0 -0
  20. most_queue-1.58/works/vacations/results/delay/cooling_delay_probs_vs_cool_delay_ave.png +0 -0
  21. most_queue-1.58/works/vacations/results/delay/cooling_delay_probs_vs_cool_delay_cv.png +0 -0
  22. most_queue-1.58/works/vacations/results/delay/w1_error_vs_cool_delay_ave.png +0 -0
  23. most_queue-1.58/works/vacations/results/delay/w1_error_vs_cool_delay_cv.png +0 -0
  24. most_queue-1.58/works/vacations/results/delay/w1_vs_cool_delay_ave.png +0 -0
  25. most_queue-1.58/works/vacations/results/delay/w1_vs_cool_delay_cv.png +0 -0
  26. most_queue-1.58/works/vacations/results/w1_errors_vs_channels.png +0 -0
  27. most_queue-1.58/works/vacations/results/w1_errors_vs_service_cv.png +0 -0
  28. most_queue-1.58/works/vacations/results/w1_errors_vs_utilization.png +0 -0
  29. most_queue-1.58/works/vacations/results/w1_vs_channels.png +0 -0
  30. most_queue-1.58/works/vacations/results/w1_vs_service_cv.png +0 -0
  31. most_queue-1.58/works/vacations/results/w1_vs_utilization.png +0 -0
  32. most_queue-1.58/works/vacations/results/warmup/w1_error_vs_warmup_ave.png +0 -0
  33. most_queue-1.58/works/vacations/results/warmup/w1_error_vs_warmup_cv.png +0 -0
  34. most_queue-1.58/works/vacations/results/warmup/w1_vs_warmup_ave.png +0 -0
  35. most_queue-1.58/works/vacations/results/warmup/w1_vs_warmup_cv.png +0 -0
  36. most_queue-1.58/works/vacations/results/warmup/warmup_probs_vs_warmup_ave.png +0 -0
  37. most_queue-1.58/works/vacations/results/warmup/warmup_probs_vs_warmup_cv.png +0 -0
  38. most_queue-1.58/works/vacations/run_one_calc_vs_sim.py +161 -0
  39. most_queue-1.58/works/vacations/run_wait_time_vs_channels.py +95 -0
  40. most_queue-1.58/works/vacations/run_wait_time_vs_cooling_delay.py +190 -0
  41. most_queue-1.58/works/vacations/run_wait_time_vs_cooling_time.py +188 -0
  42. most_queue-1.58/works/vacations/run_wait_time_vs_sevice_cv.py +97 -0
  43. most_queue-1.58/works/vacations/run_wait_time_vs_utilization.py +97 -0
  44. most_queue-1.58/works/vacations/run_wait_time_vs_warmup_time.py +191 -0
  45. most_queue-1.58/works/vacations/utils.py +107 -0
  46. most_queue-1.57/works/negative_queues/__init__.py +0 -0
  47. {most_queue-1.57 → most_queue-1.58}/.gitignore +0 -0
  48. {most_queue-1.57 → most_queue-1.58}/LICENSE +0 -0
  49. {most_queue-1.57 → most_queue-1.58}/README.md +0 -0
  50. {most_queue-1.57 → most_queue-1.58}/assets/queue_long.png +0 -0
  51. {most_queue-1.57 → most_queue-1.58}/deploy.txt +0 -0
  52. {most_queue-1.57 → most_queue-1.58}/docs/Makefile +0 -0
  53. {most_queue-1.57 → most_queue-1.58}/docs/make.bat +0 -0
  54. {most_queue-1.57 → most_queue-1.58}/docs/source/conf.py +0 -0
  55. {most_queue-1.57 → most_queue-1.58}/docs/source/index.rst +0 -0
  56. {most_queue-1.57 → most_queue-1.58}/docs/source/modules.rst +0 -0
  57. {most_queue-1.57 → most_queue-1.58}/docs/source/most_queue.rst +0 -0
  58. {most_queue-1.57 → most_queue-1.58}/docs/source/most_queue.sim.rst +0 -0
  59. {most_queue-1.57 → most_queue-1.58}/docs/source/most_queue.theory.rst +0 -0
  60. {most_queue-1.57 → most_queue-1.58}/googleb31d3dccb40f969f.html +0 -0
  61. {most_queue-1.57 → most_queue-1.58}/most_queue/__init__.py +0 -0
  62. {most_queue-1.57 → most_queue-1.58}/most_queue/general/__init__.py +0 -0
  63. {most_queue-1.57 → most_queue-1.58}/most_queue/general/distribution_params.py +0 -0
  64. {most_queue-1.57 → most_queue-1.58}/most_queue/general/interfaces.py +0 -0
  65. {most_queue-1.57 → most_queue-1.58}/most_queue/general/plots.py +0 -0
  66. {most_queue-1.57 → most_queue-1.58}/most_queue/general/tables.py +0 -0
  67. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/approx_cdf_make.py +0 -0
  68. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/calc_v_pls.py +0 -0
  69. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/compare_fj_calc.py +0 -0
  70. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/flow_sum.py +0 -0
  71. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/test_weibull.py +0 -0
  72. {most_queue-1.57 → most_queue-1.58}/most_queue/misc/vacations_paper_utils.py +0 -0
  73. {most_queue-1.57 → most_queue-1.58}/most_queue/rand_distribution.py +0 -0
  74. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/base.py +0 -0
  75. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/batch.py +0 -0
  76. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/finite_source.py +0 -0
  77. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/flow_sum.py +0 -0
  78. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/fork_join.py +0 -0
  79. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/fork_join_delta.py +0 -0
  80. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/impatient.py +0 -0
  81. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/negative.py +0 -0
  82. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/networks/priority_network.py +0 -0
  83. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/priority.py +0 -0
  84. {most_queue-1.57/most_queue/sim/networks → most_queue-1.58/most_queue/sim/utils}/__init__.py +0 -0
  85. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/distribution_utils.py +0 -0
  86. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/exceptions.py +0 -0
  87. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/phase.py +0 -0
  88. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/qs_queue.py +0 -0
  89. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/servers.py +0 -0
  90. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/stats_update.py +0 -0
  91. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/utils/tasks.py +0 -0
  92. {most_queue-1.57 → most_queue-1.58}/most_queue/sim/vacations.py +0 -0
  93. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/batch/mm1.py +0 -0
  94. {most_queue-1.57/most_queue/theory/batch → most_queue-1.58/most_queue/theory/closed}/__init__.py +0 -0
  95. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/closed/engset.py +0 -0
  96. {most_queue-1.57/most_queue/theory/closed → most_queue-1.58/most_queue/theory/fifo}/__init__.py +0 -0
  97. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/ek_d_n.py +0 -0
  98. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/gi_m_1.py +0 -0
  99. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/gi_m_n.py +0 -0
  100. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/m_d_n.py +0 -0
  101. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/mg1.py +0 -0
  102. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fifo/mmnr.py +0 -0
  103. {most_queue-1.57/most_queue/theory/fifo → most_queue-1.58/most_queue/theory/fork_join}/__init__.py +0 -0
  104. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fork_join/m_m_n.py +0 -0
  105. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/fork_join/split_join.py +0 -0
  106. {most_queue-1.57/most_queue/theory/fork_join → most_queue-1.58/most_queue/theory/impatience}/__init__.py +0 -0
  107. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/impatience/mm1.py +0 -0
  108. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/negative/mg1_disasters.py +0 -0
  109. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/negative/mg1_rcs.py +0 -0
  110. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/negative/mgn_disaster.py +0 -0
  111. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/negative/mgn_rcs.py +0 -0
  112. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/negative/structs.py +0 -0
  113. {most_queue-1.57/most_queue/theory/impatience → most_queue-1.58/most_queue/theory/networks}/__init__.py +0 -0
  114. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/networks/network_viewer.py +0 -0
  115. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/networks/open_network.py +0 -0
  116. {most_queue-1.57/most_queue/theory/networks → most_queue-1.58/most_queue/theory/priority}/__init__.py +0 -0
  117. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/mgn_invar_approx.py +0 -0
  118. {most_queue-1.57/most_queue/theory/priority → most_queue-1.58/most_queue/theory/priority/non_preemptive}/__init__.py +0 -0
  119. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/non_preemptive/mg1.py +0 -0
  120. {most_queue-1.57/most_queue/theory/priority/non_preemptive → most_queue-1.58/most_queue/theory/priority/preemptive}/__init__.py +0 -0
  121. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/preemptive/mg1.py +0 -0
  122. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/preemptive/mmn_2cls_pr_busy_approx.py +0 -0
  123. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/priority/preemptive/mmn_3cls_busy_approx.py +0 -0
  124. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/r_example.gexf +0 -0
  125. {most_queue-1.57/most_queue/theory/priority/preemptive → most_queue-1.58/most_queue/theory/utils}/__init__.py +0 -0
  126. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/binom_probs.py +0 -0
  127. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/busy_periods.py +0 -0
  128. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/conditional.py +0 -0
  129. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/conv.py +0 -0
  130. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/diff5dots.py +0 -0
  131. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/flow_sum.py +0 -0
  132. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/passage_time.py +0 -0
  133. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/q_poisson_arrival_calc.py +0 -0
  134. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/student_stat.py +0 -0
  135. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/transforms.py +0 -0
  136. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/utils/weibull.py +0 -0
  137. {most_queue-1.57/most_queue/theory/utils → most_queue-1.58/most_queue/theory/vacations}/__init__.py +0 -0
  138. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/vacations/mg1_warm_calc.py +0 -0
  139. {most_queue-1.57 → most_queue-1.58}/most_queue/theory/vacations/mmn_with_h2_cold_and_h2_warmup.py +0 -0
  140. {most_queue-1.57 → most_queue-1.58}/requirements.txt +0 -0
  141. {most_queue-1.57/most_queue/theory/vacations → most_queue-1.58/tests}/__init__.py +0 -0
  142. {most_queue-1.57 → most_queue-1.58}/tests/test_base_qs_sim.py +0 -0
  143. {most_queue-1.57 → most_queue-1.58}/tests/test_batch.py +0 -0
  144. {most_queue-1.57 → most_queue-1.58}/tests/test_ek_d_n.py +0 -0
  145. {most_queue-1.57 → most_queue-1.58}/tests/test_engset.py +0 -0
  146. {most_queue-1.57 → most_queue-1.58}/tests/test_fj_delta.py +0 -0
  147. {most_queue-1.57 → most_queue-1.58}/tests/test_fj_im.py +0 -0
  148. {most_queue-1.57 → most_queue-1.58}/tests/test_gi_m_1_calc.py +0 -0
  149. {most_queue-1.57 → most_queue-1.58}/tests/test_gi_m_n_calc.py +0 -0
  150. {most_queue-1.57 → most_queue-1.58}/tests/test_impatience.py +0 -0
  151. {most_queue-1.57 → most_queue-1.58}/tests/test_m_d_n_calc.py +0 -0
  152. {most_queue-1.57 → most_queue-1.58}/tests/test_m_h2_h2warm.py +0 -0
  153. {most_queue-1.57 → most_queue-1.58}/tests/test_mg1_calc.py +0 -0
  154. {most_queue-1.57 → most_queue-1.58}/tests/test_mg1_disaster.py +0 -0
  155. {most_queue-1.57 → most_queue-1.58}/tests/test_mg1_rcs.py +0 -0
  156. {most_queue-1.57 → most_queue-1.58}/tests/test_mg1_warmup.py +0 -0
  157. {most_queue-1.57 → most_queue-1.58}/tests/test_mgn_disaster.py +0 -0
  158. {most_queue-1.57 → most_queue-1.58}/tests/test_mgn_rcs.py +0 -0
  159. {most_queue-1.57 → most_queue-1.58}/tests/test_mgn_tt.py +0 -0
  160. {most_queue-1.57 → most_queue-1.58}/tests/test_mgn_with_h2_delay_cold_warm.py +0 -0
  161. {most_queue-1.57 → most_queue-1.58}/tests/test_mmn3_pnz_cox_approx.py +0 -0
  162. {most_queue-1.57 → most_queue-1.58}/tests/test_mmn_h2cold_h2warm.py +0 -0
  163. {most_queue-1.57 → most_queue-1.58}/tests/test_mmn_prty_pnz_approx.py +0 -0
  164. {most_queue-1.57 → most_queue-1.58}/tests/test_network_im_prty.py +0 -0
  165. {most_queue-1.57 → most_queue-1.58}/tests/test_qs_sim.py +0 -0
  166. {most_queue-1.57 → most_queue-1.58}/tests/test_qs_sim_prty.py +0 -0
  167. {most_queue-1.57 → most_queue-1.58}/tests/units/h2_params_cv_greater_than_exp.png +0 -0
  168. {most_queue-1.57 → most_queue-1.58}/tests/units/h2_params_cv_less_than_exp.png +0 -0
  169. {most_queue-1.57 → most_queue-1.58}/tests/units/test_busy_moments_calc.py +0 -0
  170. {most_queue-1.57 → most_queue-1.58}/tests/units/test_conditionals.py +0 -0
  171. {most_queue-1.57 → most_queue-1.58}/tests/units/test_h2_params_cv.py +0 -0
  172. {most_queue-1.57 → most_queue-1.58}/tests/units/test_queue_types.py +0 -0
  173. {most_queue-1.57 → most_queue-1.58}/tutorials/m_h2_h2warm.ipynb +0 -0
  174. {most_queue-1.57 → most_queue-1.58}/tutorials/mgn_takahasi_takami.ipynb +0 -0
  175. {most_queue-1.57 → most_queue-1.58}/tutorials/network_with_priorities.ipynb +0 -0
  176. {most_queue-1.57 → most_queue-1.58}/tutorials/priority_queue.ipynb +0 -0
  177. {most_queue-1.57/tests → most_queue-1.58/works}/__init__.py +0 -0
  178. {most_queue-1.57/works → most_queue-1.58/works/negative_queues}/__init__.py +0 -0
  179. {most_queue-1.57 → most_queue-1.58}/works/negative_queues/work_mgn_disasters.py +0 -0
  180. {most_queue-1.57 → most_queue-1.58}/works/negative_queues/work_mgn_rcs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: most_queue
3
- Version: 1.57
3
+ Version: 1.58
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>
@@ -142,6 +142,8 @@ class MGnCalc:
142
142
 
143
143
  self.x[0] = (1.0 + 0.0j) / self.z[1]
144
144
 
145
+ self.t[0] = self.x[0]*(np.dot(self.t[1], self.B[1]).dot(self.G[0]))
146
+
145
147
  x_max1 = np.max(self.x)
146
148
 
147
149
  if self.verbose:
@@ -7,21 +7,22 @@ import math
7
7
 
8
8
  import numpy as np
9
9
 
10
- from most_queue.rand_distribution import Cox2Params, CoxDistribution, H2Distribution
10
+ from most_queue.rand_distribution import CoxDistribution, H2Distribution
11
+ from most_queue.theory.fifo.mgn_takahasi import MGnCalc
11
12
  from most_queue.theory.utils.passage_time import PassageTimeCalculation
12
13
 
13
14
 
14
- class MPhNPrty:
15
+ class MPhNPrty(MGnCalc):
15
16
  """
16
17
  Calculation of M/PH, M/n queue with two classes of requests and absolute priority
17
18
  using the Takahashi-Takagi numerical method based on the approximation
18
19
  of the busy-time distribution by a Cox second-order distribution.
19
20
  """
20
21
 
21
- def __init__(self, mu_L: float, cox_param_H: Cox2Params, l_L: float, l_H: float, n: int, N: int = 250,
22
+ def __init__(self, mu_L: float, b_high: list[float], l_L: float, l_H: float, n: int, N: int = 250,
22
23
  accuracy: float = 1e-8, max_iter: int = 300, is_cox: bool = True,
23
24
  approx_ee: float = 0.1, approx_e: float = 0.5, is_fitting: bool = True,
24
- verbose: bool = True):
25
+ buffer=None, verbose: bool = True, dtype="c16"):
25
26
  """
26
27
  Calculation of M/PH, M/n queue with two classes of requests and absolute priority
27
28
  based on the Takahashi-Takagi numerical method based on the approximation
@@ -30,8 +31,7 @@ class MPhNPrty:
30
31
  :param l_L: intensity of the arrivals with low priority,
31
32
  :param l_H: intensity of the arrivals with high priority,
32
33
  :param mu_L: intensity of service for low-priority requests,
33
- :param cox_param_H: params of Cox2 (H2) approximation
34
- of service time for high priority jobs
34
+ :param b_high: list of E[X^k], k =1,2,3 for service time for high priority jobs
35
35
  :param N: number of levels (stages)
36
36
  :param accuracy: accuracy parameter for stopping the iteration
37
37
  :param max_iter: maximum number of iterations
@@ -39,21 +39,21 @@ class MPhNPrty:
39
39
  of low-priority jobs, otherwise use H2 distribution.
40
40
  :param approx_ee, approx_e: approximation paramters
41
41
  """
42
- # self.dt = np.dtype("f8")
43
- self.dt = np.dtype("c16")
44
- self.n = n # number of channels
45
42
 
46
- self.N = N
47
- self.e1 = accuracy
43
+ super().__init__(n=n, l=0, b=b_high, buffer=buffer,
44
+ N=N, accuracy=accuracy, dtype=dtype, verbose=verbose)
45
+
48
46
  self.l_L = l_L
49
47
  self.l_H = l_H
50
48
  self.mu_L = mu_L
49
+
50
+ cox_param_H = CoxDistribution.get_params(b_high)
51
+
51
52
  self.mu1_H = cox_param_H.mu1
52
53
  self.mu2_H = cox_param_H.mu2
53
54
  self.p_H = cox_param_H.p1
54
55
  self.max_iter = max_iter
55
56
  self.is_cox = is_cox
56
- self.verbose = verbose
57
57
  self.approx_ee = approx_ee
58
58
  self.approx_e = approx_e
59
59
  self.is_fitting = is_fitting
@@ -67,49 +67,9 @@ class MPhNPrty:
67
67
 
68
68
  self.cols = [] * N
69
69
 
70
- # Takahasi-Takagi method parameters
71
-
72
- self.t = []
73
- self.b1 = []
74
- self.b2 = []
75
- self.x = [0.0 + 0.0j] * N
76
- self.z = [0.0 + 0.0j] * N
77
-
78
- # Probabilities of system states
79
- self.p = [0.0 + 0.0j] * N
80
-
81
70
  self.run_iterations_num_ = 0
82
71
  self.p_iteration_num_ = 0
83
-
84
- # Transition matrices
85
- self.A = []
86
- self.B = []
87
- self.C = []
88
- self.D = []
89
- self.Y = []
90
-
91
- # Cols depends on number of channels. cols = number of all microstates transitions
92
- # from Cox2 to level
93
- self.cols_length_ = 2 * self.n ** 2
94
- for i in range(self.n):
95
- self.cols_length_ += i + 1
96
-
97
- for i in range(N):
98
- self.t.append(np.zeros((1, self.cols_length_), dtype=self.dt))
99
- self.b1.append(np.zeros((1, self.cols_length_), dtype=self.dt))
100
- self.b2.append(np.zeros((1, self.cols_length_), dtype=self.dt))
101
- self.x.append(np.zeros((1, self.cols_length_), dtype=self.dt))
102
-
103
- self._build_matrices()
104
- self._initial_probabilities()
105
-
106
- def get_p(self) -> list[float]:
107
- """
108
- Get probabilities of states.
109
- Returns:
110
- list: Probabilities of states.
111
- """
112
- return [prob.real for prob in self.p]
72
+ self.cols_length_ = 0
113
73
 
114
74
  def get_low_class_v1(self) -> float:
115
75
  """
@@ -123,85 +83,20 @@ class MPhNPrty:
123
83
  l1 += p_real[i] * i
124
84
  return l1 / self.l_L
125
85
 
126
- def run(self):
127
- """
128
- Run calculation. The calculation algorithm does not depend on the structure of matrices.
129
- """
130
- self.b1[0][0, 0] = 0.0 + 0.0j
131
- self.b2[0][0, 0] = 0.0 + 0.0j
132
-
133
- is_ave = False
134
-
135
- iter_num = 0
136
- self.run_iterations_num_ = 0
137
- if is_ave:
138
- x_ave1 = 0.0 + 0.0j
139
- x_ave2 = 0.0 + 0.0j
140
- for i in range(self.N):
141
- x_ave1 += self.x[i]
142
- x_ave1 /= self.N
143
- else:
144
-
145
- x_ave1 = 0.0
146
- x_ave2 = 0.0
147
- for i in range(self.N):
148
- if self.x[i].real > x_ave1:
149
- x_ave1 = self.x[i].real
150
-
151
- while math.fabs(x_ave2.real - x_ave1.real) >= self.e1 and iter_num < self.max_iter:
152
- if self.verbose:
153
- print(f"Start numeric iteration {iter_num}")
154
- iter_num += 1
155
- x_ave2 = x_ave1
156
- for j in range(1, self.N): # по всем ярусам, кроме первого.
157
-
158
- G = np.linalg.inv(self.D[j] - self.C[j])
159
- # b':
160
- self.b1[j] = np.dot(self.t[j - 1], np.dot(self.A[j - 1], G))
161
-
162
- # b":
163
- if j != (self.N - 1):
164
- self.b2[j] = np.dot(
165
- self.t[j + 1], np.dot(self.B[j + 1], G))
166
- else:
167
- self.b2[j] = np.dot(self.t[j - 1], np.dot(self.B[j], G))
168
-
169
- c = self._calculate_c(j)
170
-
171
- x_znam = np.dot(c, self.b1[j]) + self.b2[j]
172
- self.x[j] = 0.0 + 0.0j
173
- for k in range(x_znam.shape[1]):
174
- self.x[j] += x_znam[0, k]
175
-
176
- self.x[j] = 1.0 / self.x[j]
177
-
178
- self.z[j] = np.dot(c, self.x[j])
179
- self.t[j] = np.dot(self.z[j], self.b1[j]) + \
180
- np.dot(self.x[j], self.b2[j])
181
-
182
- self.x[0] = 1.0 / self.z[1]
183
-
184
- t1B1 = np.dot(self.t[1], self.B[1])
185
- self.t[0] = np.dot(self.x[0], t1B1)
186
- self.t[0] = np.dot(self.t[0], np.linalg.inv(self.D[0] - self.C[0]))
187
-
188
- if is_ave:
189
- x_ave1 = 0.0 + 0.0j
190
- for i in range(self.N):
191
- x_ave1 += self.x[i]
192
- x_ave1 /= self.N
193
-
194
- else:
195
- x_ave1 = 0.0
196
- for i in range(self.N):
197
- if self.x[i].real > x_ave1:
198
- x_ave1 = self.x[i].real
86
+ def _fill_cols(self):
87
+ # Cols depends on number of channels. cols = number of all microstates transitions
88
+ # from Cox2 to level
89
+ self.cols_length_ = 2 * self.n ** 2
90
+ for i in range(self.n):
91
+ self.cols_length_ += i + 1
199
92
 
200
- self.run_iterations_num_ = iter_num
201
- self._calculate_p()
202
- self._calculate_y()
93
+ def _fill_t_b(self):
94
+ for _i in range(self.N):
95
+ self.t.append(np.zeros((1, self.cols_length_), dtype=self.dt))
96
+ self.b1.append(np.zeros((1, self.cols_length_), dtype=self.dt))
97
+ self.b2.append(np.zeros((1, self.cols_length_), dtype=self.dt))
203
98
 
204
- def _build_A_for_busy_periods(self, num):
99
+ def _build_big_a_for_busy_periods(self, num):
205
100
  """
206
101
  Forms the matrix A at level num for calculating the Busy Period at a given level number.
207
102
  :param num: level number
@@ -214,7 +109,7 @@ class MPhNPrty:
214
109
  col = num + 1
215
110
  row = num + 1
216
111
  else:
217
- output = self.A_for_busy[self.n]
112
+ output = self.big_a_for_busy[self.n]
218
113
  return output
219
114
 
220
115
  output = np.zeros((row, col), dtype=self.dt)
@@ -223,7 +118,7 @@ class MPhNPrty:
223
118
  output[i, i] = self.l_H
224
119
  return output
225
120
 
226
- def _build_B_for_busy_periods(self, num):
121
+ def _build_big_b_for_busy_periods(self, num):
227
122
  """
228
123
  Forms the matrix B at level num for calculating the Busy Period at a given level number.
229
124
  :param num: level number
@@ -239,10 +134,10 @@ class MPhNPrty:
239
134
  col = num
240
135
  row = num
241
136
  output = np.zeros((row, col), dtype=self.dt)
242
- output[:, :self.n] = self.B_for_busy[self.n]
137
+ output[:, :self.n] = self.big_b_for_busy[self.n]
243
138
  return output
244
139
  else:
245
- output = self.B_for_busy[self.n + 1]
140
+ output = self.big_b_for_busy[self.n + 1]
246
141
  return output
247
142
 
248
143
  output = np.zeros((row, col), dtype=self.dt)
@@ -256,7 +151,7 @@ class MPhNPrty:
256
151
  output[i + 1, i] = (i + 1) * mu2
257
152
  return output
258
153
 
259
- def _build_C_for_busy_periods(self, num):
154
+ def _build_big_c_for_busy_periods(self, num):
260
155
  """
261
156
  Forms the matrix C at level num for calculating the Busy Period at a given level number.
262
157
  :param num: level number
@@ -269,7 +164,7 @@ class MPhNPrty:
269
164
  col = num + 1
270
165
  row = num + 1
271
166
  else:
272
- output = self.C_for_busy[self.n]
167
+ output = self.big_c_for_busy[self.n]
273
168
  return output
274
169
 
275
170
  output = np.zeros((row, col), dtype=self.dt)
@@ -281,7 +176,7 @@ class MPhNPrty:
281
176
  output[i, i + 1] = (num - i) * mu1 * pH
282
177
  return output
283
178
 
284
- def _build_D_for_busy_periods(self, num):
179
+ def _build_big_d_for_busy_periods(self, num):
285
180
  """
286
181
  Forms the matrix D at level num for calculating the Busy Period at a given level number.
287
182
  :param num: level number
@@ -291,7 +186,7 @@ class MPhNPrty:
291
186
  col = num + 1
292
187
  row = num + 1
293
188
  else:
294
- output = self.D_for_busy[self.n]
189
+ output = self.big_d_for_busy[self.n]
295
190
  return output
296
191
 
297
192
  output = np.zeros((row, col), dtype=self.dt)
@@ -302,14 +197,14 @@ class MPhNPrty:
302
197
  sumC = 0.0 + 0.0j
303
198
 
304
199
  for j in range(col):
305
- sumA += self.A_for_busy[num][i, j]
200
+ sumA += self.big_a_for_busy[num][i, j]
306
201
 
307
202
  if num != 0:
308
203
  for j in range(col - 1):
309
- sumB += self.B_for_busy[num][i, j]
204
+ sumB += self.big_b_for_busy[num][i, j]
310
205
 
311
206
  for j in range(col):
312
- sumC += self.C_for_busy[num][i, j]
207
+ sumC += self.big_c_for_busy[num][i, j]
313
208
 
314
209
  output[i, i] = sumA + sumB + sumC
315
210
 
@@ -320,19 +215,19 @@ class MPhNPrty:
320
215
  Calculate the busy periods for all levels.
321
216
  """
322
217
 
323
- self.A_for_busy = []
324
- self.B_for_busy = []
325
- self.C_for_busy = []
326
- self.D_for_busy = []
218
+ self.big_a_for_busy = []
219
+ self.big_b_for_busy = []
220
+ self.big_c_for_busy = []
221
+ self.big_d_for_busy = []
327
222
 
328
223
  for i in range(self.n + 2):
329
- self.A_for_busy.append(self._build_A_for_busy_periods(i))
330
- self.B_for_busy.append(self._build_B_for_busy_periods(i))
331
- self.C_for_busy.append(self._build_C_for_busy_periods(i))
332
- self.D_for_busy.append(self._build_D_for_busy_periods(i))
224
+ self.big_a_for_busy.append(self._build_big_a_for_busy_periods(i))
225
+ self.big_b_for_busy.append(self._build_big_b_for_busy_periods(i))
226
+ self.big_c_for_busy.append(self._build_big_c_for_busy_periods(i))
227
+ self.big_d_for_busy.append(self._build_big_d_for_busy_periods(i))
333
228
 
334
- pass_time = PassageTimeCalculation(self.A_for_busy, self.B_for_busy,
335
- self.C_for_busy, self.D_for_busy, is_clx=True, is_verbose=self.verbose)
229
+ pass_time = PassageTimeCalculation(self.big_a_for_busy, self.big_b_for_busy,
230
+ self.big_c_for_busy, self.big_d_for_busy, is_clx=True, is_verbose=self.verbose)
336
231
  pass_time.calc()
337
232
 
338
233
  self.pnz_num_ = self.n ** 2
@@ -422,42 +317,6 @@ class MPhNPrty:
422
317
  p0_min = p0_
423
318
  self.p_iteration_num_ = iter
424
319
 
425
- def _calculate_y(self):
426
- for i in range(self.N):
427
- self.Y.append(np.dot(self.p[i], self.t[i]))
428
-
429
- def _build_matrices(self):
430
- """
431
- Builds matrices A, B, C and D for the system.
432
- """
433
- for i in range(self.N):
434
- self.A.append(self._build_big_a_matrix(i))
435
- self.B.append(self._build_big_b_matrix(i))
436
- self.C.append(self._build_big_c_matrix(i))
437
- self.D.append(self._build_big_d_matrix(i))
438
-
439
- def _calculate_c(self, j):
440
- """
441
- Calculates the value of variable c, participating in the calculation
442
- """
443
- chisl = 0.0 + 0.0j
444
- znam = 0.0 + 0.0j
445
- znam2 = 0.0 + 0.0j
446
-
447
- m = np.dot(self.b2[j], self.B[j])
448
- for k in range(m.shape[1]):
449
- chisl += m[0, k]
450
-
451
- m = np.dot(self.b1[j], self.B[j])
452
- for k in range(m.shape[1]):
453
- znam2 += m[0, k]
454
-
455
- m = np.dot(self.t[j - 1], self.A[j - 1])
456
- for k in range(m.shape[1]):
457
- znam += m[0, k]
458
-
459
- return chisl / (znam - znam2)
460
-
461
320
  def _build_big_a_matrix(self, num: int):
462
321
  """
463
322
  Forms the matrix A(L) at a given level number
@@ -556,22 +415,22 @@ class MPhNPrty:
556
415
  l_start = 1
557
416
  l_end = 0
558
417
  for i in range(1, self.n):
559
- rows = self.B_for_busy[i].shape[0]
560
- cols = self.B_for_busy[i].shape[1]
418
+ rows = self.big_b_for_busy[i].shape[0]
419
+ cols = self.big_b_for_busy[i].shape[1]
561
420
  for r in range(rows):
562
421
  for c in range(cols):
563
- output[l_start + r, l_end + c] = self.B_for_busy[i][r, c]
422
+ output[l_start + r, l_end + c] = self.big_b_for_busy[i][r, c]
564
423
  l_start += i + 1
565
424
  l_end += i
566
425
 
567
426
  # C_for_busy
568
427
  l_start = 1
569
428
  for i in range(1, self.n):
570
- rows = self.C_for_busy[i].shape[0]
571
- cols = self.C_for_busy[i].shape[1]
429
+ rows = self.big_c_for_busy[i].shape[0]
430
+ cols = self.big_c_for_busy[i].shape[1]
572
431
  for r in range(rows):
573
432
  for c in range(cols):
574
- output[l_start + r, l_start + c] = self.C_for_busy[i][r, c]
433
+ output[l_start + r, l_start + c] = self.big_c_for_busy[i][r, c]
575
434
  l_start += i + 1
576
435
 
577
436
  l_start = 0
@@ -407,6 +407,8 @@ class MH2nH2Warm:
407
407
  else:
408
408
  self.x[0] = 1.0 / self.z[1]
409
409
 
410
+ self.t[0] = self.x[0]*(np.dot(self.t[1], self.B[1]).dot(self.G[0]))
411
+
410
412
  x_max1 = 0.0 + 0.0j
411
413
  for i in range(self.N):
412
414
  if self.x[i].real > x_max1.real:
@@ -206,6 +206,8 @@ class MGnH2ServingColdWarmDelay:
206
206
  else:
207
207
  self.x[0] = 1.0 / self.z[1]
208
208
 
209
+ self.t[0] = self.x[0]*(np.dot(self.t[1], self.B[1]).dot(self.G[0]))
210
+
209
211
  x_max1 = np.max(self.x)
210
212
 
211
213
  if self.verbose:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "most_queue"
7
- version = "1.57"
7
+ version = "1.58"
8
8
  authors = [
9
9
  { name="Xabarov Roman", email="xabarov1985@gmail.com" },
10
10
  ]
@@ -1,8 +1,7 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
-
4
3
  setup(name='most-queue',
5
- version='1.57',
4
+ version='1.58',
6
5
  description='Software package for calculation and simulation of queuing systems',
7
6
  author='Xabarov Roman',
8
7
  author_email='xabarov1985@gmail.com',
@@ -16,14 +15,14 @@ setup(name='most-queue',
16
15
  license='MIT',
17
16
  packages=find_packages(),
18
17
  install_requires=[
19
- "colorama",
20
- "matplotlib",
21
- "numpy",
22
- "pandas",
23
- "scipy==1.13.0",
24
- "tqdm",
25
- "graphviz",
26
- "networkx",
18
+ "colorama",
19
+ "matplotlib",
20
+ "numpy",
21
+ "pandas",
22
+ "scipy==1.13.0",
23
+ "tqdm",
24
+ "graphviz",
25
+ "networkx",
27
26
  ],
28
27
  include_package_data=True,
29
28
  zip_safe=False)
@@ -8,7 +8,6 @@ import math
8
8
  import time
9
9
 
10
10
  from most_queue.rand_distribution import (
11
- CoxDistribution,
12
11
  ExpDistribution,
13
12
  GammaDistribution,
14
13
  )
@@ -54,11 +53,9 @@ def test_m_ph_n_prty():
54
53
 
55
54
  mu_low = 1.0 / b1_low
56
55
 
57
- cox_params = CoxDistribution.get_params(b_high)
58
-
59
56
  # calculation using the numerical method:
60
57
  tt_start = time.process_time()
61
- tt = MPhNPrty(mu_low, cox_params, ARRIVAL_RATE_LOW, ARRIVAL_RATE_HIGH,
58
+ tt = MPhNPrty(mu_low, b_high, ARRIVAL_RATE_LOW, ARRIVAL_RATE_HIGH,
62
59
  n=NUM_OF_SERVERS, is_cox=IS_COX,
63
60
  max_iter=MAX_ITER, verbose=False)
64
61
  tt.run()
@@ -370,7 +370,7 @@
370
370
  "name": "python",
371
371
  "nbconvert_exporter": "python",
372
372
  "pygments_lexer": "ipython3",
373
- "version": "3.12.3"
373
+ "version": "3.10.12"
374
374
  }
375
375
  },
376
376
  "nbformat": 4,