泊松变量,λ连接和到达率,Java网络模拟

发布于 2024-12-08 11:36:28 字数 923 浏览 1 评论 0原文

我正在开发一个网络模拟器,其中数据包到达和传输尝试的事件遵循泊松分布。我对 Knuth 算法进行了改编:

public class Poisson {

    private double λ;
    private Random rand;

    /** Creates a variable with a given mean. */
    public Poisson(double λ) {
        this.λ = λ;
        rand = new Random();
    }

    public int next() {
        double L = Math.exp(-λ);
        double p = 1.0;
        int k = 0;

        do {
            k++;
            p *= rand.nextDouble();
        } while (p > L);

        return k - 1;

    }
}

我的规范规定节点使用泊松过程随机重新安排楼层。平均到达间隔时间呈指数分布,平均值 Ts = 2.5ms。我使用 λ = 2.5 是否正确?

当我想要创建一个新到达事件时,我会执行以下操作:

Event evt = new Event(EventType.ARRIVAL_EVENT,
    MasterClock.getTime + poisson.next());
eventList.add(evt);

模拟器应该运行多次,每次都会增加负载来测量性能。起初我认为到达率等于 λ,但 λ 越大,每秒收到的数据包就越少。到达率和λ之间有什么关系? 我对这篇很长的文章感到抱歉,但我真的很沮丧,因为在大量大学书籍和整个互联网上搜索却没有有效的网络模拟来源......

提前感谢您的帮助。

I'm developing a network simulator in which events for packet arrivals and transmission attempts are following a Poisson distribution. I have an adaptation of Knuth's algorithm:

public class Poisson {

    private double λ;
    private Random rand;

    /** Creates a variable with a given mean. */
    public Poisson(double λ) {
        this.λ = λ;
        rand = new Random();
    }

    public int next() {
        double L = Math.exp(-λ);
        double p = 1.0;
        int k = 0;

        do {
            k++;
            p *= rand.nextDouble();
        } while (p > L);

        return k - 1;

    }
}

My specs state that nodes reschedule floors randomly with a Poisson process. The average interarrival time is exponentially distributed with mean of Ts = 2.5ms. Am I correct in using λ = 2.5?

When I want to make an new arrival event I do something like:

Event evt = new Event(EventType.ARRIVAL_EVENT,
    MasterClock.getTime + poisson.next());
eventList.add(evt);

The simulator is supposedly running several times, every time with increased load to measure performance. At first I thought that the arrival rate equals λ but the bigger the λ the less packets per second I get. What is the relationship between arrival rate and λ?
I am sorry for the very long post but I am really frustrated by searching in lots of university books and all over the internet without a valid source for network simulation...

Thank you in advance for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千秋岁 2024-12-15 11:36:29

这可能看起来很奇怪,但对于泊松过程,您不需要泊松分布,而是指数分布。查看维基百科

您在代码中模拟的到达间隔时间遵循参数 lambda 的指数分布 = 1 / 2.5(lambda 是平均值的倒数)。您可以使用 -Math.log(1.0 - rand.nextDouble()) / lambda 轻松获得随机指数变量。

泊松过程有两种视图: 上述视图保持事件数量固定 (1),而时间间隔变化。另一种观点保持时间间隔固定,但该间隔内的事件数量是随机变量(并遵循泊松分布)。

It might seem weird, but for your Poisson process, you don't need the Poisson distribution but the exponential distribution. Look on wikipedia.

The inter-arrival times, which you are simulating in your code, follow the exponential distribution of parameter lambda = 1 / 2.5 (lambda is the inverse of the mean). You can easily get a random exponential variate with -Math.log(1.0 - rand.nextDouble()) / lambda.

There are two views of the Poisson process: The view described above keeps the number of events fixed (1) and the time interval varies. The other view keeps the time interval fixed, but the number of events in that interval is the random variate (and follows the Poisson distribution).

黒涩兲箜 2024-12-15 11:36:29

Ts = 2.5 毫秒。我使用 λ = 2.5 是否正确

?Ts 是一个时间。 λ 是到达速率, 以每秒的项目数为单位。请参阅William Stallings,队列分析。

Ts = 2.5ms. Am I correct in using λ = 2.5

No. Ts is a time. λ is the arrival rate, in items per second. See William Stallings, Queueing Analysis.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文