Netlogo 海龟以直线穿过节点
我正在实施不同的步行程序。在其中的一种情况下,海龟应该按照最小努力(最短距离)的原则,沿着直线朝着一组目标移动/行走“导航节点” 我无法在编程时不获得奇怪的行走模式()。主要程序如下:Netlogo 海龟以直线穿过节点,netlogo,Netlogo,我正在实施不同的步行程序。在其中的一种情况下,海龟应该按照最小努力(最短距离)的原则,沿着直线朝着一组目标移动/行走“导航节点” 我无法在编程时不获得奇怪的行走模式()。主要程序如下: to-report route-on-the-way-to [l current-distance] let routes-on-the-way-to-one-goal (nodes in-radius 3 with [distance l < current-distance - 1]) re
to-report route-on-the-way-to [l current-distance]
let routes-on-the-way-to-one-goal (nodes in-radius 3 with [distance l < current-distance - 1])
report min-one-of routes-on-the-way-to-one-goal [distance self]
end
to walk-towards-goal
let last-distance distance goal
let best-route route-on-the-way-to goal last-distance
ifelse best-route = nobody
[ face goal ]
[ face best-route]
fd 1
end
to move-walkers
if ( one-of (nodes-on patch-here) = goal and one-of (nodes-on patch-here) != myhome) [
ifelse random-float 1.0 < 0.8
[ set goal myhome
walk-towards-goal ]
[set goal one-of potential-goals
walk-towards-goal ]
]
if (one-of (nodes-on patch-here) = goal and one-of (nodes-on patch-here) = myhome)
[
set goal one-of t-potential-goals
walk-towards-goal ]
if (nodes-on patch-here != goal)
[ walk-towards-goal]
end
报告前往[l当前距离]途中的路线
让路线在通往一个目标的路上(半径3中的节点[distance l
使用此解决方案,行走路线的变化太大。有没有关于如何做到这一点的想法,以便随着时间的推移,步行路线更加一致
在NetLogo模型库中,有一个名为“链接行走海龟示例”的模型,我认为它完全符合您的要求,与我的要求类似。使用该解决方案,问题将是如何设置“道路”布局(我找到了一个道路网络生成器文件),以及海龟如何通过链接获得更多节点或交叉点。您是否尝试过为每个海龟设置
goal
局部变量?在我看来,这可能是问题所在,因为每只乌龟都在衡量全球目标,它们可能面临错误的立场,或者认为自己比现在更遥远。