Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding Little's law as an example #31

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading