将代理移动到 Netlogo 中的家庭范围

Constraining Movement of Agents to a Home Range in Netlogo

我是 NetLogo 的新手,我正在努力模拟新罕布什尔州的驼鹿密度及其与冬季蜱虫寄生的相关性。

我想对我的驼鹿代理进行编程,使其在设定的家庭范围内随机移动(~5 平方公里),该范围源自它们首次进入模型时随机选择的补丁。

我不太确定如何根据区域绑定代理,而不仅仅是补丁颜色...任何有关如何执行此操作的建议将不胜感激!

谢谢!

一般 Whosebug 提示:通常,Whosebug 鼓励特定的编程问题。因此,通常首选包括您到目前为止实际尝试过的代码。

好的,关于你的问题。

一个非常简单的方法是,首先存储驼鹿的起始补丁。其次,当驼鹿四处移动时,检查到起始补丁的距离。如果距离超过起始量,让驼鹿朝向起始斑块。这里有一些模板代码可以给你一些想法:

breed [ mooses moose ]

mooses-own [
  starting-patch
]

to setup
  clear-all
  ;; only using one moose as it's easier to see the behavior
  create-mooses 1 [
    setxy random-xcor random-ycor
    set starting-patch patch-here
  ]
  reset-ticks
end

to go
  ask mooses [
    move
  ]
  tick
end

to move
  ;; If farther than 10 patches from starting patching, take a step towards starting patch, otherwise, move randomly
  ifelse distance starting-patch > 10 [
    face starting-patch
  ] [
    rt random 90
    lt random 90
  ]
  fd 1
end