We would like to design a [network packet]([login to view URL]) routing system. To do so, we will need to define the system and run a simulation so that we can generate data that will be used for the optimization of design parameters. Our router will be a bit of a simpler system, so do not worry about any specifics you know about ethernet or telecommunications in general. The goal of our router is that it will route packets from devices connected to it through to the internet.
We'll parameterize our router so that it can accept $\alpha$ packet routing connections at any time. Assume that packets take $\beta$ time to be routed through the router. Let's say that each device connected to the router is only willing to wait for up to $\gamma$ time for the packet to be routed to its destination.
Let's also say that our system will allow for prioritization on three levels so that we can make sure those high-priority packets like those for voice and video calls can route through before lower-priority packets like standard file downloads.
Please refer to the below attached file for a better understanding
To model our system, let's say that we have $n$ devices on our network connection to the router. Each device generates $X_v$ video calling packets, $X_s$ standard priority packets, and $X_l$ low priority packets at an $X_i$ interval time between each packet submitted to the router. So, say that this device has a total of $X_v + X_s + X_l$ packets. I would recommend that you shuffle this set of packets. This device would submit the first of these packets (in any order) to the router at time 0. The device would then wait for $X_i$ before submitting the next packet (which again can be any of those in this device's collection), and again until the total number of packets has been submitted to the router.
Higher priority packets will not preempt lower-priority packets, but they will be able to jump the queue (`[login to view URL]`).
Based on the distributions for the parameters below, what is the average number of packets that make it through the router to the internet, for $n$ = [3, 5, 10, 15]? All time-related parameters below are in milliseconds. Make sure to set the random seed.
- $\alpha$ = 6
- $\beta$ = exponentially-modified normal continuous random variable at location 1 and scale 1.5
- $\gamma$ = 3
- $X_v$ = uniform discrete random variable between [2,10]
- $X_s$ = uniform discrete random variable between [2,10]
- $X_l$ = uniform discrete random variable between [2,10]
- $X_i$ = binomial discrete random variable with n at 10 and p at 0.5
Create a function that will automatically run the simulation above, introducing a new constraint named $\omega$, which is the length of time the router is willing to dedicate to routing a packet. Thus, you will need to modify Problem 1 so that $\omega$ is incorporated as another wait time that will interrupt the packet routing.
Then, we would like to see how $\omega$ affects the number of packets that successfully route through. Make sure that the function sets the same random seed inside the function so that your simulation parameters are consistent across runs.
Using `scipy.optimize.minimize_scalar()` ([see reference]([login to view URL])), what is the value of $\omega$ (router processing time allocated) that results in the highest number of packets that successfully route through our router design, where $2 \le \omega \le 10$?
Please find the below file for better understanding