-
Hi all, Exercise 1 of Section 3.5 in "Programming Multiagent Systems in Agentspeak Using Jason" asks the reader to change the has(owner,beer) plan trigger to only activate when the source is the owner. That's easy enough, and now my goal looks like:
And as expected, the system now fails after the delivery of beer by the supermarket, as there is no longer a matching plan for the has(owner,beer)[source(self)] goal.
I assume this is intended and the goal of the exercise didn't include "fix this so that it works again." But my obsessive nature leads me to want to fix it. Two options I see: duplicate the has(owner,beer) trigger with both forms [source(self)] and [source(owner)]. Or after the beer delivery, send() a message to the owner, saying "ask me for beer again", and once the owner receives that message, have the owner simply send another beer request to the robot. So my question is: is either of these approaches particularly more idiomatic for Jason, or to be preferred for any other reason? The first approach is arguably "simpler" but requires duplicate code. The second seems more elegant in a way, but is slightly more complex to my way of thinking. OR is there maybe another approach that I'm missing altogether? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I tried the second approach mentioned above and it works fine: robot.asl
owner.asl
My intuition tells me to prefer this, but I'd love to hear what the experts think. :-) |
Beta Was this translation helpful? Give feedback.
-
Hi, I think your solution is reasonable considering the overall application: the owner has to decide about its beers :-). So it seems ok for the robot to delegate this decision to the owner. In your code the owner always accepts the suggestion of the robot, but it could be different. However, considering just AgentSpeak and your question, we can program the plan for
or
Notice that I wrote |
Beta Was this translation helpful? Give feedback.
Hi, I think your solution is reasonable considering the overall application: the owner has to decide about its beers :-). So it seems ok for the robot to delegate this decision to the owner. In your code the owner always accepts the suggestion of the robot, but it could be different.
However, considering just AgentSpeak and your question, we can program the plan for
has(owner,beer)
using theor
operator for two sources:or
Notice that I wrote
trust(A)[source(self)]
instead oftrust(A)
. Otherwise, some malicious agent could just.send(ro…