我有一个重复的模型,并对其进行了一些调整。当我以相同的固定种子运行两个模型时,我不会得到相同的结果,我理解这是因为我在模型中还有其他随机性来源。无论如何,在这两个模型中,我都使用一个源块,因此到达是由速率时间表定义的,时间表是类型速率,并且从数据库中提供。现在,我知道以下信息:
- 通常,我可以在分布中使用自己的随机数生成器(RNG),例如三角形(5、10、25,myrng),因此随机myrng =
- by new andang = by New Random(2)默认情况下,具有“类型”速率的时间表遵循使用默认RNG的激情分布。
- 在模型中的任何时候,我可以通过调用setDefaultrandomgenerator(随机R)来替换默认RNG。
问题是:是否可以使用固定的种子来确保我在这两种模型中都获得相同的输入?
I have a model that I have duplicated and made some adjustments to it. When I run both models with the same fixed seed I don’t get the same results, which I understand because I have other sources of randomness in the model. Regardless, in both models, I am using a source block, such that the arrivals are defined by a rate schedule, the schedule is of type rate, and is provided from the database. Now, I know the following pieces of information:
- Generally, I can use my own random number generator (RNG) in distributions, for example triangular(5, 10, 25, myRNG), such that Random myRNG = new Random (2)
- By default, a schedule with “type” rate follows a passion distribution that utilizes the default RNG.
- At anytime in the model, I can substitute the default RNG with my own by calling setDefaultRandomGenerator(Random r).
The question is: Is it possible to use a fixed seed for the arrival rate to make sure I am getting the same exact input in both models?
发布评论
评论(2)
在任何方面,费率始终等同于带有lambda的泊松分布等于您设定的速率,
Intearrival时间不会遵循任何分布,但是在现场使用指数(Lambda)等同于使用乘以速率的到达Lambda。
但是Poisson和指数是密切相关的,这就是为什么如果您在InteArival时间使用
Poisson(1.0/lambda)
,则您的平均到达与使用dendeartential(lambda)< /代码>。
不可能为到达率设置种子,这就是为什么您需要在源中使用Intearrival时间
,但是您需要先创建一个变量,让我们称其为rand,将其称为rand,type and type and type and total and intiral vality
new new随机(种子)
您想要的任何整数(更精确)
在您需要执行的目标时间内,
,无论您在任何logic实验中具有什么配置,这都会导致唯一的模拟运行
In anylogic, rates are always equivalent to a poisson distribution with lambda equal to the rate you set,
Intearrival times don't follow any distribution, but using exponential(lambda) in the field is equivalent to using a arrival by rate with a rate of lambda.
But poisson and exponential are closely related, which is why if you use
poisson(1.0/lambda)
in the intearrival time, you have the same average arrivals as if you useexponential(lambda)
.It is not possible to set a seed for the arrival rate, and that's why you need to use intearrival times instead in your source
But you need to create a variable first, let's call it rand, of type Random with initial value
new Random(seed)
where seed is any integer you want (long to be more exact)
then in the intearrival time you need to do:
This will lead to unique simulation runs, no matter what configuration you have in the AnyLogic experiment
当然,只需将两个源块设置为“到达”定义的“到达”中的“临时时间”。
然后,在现场使用相同的代码
poisson(1,myrng)
,请确保myrng
rng使用相同的初始种子(即new Randome(1234) )
(“速率”设置与使用
posiss(1)
用于Arriarival-time的设置相同)Sure, simply set both Source blocks to "Interarrival time" in the "arrivals defined by".
Then, use the same code
poisson(1, myRNG)
in the field, making sure that themyRNG
RNG uses the same initial seed (i.e.new Random(1234)
(the "Rate" setting is the same as using
poission(1)
for interarrival-time)