面向过程的模拟中的稳态
我目前正在使用 JavaSim 编写面向过程的模拟器以进行大学考试。模拟器本身运行良好,但我有一个主要疑问:是否有一种正确/最佳的方法来在代码中找到模拟的稳态?
我读过的书模糊地描述了当模拟的行为收敛到恒定或重复值时找到“稳态”的过程:
稳态 http://img24.imageshack.us/img24/9782/steadystate.png
但这在代码中看起来如何?我想我可以定期对需要收集的统计数据进行采样,并检查它们是否收敛于某个平均值。或者我可以简单地及时打印出这些值并任意决定模拟何时达到稳定状态?
I'm currently writing a process-oriented simulator using JavaSim for an university exam. The simulator itself is working nicely, but I have one major doubt: is there a correct/best way to find the steady state of the simulation in code?
The book I read vaguely describe the process of finding the "steady state" when the behavior of the simulation converges to a constant or repeating value:
Steady state http://img24.imageshack.us/img24/9782/steadystate.png
But how does this look in code? I think I could sample the statistics I need to gather at regular intervals and check whether they converge on a certain mean value or not. Or I could simply print out the values in time and arbitrarily decide when the simulation reaches a steady state?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
标准方法是监控波动率,并选择一些足够小的阈值以被视为“稳态”。使用提供的平均值很脆弱,因为它硬编码了您正在寻找的解决方案的绝对值。
我只需计算一个点窗口的标准差,比如最后50个点,然后声明当偏差低于可接受的最小值时达到的稳定状态(您必须自己选择最小偏差,因为这是您对“稳定状态”的定义)。这大致相当于当图表中的摆动在一段持续时间内变得足够小时接受答案。
The standard approach is to monitor the rate of fluctuation, and pick some threshold small enough to be considered 'steady state'. Using a provided mean value is fragile because it hard-codes the absolute value of the solution you're looking for.
I would just calculate the standard deviation for a window of points, say the last 50, and declare the steady state reached when that deviation falls below an acceptable minimum (you do have to pick the minimum deviation yourself, because this is your definition of 'steady state'). This is roughly equivalent to accepting the answer when the wiggles in your graph become small enough for some sustained time.
没有看到您对此有过好的答案...
查看在线资源或 Law 和 Kelton,模拟建模和分析,了解确定稳态的过程。关键是您希望模拟独立于系统启动条件。更重要的是,关键措施(如延迟)的分布应该独立于起始条件。他们有一套程序来根据均值、方差和样本量围绕关键度量构建置信区间,然后确定连续样本在统计上是否相同。为了满足正态性假设,拥有足够的样本量很重要。
《Simulation with Arena》一书中的好东西还包括对为什么稳态可能不重要的讨论。
祝你好运 !
Don't see that you ever got a good answer to this...
Check out online resources or Law and Kelton, Simulation Modeling and Analysis, for the process of determining steady state. The key is that you want your simulation to be independent of the system starting conditions. More to the point, the distribution of your key measures (like delay) should be independent of the starting conditions. They have a set of procedures to construct confidence intervals around your key measure based on the mean, variance, and sample size then to determine whether your consecutive samples are statistically the same. It's important to have a sufficient sample size though to satisfy the normality assumption.
Also good stuff in the book Simulation with Arena include a discussion of WHY steady state may not be important.
Good luck !