如何制作代理变量列表?
How do I make a list of agent variables?
我正在尝试使我的模型与无法处理我通常导出到的 csvs 并且需要列表的接口框架兼容。具体来说,我需要做的是导出与每种特定代理人相关的变量列表列表。
理想情况下:
set master-list (foreach person set traits-list list (who) (color) (heading) (xcor) (ycor) (etc...))
但我遇到的主要问题是,在以 set traits-list list (items)
方式设置前两个变量后,它开始在任何后续变量上抛出错误。我可以 lput
每个单独的变量,但这似乎是一种不必要的混乱设置方式。我错过了什么吗?
我试过查看是否是单个变量的问题,但无论第三个变量是什么,错误仍然存在。
如果有人想查看有问题的完整代码,我正在尝试 https://github.com/efyoungud/stationfire work with https://github.com/hlynka-a/SRTI。
JenB 得到了需要支架的答案。
最终,功能代码:
ask people [ foreach [self] of people [
set traits-list (list (who) (color) (heading)(xcor)(ycor)(shape)(breed)(hidden?)(size) (alarmed?) (age)(visited?)(group-number) (group-type) (group-constant)(speed) (leadership-quality) (leader) (goal) (energy)(speed-limit)
)]] ; doesn't include next-desired-patch or path because that's calculated each step and doesn't need to be exported
set master-list [traits-list] of people
end ```
我正在尝试使我的模型与无法处理我通常导出到的 csvs 并且需要列表的接口框架兼容。具体来说,我需要做的是导出与每种特定代理人相关的变量列表列表。
理想情况下:
set master-list (foreach person set traits-list list (who) (color) (heading) (xcor) (ycor) (etc...))
但我遇到的主要问题是,在以 set traits-list list (items)
方式设置前两个变量后,它开始在任何后续变量上抛出错误。我可以 lput
每个单独的变量,但这似乎是一种不必要的混乱设置方式。我错过了什么吗?
我试过查看是否是单个变量的问题,但无论第三个变量是什么,错误仍然存在。
如果有人想查看有问题的完整代码,我正在尝试 https://github.com/efyoungud/stationfire work with https://github.com/hlynka-a/SRTI。
JenB 得到了需要支架的答案。
最终,功能代码:
ask people [ foreach [self] of people [
set traits-list (list (who) (color) (heading)(xcor)(ycor)(shape)(breed)(hidden?)(size) (alarmed?) (age)(visited?)(group-number) (group-type) (group-constant)(speed) (leadership-quality) (leader) (goal) (energy)(speed-limit)
)]] ; doesn't include next-desired-patch or path because that's calculated each step and doesn't need to be exported
set master-list [traits-list] of people
end ```