【发布时间】:2014-01-14 21:01:34
【问题描述】:
我有一个动物在景观中移动的 NetLogo 模型。我想在风景上随机放置虚拟的“相机陷阱”(使用红外光束拍摄动物照片的野外相机),彼此之间有一定的距离。然后,当其中一只动物在相机陷阱的某个半径范围内行走时,会记录蜱数和有关动物的信息。请参见下面的说明性示例。根据插图,我想报告那些与相机陷阱(星形)周围的浅蓝色区域相交的动物的蜱虫和动物信息。我不知道该怎么做。任何建议都会非常有帮助。谢谢。
【问题讨论】:
标签: netlogo
我有一个动物在景观中移动的 NetLogo 模型。我想在风景上随机放置虚拟的“相机陷阱”(使用红外光束拍摄动物照片的野外相机),彼此之间有一定的距离。然后,当其中一只动物在相机陷阱的某个半径范围内行走时,会记录蜱数和有关动物的信息。请参见下面的说明性示例。根据插图,我想报告那些与相机陷阱(星形)周围的浅蓝色区域相交的动物的蜱虫和动物信息。我不知道该怎么做。任何建议都会非常有帮助。谢谢。
【问题讨论】:
标签: netlogo
这只是一些帮助您入门的代码,有几种方法可以满足您的需求,这只是其中之一。在这个有两个品种,相机品种(您可能不需要使用品种,您可以要求一些补丁设置一个变量为真以使它们成为相机点,然后它们可以有记录),相机点记录滴答声和动物它在半径 2 中传递(您也可以使用距离基元)
breed [Animals animal]
breed [Cameras Camera]
Cameras-own [records]
to setup
let Zone 2
clear-all
reset-ticks
resize-world 0 20 0 20
set-patch-size 20
set-default-shape animals "wolf"
set-default-shape cameras "star"
create-Cameras 5 [
set records []
setxy random max-pxcor random max-pycor
set color white
ask patches in-radius Zone
[
Set pcolor 88
]
]
Create-animals 10 [move-to one-of patches]
end
end
to go
ask animals
[
animals-walk
]
tick
end
to animals-walk
rt random 10
fd 1
if any? cameras in-radius 2 [
ask one-of cameras in-radius 2 [
set records lput (list ticks myself) records
]]
end
observer> ask camera 4 [ print records]
[[0 (animal 10)] [0 (animal 11)] [1 (animal 10)] [1 (animal 6)] [2 (animal 10)]
[2 (animal 6)] [3 (animal 10)] [3 (animal 6)] [4 (animal 6)] [10 (animal 7)]
[11 (animal 7)] [12 (animal 7)] [13 (animal 7)]]
更新: 这个不使用相机的品种,而是使用补丁:
breed [Animals animal]
patches-own [records is-camera-point?]
Globals [Cameras]
to setup
let Zone 2
clear-all
reset-ticks
resize-world 0 20 0 20
set-patch-size 20
set-default-shape animals "wolf"
setup-world
Create-animals 10 [move-to one-of patches]
end
to setup-world
ask patches [
set pcolor white
set records []
set is-camera-point? false
]
ask n-of 5 patches [
set is-camera-point? true
set records []
set pcolor red]
set Cameras patches with [is-camera-point?]
end
to go
ask animals
[
animals-walk
]
tick
end
to animals-walk-with-Radius
rt random 10
fd 1
if any? cameras in-radius 2 [
ask one-of cameras in-radius 2 [
set records lput (list ticks myself) records
]
]
end
to animals-walk ; with distance
rt random 10
fd 1
if any? cameras with [distance myself < 2] [
ask one-of cameras with [distance myself < 2] [
set records lput (list ticks myself) records
]
]
end
【讨论】: