Slides from a lecture I gave in 2003 to a graduate level computer science class in Artificial Intelligence with a focus on Intelligent Software Agents. The lecture was an introduction to the JACK BDI agent programming language.
Concepts Agents Beliefs Events Plans Capabilities The JACK Development Environment JDE Design Diagrams Resources Michael Papasimeon JACK Programming 22 October 2003 2 / 35
Software (AOS) in Melbourne Agent oriented programming language Team oriented programming language A set agent oriented extensions to Java and an agent oriented run time environment. Agent oriented development environment (JDE) A set of supporting tools and infrastructure Michael Papasimeon JACK Programming 22 October 2003 3 / 35
BDI agent (or mental state): Beliefs What an agent believes about the world, itself and other agents (informational). Desires What an agent want to achieve (motivational). Intentions How the agent tries to achieve desires (deliberational). Michael Papasimeon JACK Programming 22 October 2003 5 / 35
CONTROL LOOP 1 while True do observe-the-world(); update-internal-world-model(); deliberate-about-what-intention-to-achieve-next() use-means-end-reasoning-to-get-a-plan-for-next-intention() execute-the-plan end while end procedure Michael Papasimeon JACK Programming 22 October 2003 8 / 35
CONTROL LOOP 2(B0) B ← B0 while True do ρ ← get next percept(); B ← brf(B, ρ); D ← deliberate(B); π ← plan(B, I); execute(π); end while end procedure Michael Papasimeon JACK Programming 22 October 2003 9 / 35
CONTROL LOOP 3(B0, I0) B ← B0 I ← I0 while True do ρ ← get next percept(); B ← brf(B, ρ); D ← options(BI); I ← filter(B, D, I); π ← plan(B, I); execute(π); end while end procedure Michael Papasimeon JACK Programming 22 October 2003 10 / 35
plans as reciples (pre-planning) Least commitment Bounded rationality Dynamic environment Goals, beliefs, plans Intentions and run-time (not design time) constructs Michael Papasimeon JACK Programming 22 October 2003 11 / 35
posted (internal). A change in the environment and hence a change in belief (external). 2 Agent reasoner searches through the plan library to find the set of plans which can handle this event (defined by the invocation condition). 3 This may result in in 10 plans out of 500 which can handle the event. Out of these 10 plans, the agent reasoner then chooses only those which are appropriate for this context – that is, the current situation. Michael Papasimeon JACK Programming 22 October 2003 14 / 35
out of the 10 which are applicable in this context. 6 The agent then chooses one of the plans, puts it on the intention stack, and starts executing the plan steps in the plan. 7 This executing plan is called an intention to achieve the original goal. 8 If the plan fails, the agent will try on of the other applicable plans until one of them succeeds in achieving the goal or all of them fail, in which case the goal will fail. Michael Papasimeon JACK Programming 22 October 2003 15 / 35
is chosen in the applicable plan set by using meta-level reasoning. Plans can wait until particular beliefs are satisfied. Plan steps can involve trying to achieve sub-goals. When trying to achieve a sub-goal, the existing plan is suspended and the new plan is put on top of the intention stack. Michael Papasimeon JACK Programming 22 October 2003 16 / 35
2003 Needs Java 1.4.x, does not yet work with Java 1.5 Windows set CLASSPATH=c:\ aos\ lib\ jack.jar;. Bash CLASSPATH=/aos/jack/lib/jack.jar:. export CLASSPATH csh/tcsh setenv CLASSPATH=/usr/local/aos/jack/lib/jack.jar:. Michael Papasimeon JACK Programming 22 October 2003 17 / 35
agent definition. .cap JACK capability definition. .plan JACK plan definition. .event JACK event definition. .bel JACK beliefset definition. .view JACK view definition. .java Java class or interface definition. Michael Papasimeon JACK Programming 22 October 2003 18 / 35
1 Generate Java code from the original .agent, .plan, .bel .event etc. files. 2 Compile the Java code Building JACK code... $ java aos.main.JackBuild Running is the same as Java programs... $ java Test Michael Papasimeon JACK Programming 22 October 2003 19 / 35
to support Agent Oriented programming: It defines new base classes, interfaces and methods. It provides extensions to the Java syntax to support new agent-oriented classes, definitions and statements. It provides semantic extensions (runtime differences) to support the execution model required by an agent-oriented software system. Michael Papasimeon JACK Programming 22 October 2003 20 / 35
behaviour of an intelligent software agent. This includes capabilities an agent has, what type of messages and events it responds to and which plans it will use to achieve its goals. Capability Allows the functional components that make up an agent to be aggregated and reused. A capability can be made up of plans, events, beliefsets and other capabilities that together serve to give an agent certain abilities. BeliefSet The beliefset construct represents agent beliefs using a generic relational model. View The view construct allows general purpose queries to be made about an underlying data model. The data model may be implemented using multiple beliefsets or arbitrary Java data structures. Event The event construct describes an occurrence in response to which the agent must take action. Plan An agent’s plans are analogous to functions. They are the instructions the agent follows to try to achieve its goals and handle its designated events. Michael Papasimeon JACK Programming 22 October 2003 21 / 35
can use and refer to. Events (both internal and external) that the agent is prepared to handle. Plans that the agent can execute. Events the agent can post internally (to be handled by other plans). Events the agent can send externally to other agents. Michael Papasimeon JACK Programming 22 October 2003 23 / 35
data Position myPosition; #private data Position airportPosition; #private data FuelLevel fuelRemaining; #handles event TakeOffClearance clearedForTakeOff; #posts event StormDetected detectedStorm; #sends event RequestLanding landingRequest; #uses plan TakeOff; #uses plan Cruise; #uses plan LandAircraft; #uses plan AvoidStorm; #has capability EmergencyLanding elanding; Pilot(String name) { super(name); ... } } Michael Papasimeon JACK Programming 22 October 2003 24 / 35
2 BDI events The key difference between normal events and BDI events is how an agent selects plans for execution. With normal events, the agent selects the first applicable plan instance for a given event and executes that plan instance only. The handling of BDI events is more complex and powerful. An agent can assemble a plan set for a given event, apply sophisticated heuristics for plan choice and act intelligently on plan failure. Michael Papasimeon JACK Programming 22 October 2003 25 / 35
that an agent can take when an event occurs. Whenever an event is posted and an agent adopts a task to handle it, the first thing the agent does is try to find a plan to handle the event. Plans can be thought of as pages from a procedures manual. They describe, in explicit detail, exactly what an agent should do when a given event occurs. Each plan is capable of handling a single event. When an instance of a given event arises, the agent may execute one of the plans that declare they handle this event. Michael Papasimeon JACK Programming 22 October 2003 28 / 35
that declare they handle an event by determining whether a plan is relevant. It does this by executing the relevant() method of each plan. Once the relevant plan(s) have been identified, the agent determines which of these are applicable. It does this by executing the plans’ context() method. The context method is a JACK Agent Language logical expression that can bind the values of the plan’s logical members. For every possible set of bindings, a separate applicable instance of the plan is generated. When the agent has found all applicable instances of each relevant plan, it selects one of these to execute. Michael Papasimeon JACK Programming 22 October 2003 29 / 35
maintain an agent’s beliefs about the world. An agent’s beliefset can be stored as either an OpenWorld or a ClosedWorld class. The beliefset represents these beliefs in a first order, tuple-based relational model Closed World Beliefs True or False Open World Beliefs True, False or Unknown Michael Papasimeon JACK Programming 22 October 2003 32 / 35
#key field String title; #key field String author; #value field double price; #indexed query get(String t, String a, logical double p); } Michael Papasimeon JACK Programming 22 October 2003 33 / 35
views etc. A way to make modular agent code. Groups related agent abilities together. Elements can belong to more than one capability. Like an index of elements not a partitioning same element mentioned in many capabilities Module of elements that together implement a function (ability) Allows posting event in one capability, handling in another Allows data being hosted by one capability, used by another May be enabled / disabled dynamically if disabled, then its plans are not applicable no effect on data Michael Papasimeon JACK Programming 22 October 2003 34 / 35