Q: M servers are subject to attacks during a period of time T (for instance 1 year).
Subdivide the interval T in N subinterval of size T/N and in each of this suppose that
an attack can occur with probability λ T/N.
Simulate the attacks to the M servers and represent each of them with a line which makes jumps of 1 at each attack event.

Using the same objects (“movable/resizable rectangle”, histogram, etc.) of the previous homework 3, draw vertically on the line chart the 2 histograms representing the distribution of the number of attacks at the end of the period and one internal istant for comparison.

Study what happens asymptotically, for N large, and a number of systems M a sufficient to give shape to a simulated distribution. Make some personal considerations about the shape and the average of the distributions that you see.

A: In order to solve this exercise, all it took was to slightly modify Homework 3‘s code, more specifically, by modifying the SimulateAttacks function to accomodate for the input of the lambda parameter

        // lets us simulate an arbitrary number of attacks using a specified color
        public void SimulateAttacks(double p, int nattacks, Color color)
        {
            [...]
            for (int i = 0; i < nattacks; i++)
            {
                // generate and simulate the attack
                generated = r.NextDouble();
                defended = p > generated;
                foreach (ResizeableRectangle rr in rrs)
                {
                    // new part
                    if(rr.ct == chartType.FreqSubintervals)
                    {
                        lambda = p;
                        defended = (lambda/rr._N) < generated; // normalize by T
                    }
                    rr.SimulateAttack(defended, color, _SYSTEMS_COUNT);
                }
                   

                this.attacks.Add(defended);
            }
        }

Note that in the following formula

p = \lambda \frac{T}{N} \rightarrow p_T = \frac{\lambda}{N}

In order to have a large λ, we need T\N to be small, hence in the code I have normalized p by T. This way, since λ is a user-picked parameter, we have that

\lambda \in [0, N] \rightarrow p \in [0, 1]

This way we are always sure that p is between 0 and 1, like a normal probability would. The other piece of code interesting for the homework is the following, inside SimulateAttack, where the score is decided

if (!defended)
{
    penetrations++;
    switch (ct)
    {
        [...]
        case chartType.Freq:
        case chartType.FreqSubintervals:
            y -= yStep; 
            currentScore++; 
        break;
        [...]
    }
}
else
{
    switch (ct)
    {
        case chartType.PlusMinus: 
            y += yStep / 2; 
            currentScore--; 
        break;
        case chartType.Freq:
        case chartType.RelativeFreq:
        case chartType.NormalizedFreq:
        case chartType.FreqSubintervals:
            y += 0; 
        break;
     }
}

As per the Javascript code, all I had to do was adding the following line

if(this.mode == "Poisson") row.push(Math.random() <= (this.lambda * (this.T / this.N)) ? true : false);

And that’s it! The result is the following with M = 3000, N = 3000, T = 1, p = 0.5 with 5000 attacks per simulation

Q: Research – Find out on the web about a Poisson point process. See if you can see any analogy with this Exercise and verify whether your distributions come close (for N, M sufficiently large) to the theoretical asymptotic distribution.

A: A Poisson Point Process (PPP) consists of points in a mathematical space (such as the natural numbers line, in general any abstract space) such that they are independent of each other, at each instant.

For instance: the number of data packets exchanged by an ISP in any given month, sand grains scattered on a beach, the number of birds in the sky, and so on.

The PPP has useful and interesting mathematical properties, which explains its popularity when used as a mathematical model for random processes in many disciplines.

In our homework, we can model the attacks on our systems to a PPP due to the fact that by increasing M and N we get to a distribution closer and closer to λ, also due to the fact that the attacks on each system are independent of each other, and all distributed in the same space.

Source: 1 2 3


Back to homepage

Design a site like this with WordPress.com
Get started