在Netlogo中使用两种不同的补丁大小

在Netlogo中使用两种不同的补丁大小,netlogo,Netlogo,我使用面积为1/16公顷的单元,其中有一个变量a。其中一些在模拟过程中获得值1。模式是随机的,并且是不分布的。我想创建第二个面积为1公顷的斑块(4x4个斑块),这样我就可以问以下问题:使用[any patches here with variable a=1]显示计数公顷 非常感谢任何帮助 没有办法宣布不同种类的斑块,更不用说有不同大小的斑块了。但是你想要的是完全可以做到的,而不需要诉诸任何手段。你的公顷只不过是一组较小的斑块。每公顷可以是一个代理集,您可以将这些代理集存储在列表中 以下是如何做

我使用面积为1/16公顷的单元,其中有一个变量a。其中一些在模拟过程中获得值1。模式是随机的,并且是不分布的。我想创建第二个面积为1公顷的斑块(4x4个斑块),这样我就可以问以下问题:使用[any patches here with variable a=1]显示计数公顷
非常感谢任何帮助

没有办法宣布不同种类的斑块,更不用说有不同大小的斑块了。但是你想要的是完全可以做到的,而不需要诉诸任何手段。你的公顷只不过是一组较小的斑块。每公顷可以是一个代理集,您可以将这些代理集存储在列表中

以下是如何做到这一点:

patches-own [ a hectare-id ]
globals [ hectares ]

to setup
  clear-all
  resize-world 0 31 0 31 ; use a 32 * 32 world to make things nicer

  ask patches [
    ; assign a hectare id based on the coordinates of the patch
    set hectare-id (word floor (pxcor / 4) "-" floor (pycor / 4))
  ]

  ; create a list of patch agentsets
  set hectares map [
    patches with [ hectare-id = ? ]    
  ] remove-duplicates [ hectare-id ] of patches

  ; this is part is unnecessary: it only serve to
  ; visually distinguish hectares in the view
  (foreach hectares n-values length hectares [ ? + 1 ] [
    ask ?1 [ set pcolor scale-color green (?2 / length hectares) -0.5 1.5 ]
  ])

  ask n-of 10 patches [ set a 1 ]

  ; filter the list of hectares, keeping only those
  ; where there is any patch with a = 1 in the agentset
  ; and print the length of that filtered list
  show length filter [ any? ? with [ a = 1 ] ] hectares

end