Skip to content

Commit

Permalink
Merge pull request #31 from gitaroktato/docs
Browse files Browse the repository at this point in the history
feat: Adding Little's law as an example
  • Loading branch information
gitaroktato authored Apr 29, 2024
2 parents f439622 + 22a56fb commit 62af59f
Show file tree
Hide file tree
Showing 3 changed files with 476 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [D/D/c queues](simulating-ddc-queues.ipynb)
- [multiple executors](simulating-mdc-queues.ipynb)
- [interesting experiments](interesting-experiments.ipynb)
- [Little's law](littles-law.ipynb)

# Starting the Examples
Installing the environment with [`pyenv`](https://github.com/pyenv/pyenv)
Expand Down
11 changes: 6 additions & 5 deletions interactive-ddc-queues.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d0eae19f26914d3fbb2865bc3b1837df",
"model_id": "fb98c8fcfb474c62b329c591f7ba9a83",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -39,9 +39,6 @@
"from src.queue import Queue, timestamps_to_intervals\n",
"\n",
"SAMPLE_SIZE = 1000\n",
"ARRIVAL_RATE = 1\n",
"EXECUTION_RATE = 2\n",
"EXECUTORS = 2\n",
"\n",
"def display_queue_metrics(arrival_interval, execution_interval, executrs):\n",
" inter_arrival_time = np.full(shape=SAMPLE_SIZE, dtype=int, fill_value=arrival_interval)\n",
Expand Down Expand Up @@ -72,6 +69,10 @@
" fig.tight_layout()\n",
" plt.show()\n",
"\n",
" print(f'The mean queue length (L): {queue.length.mean()}')\n",
" print(f'The arrival rate (λ): {1 / (arrival_interval / 1000)} ops/s')\n",
" print(f'The mean wait time (W): {queue.wait_times.mean() / 1000} s')\n",
"\n",
"interactive_plot = interactive(\n",
" display_queue_metrics,\n",
" arrival_interval=(0, 500),\n",
Expand All @@ -87,7 +88,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "15c94d85-6ec2-4ce1-b7cf-dbd6a1f0fbed",
"id": "c631f4cb-56ba-4dea-acd9-1397000ec9cb",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading

0 comments on commit 62af59f

Please sign in to comment.