Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops netlogo中整个列表的随机泊松值_Loops_Random_Netlogo_Poisson_Agent Based Modeling - Fatal编程技术网

Loops netlogo中整个列表的随机泊松值

Loops netlogo中整个列表的随机泊松值,loops,random,netlogo,poisson,agent-based-modeling,Loops,Random,Netlogo,Poisson,Agent Based Modeling,我有叫“订单”的特工 在这些代理中,有许多设备作为属性。根据每个设备的使用年限,一定数量的设备将按照随机泊松过程破裂。例如: 订单具有以下属性: 已安装设备的数量(已安装数量) 损坏设备的数量(损坏的数量) 此时间步中断的设备数(今年中断) 此订单中设备的使用年限(订单使用年限) 订单的平均寿命(平均寿命) 我发现了一些方法,可以通过列表方法中的过滤器来实现这一点: ask orders [ let broken-list n-values amount-installed [ran

我有叫“订单”的特工 在这些代理中,有许多设备作为属性。根据每个设备的使用年限,一定数量的设备将按照随机泊松过程破裂。例如:

订单具有以下属性:

  • 已安装设备的数量(已安装数量)
  • 损坏设备的数量(损坏的数量)
  • 此时间步中断的设备数(今年中断)
  • 此订单中设备的使用年限(订单使用年限)
  • 订单的平均寿命(平均寿命)
我发现了一些方法,可以通过列表方法中的过滤器来实现这一点:

ask orders [
    let broken-list n-values amount-installed [random-poisson order-age]
    set broken-list filter [s -> s >= average-lifespan] broken-list
    set broken-this-year length broken-list
    set amount-installed amount-installed - broken-this-year
    set amount-broken amount-broken + broken-this-year
]
 ask orders [
    while [amount-checked < amount-installed] [
      if random-poisson order-age >= average-lifespan [
        set broken-this-year broken-this-year + 1
      ]
      set amount-checked amount-checked + 1
    ]
    set amount-installed amount-installed - broken-this-year
    set amount-broken amount-broken + broken-this-year
]
我发现实现这一点的另一种方法是使用while循环方法:

ask orders [
    let broken-list n-values amount-installed [random-poisson order-age]
    set broken-list filter [s -> s >= average-lifespan] broken-list
    set broken-this-year length broken-list
    set amount-installed amount-installed - broken-this-year
    set amount-broken amount-broken + broken-this-year
]
 ask orders [
    while [amount-checked < amount-installed] [
      if random-poisson order-age >= average-lifespan [
        set broken-this-year broken-this-year + 1
      ]
      set amount-checked amount-checked + 1
    ]
    set amount-installed amount-installed - broken-this-year
    set amount-broken amount-broken + broken-this-year
]
询问订单[
而[检查的数量<安装的数量][
如果随机泊松顺序年龄>=平均寿命[
本年已损坏本年已损坏+1
]
设置检查金额检查金额+1
]
设置安装数量安装数量-今年已损坏
设置本年破数破数+破数
]

因此,应该有一些已安装的设备出现故障,而一些设备仍在工作。然而,每个订单由数千台设备组成,在我的模型中有数百台订单。因此,这个过程需要非常长的时间才能使计算机冻结。必须有一种方法可以在不使用循环方法的情况下获得相同的结果。有人知道更好的方法吗?

我认为这些设备都是相同的,至少在一个顺序内是相同的,对吗?也就是说,您只需要对订单中的设备进行计数,并跟踪运行和损坏的设备数量,它们没有年龄等不同的特征。如果是这样,我相信您可以使用泊松分布作为每个订单的单个操作返回新断开的数量。这意味着每个订单的设备数量对性能没有影响。