-
Hi all, another n00bie question here if you will entertain it: I have a simple Environment class that starts a Thread and emits an identical percept every 6 seconds (approximately). And some AgentSpeak code that just triggers when that percept appears as a belief and prints the time. I get that the "old" percept/belief has to be removed before a new event will be triggered, but there's a subtle detail (or two) that I am a little unclear about. To wit: If, in my Environment class I remove the percept using removePercept, AND in my AgentSpeak code I remove the belief using "-belief_name", then everything works exactly as I might expect. I see the belief show up and trigger an event approximately every 6 seconds. Environment
AgentSpeak
Output
So that's all good. But if I don't do the -oracle_killed bit in the AgentSpeak code, I see some weird behavior. I still get the new events, but the timing becomes very chaotic. Output
and then in the other case I tried, I removed the removePercept() bit from the Environment and ONLY had the -oracle_killed part in the AgentSpeak and I never saw any event fired after the first. So what is the takeaway from all this? Is it simply that when working with repeated percepts you should always both remove the belief explicitly in AgentSpeak code AND call removePercept() in the Environment code? Or is there some valid case for the scenario where you call removePercept() but don't remove the belief explicitly in the AgentSpeak code? If so, any details on how one should expect that work worK? And finally, I assume that it's the case that it's never sufficient to just do the -belief_name in the AgentSpeak code, in order to see the subsequent events fire? Is that correct, or am I missing something else. Thanks for your patience as I work my way through all of this! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, some initial comments on that
I can try to run your code later to see if I can identify the problem. |
Beta Was this translation helpful? Give feedback.
Hi, some initial comments on that
-oracle_killed
will not remove the belief! This command is interpreted as-oracle_killed[source(self)]
while the belief isoracle_killed[source(percept)]
. Either use-oracle_killed[source(percept)]
or.abolish(oracle_killed)
. Anyway, it does not seem to be the cause of issues.