私は NetLogo の初心者で、エージェントベースの強化学習 (RL) モデルを作成しようとしています。おもちゃのモデルを作り直して助けを求めました。
ここでは、1 つのエージェントが 2 つのエージェントと相互作用することによって RL を行っています。そのうちの 1 つは信頼性が低く (したがって、このエージェントとの相互作用は強化されません)、もう 1 つは信頼性があります (したがって、このエージェントとの相互作用は強化されます)。
しかし、エラーが発生し続けます。Extension exception: No urn specified
つまり、明らかに、骨壷を指定する方法を理解する必要があります!
プロジェクト フォルダーは、次の場所でチェックアウトできます 。 .
どんな助けでも大歓迎です。
extensions [ urn ] ;; the urn extension that contains the RL functions
breed [ agents agent ]
globals [ ;; Global variables
A1 ;; urn-ball name of agent 1 (RED)
A2 ;; urn-ball name of agent 2 (GREEN)
]
agents-own [ ;; Values assigned to each agent
main-urn ;; Name of the Polya urn used in RL
interactionPartner ;; Variable tracking who the learner is interacting with
knowledgeState ;; Variable tracking whether the learner knows the truth after each interaction
]
to setup ;; Setup the stage
clear-all
reset-ticks
setup-agents ;; Sets up the agents
end
to have-agents-setup-urns ;; Setting up agent polya urns for reinforcement learning (by observer)
ask agent 0 [
set main-urn urn:make-polya-urn initial-weight (list A1 A2)
;; There are two types of balls in the urn: A1, A2 corresponding to the two possible agents with whom the chooser may interact
]
end
to setup-agents ;; Setting up the agents in the population (by observer)
create-agents 3 [
setxy (-6 * cos ( who * 360 / population-size)) (12 * sin (who * 360 / population-size))
set shape "circle"
set size 4
]
ask agent 0 [ ;; This is the agent doing the reinforcement learning (BLUE)
set color [0 0 255 175]
]
ask agent 1 [ ;; This is the unreliable agent (RED)
set knowledgeState 0
set color [255 0 0 175]
]
ask agent 2 [ ;; This is the reliable agent (GREEN)
set knowledgeState 1
set color [0 255 0 175]
]
end
to step ;; The step function
ask turtles [do-game-play]
tick
end
to go ;; The go function simply calls step continuously
step
end
to do-game-play ;; The game play function (by observer)
ask agent 0 [
set interactionPartner urn:draw-ball main-urn ;; Draw from the agent urn to figure out with whom to interact.
if (interactionPartner = A1) [
set knowledgeState ( 0 ) ;; If the interactionPartner is agent 1 (who is unreliable), then set agent 0 knowledge state to 0.
]
if (interactionPartner = A2) [
set knowledgeState ( 1 ) ;; If the interactionPartner is agent 2 (who is reliable), then set agent 0 knowledge state to 1, and reinforce.
urn:reinforce main-urn A2 1
]
]
end