我是net logo的新手,我想根据过度捕捞池塘的公地悲剧来编写一个模型。目的是根据需求和供给的经济模型找到渔民和鱼类之间的平衡点。如果渔民较少,池塘中会有更多的鱼类,经过一定时间(蜱虫)后,渔民数量增加,鱼塘中的鱼类数量减少。也许像每天可钓鱼的鱼一样。因此,解决方案是找到方便数量的渔民,因为鱼类仍然可以繁殖。我想在界面中有一个框,我可以输入一个数字,看看鱼的数量会发生什么。
我不知道如何设置它。我希望收到你的来信:)
我从这段代码开始:
breed [fishers fisher]
breed [fishes fish]
to setup
clear-all
reset-ticks
ask patches [set pcolor blue ] ;; lake/pond in form of a rectangle in color
ask patches [ if pxcor > 8 [ set pcolor green ]]
ask patches [ if pycor > 8 [ set pcolor green ]]
ask patches [ if pycor < -8 [ set pcolor green ]]
ask patches [ if pxcor < -8 [ set pcolor green ]]
ask one-of patches with [ pcolor = blue ] [ sprout 20 [set shape "fish" set color pink set size 1.5 ]] ;; creates fishes
ask one-of patches with [ pcolor = green ] [ sprout 2 [set shape "person" set color black set size 3 ] ] ;; creates fishers
end
to go
tick
;;fishes
ask turtles with [ shape = "fish" and color = pink ]
[ right random 360 forward 1
if [pcolor] of patch-ahead 1 = green [ right 180 fd 1 ]]
;; fishers
ask turtles with [ shape = "person" and color = black]
[;right random 360 forward 1
if any? patches with [pcolor = blue]
[set heading towards one-of patches with [pcolor = blue] forward 1]
if [pcolor] of patch-ahead 1 = blue [ right 180 fd 2 ]]
ask turtles with [shape = "person" and color = black]
[if any? turtles with [shape = "fish" and color = pink] in-radius 2
[ask turtles with [shape = "fish" and color = pink] in-radius 2 [die]]]
end
答案 0 :(得分:0)
首先,我建议您查看Netlogo库中的现有模型(Wolf-sheep-predation模型可能有所帮助)。您在当前代码中大致有正确的想法,但您应该查看其他模型以进行改进。您已经设置了不同品种的海龟,但您也应该在“设置”下设置各自的形状。这将在以后帮助你很多 - 而不是要求
ask turtles with [ shape = "fish"...]
你可以简单地
ask fishes [do sth...]
对于界面上的“框”,您可以在界面上设置一个滑块,用于确定您希望运行开始的渔民数量。使用另一个滑块,您可以设置模拟运行中的捕捞压力(即每个渔民将捕获多少鱼),我想您也可以考虑当鱼群减少时这种变化。
最后,对于像你这样的模型,你可以通过绘制no的曲线来观察供需趋势。渔民随着时间的推移而没有。随着时间的推移。再看一下狼 - 羊 - 捕食模型,了解如何做到这一点。
我不能给你更多我害怕因为我不是亲我自己,但希望这有点帮助。希望别人能够给你一个更清晰的想法。