0

netlogoで感染したカメの累積平均を計算しようとしていますが、どのコードを正確に使用すればよいのか、netlogoコードのどこに配置すればよいのかわかりません。いくつかのテストを行い、ノードの平均を計算しようとしましたが、正しくありません。私もリストを作成しようとしましたが、どちらも成功しませんでした。コードのどこに行を配置する必要がありますか?

ここにいくつかのコード:

observer> show mean [num-infected] of turtles
observer: 198
observer> show mean [num-infected] of turtles / length num-infected
observer> show mean [num-infected] of turtles / length [num-infected] of turtles
observer: 0.99
observer> show sum [num-infected] of turtles / length [num-infected] of turtles
observer: 197
observer> show count [num-infected] of turtles / length [num-infected] of turtles
observer> show mean [num-infected] of turtles / length [num-infected] of turtles
observer: 0.955
observer> show sum [num-infected] of turtles / length [num-infected] of turtles
observer: 191
observer> show sum [mean num-infected] of turtles
observer> show mean [ num-infected] of turtles
observer: 191
observer> show mean [ num-infected] of turtles
observer: 1
observer> show mean [ num-infected] of turtles
observer: 198
observer> show mean [ num-infected] of turtles
observer: 198
observer> show mean [ num-infected] of turtles
observer: 198
observer> show  [ num-infected] of turtles
observer> show count turtles with [infected? = true]
observer: 198
observer> show count turtles with [infected? = true] / length [num-infected] of turtles
observer: 0.99
observer> show count num-infected / count turtles with [infected? = true] 
ERROR: Expected an agentset here, rather than a list or block. 

ありがとう。

4

1 に答える 1

0

http://groups.yahoo.com/neo/groups/netlogo-users/conversations/topics/16345の netlogo-users グループの回答を参照してください。

トラビス・ヒンケルマンは次のように書いています。

私が正しく理解している場合、レポーターの手順は次のようになります。

to-report cumul-av-sum
;; drop the first member of the list, but not until there are at least 200 items in the list
if (length cumul-av-list > 200) [ set cumul-av-list but-first
cumul-av-list ]
;; add the number of raindrops created in last tick to the end of the list
set cumul-av-list lput num-infected cumul-av-list
report sum cumul-av-list
end

このレポーター プロシージャは、リストを正しく更新するために、ティックごとに (おそらくプロットの一部として) 呼び出す必要があります。

于 2013-10-27T15:09:09.417 に答える