Failure, Monitoring and Recovery in the Agent Language 3APL
Total Page:16
File Type:pdf, Size:1020Kb
From: AAAI Technical Report FS-98-02. Compilation copyright © 1998, AAAI (www.aaai.org). All rights reserved. Failure, Monitoring and Recovery in the Agent Language 3APL Koen V. Hindriks, Frank S. de Boer, Wiebevan der Hoek, and John-Jules Ch. Meyer University Utrecht, Departmentof ComputerScience P.O. Box 80.089, 3508 TB Utrecht, The Netherlands {koenh,f rankb, wiebe, j j } ~cs.uu. nl Abstract of the agent. Linked to this is the need for capabilities In a complex and dynamic environment a situat- to monitor the environment of the robot. On the oth- ed agent, like a mobile robot, has limited knowl- er hand, it is quite generally accepted that such agents edge resources and limited control. Sooneror lat- need capabilities for deliberation to achieve purpose- er, therefore, somekind of failure will occur when ful behaviour. Agents should be able to accept goals a robot is attempting to accomplishits task. For and synthesise complex plans for them. Since failures this reason, such an agent must be equipped with are unavoidable, an agent must also be able to recover abilities for dealing with failure. First we give from failures by adapting its activities to a new situa- a general analysis of failure and discuss someof tion. It needs to be able to modify adopted plans in the abilities neededto deal with failure. Thenwe case of (unexpected) changes in the environment which show how to implement mechanisms for dealing affect the status of a plan (cf. (Wilkins et al. 1994)). with failure and monitoring in 3APL.3APL is an Furthermore, it is reasonable to require that a situated agent programminglanguage to support the de- sign and construction of intelligent agents. We agent uses a least commitmentapproach (cf. (Drabble give an outline of 3APLagents whichare entities Tate 1995)). In this paper we focus on the issue consisting of goals, practical reasoning rules, and of failure recovery and ways of implementing mecha- a particular type of control based on an intuitive nisms for dealing with failure in 3APL, a rule-based ordering of rules. agent programming language (Hindriks et al. 1998a; 1998b) to support the design and construction of in- Introduction telligent agents. 3APLis related to other rule-based agent languages like AgentSpeak(L) (Rao 1996; Hin- In an environment which is easy to represent and which is easy to manipulate, there is no reason to expect an driks et al. 1998c), which is an abstraction of PRS, agent acting in this environment to fail. As an exam- and to AGENT-0(Shoham 1993). 3APL is a genuine ple, consider a thermostat. Such a device only has to combination of features of logic programming and im- represent one parameter for the actual temperature and perative programming. The agent language GOLOG one parameter for the desired temperature. Moreover, (Lesp4rance et al. 1996), which is also related to our the device has the capabilities to manipulate the actual language, is based on a purely logical approach. We give an outline of 3APLagents and show how situated temperature to match the desired (higher) temperature. agents are reMised in our framework. Of course, as this examplealso illustrates, both the rep- resentational means and regulating abilities needed are 3APL: Control, Goals and Practical task-relative. The actions of a robot, on the other hand, are almost Reasoning in any environment prone to failure, for a mobile robot In (Hindriks et al. 1998a; 1998b) we defined the formal only has limited knowledge resources and limited con- semantics of our agent programming language 3APL. trol. Operating in increasingly complex environments, 3APL provides a general framework for implement- in which both the rate of change and the diversity of ing the features which are required of situated agents. change increases, becomes more and more difficult for 3APLis designed to build so-called BDI-agents (cf. a mobile robot. The complexity of the environment in (Rao 1996)). The language provides a basic architec- which a robot must accomplish its task puts a number ture, illustrated in figure 1, for building agents, but is of requirements on such an agent. They are derived also designed in such a way that different types of ca- from the environment and are task-relative, but as a pabilities are integrated in an agent. We allow that rule they are general requirements in any complex en- different technologies providing the reasoning abilities, vironment. One of these requirements is that an agent suitable for example for dealing with uncertainty, or for must be able to deal with unexpected changes in its en- diagnosising, can be integrated into the agent architec- vironment, whichrequires a particular level of reactivity ture. Also, different basic actions, for example, a set of 68 primitive robot actions, may be used to build agents. sion mechanism which is not present in agent languages like AgentSpeak(L), AGENT-0,or GOLOG.This revi- sion mechanismprovides the means for reflective rea- soning about the activities or plans which are currently Beliefs being pursued. The control is based on the well-known 1~, / Rules sense-plan-act cycle, and on an intuitive classification of practical reasoning rules. Sensing ~ Effectors Goals A goal is composed of basic actions, tests goals, and achievement goals by means of the programming op- Goals I~~ Abilities erators ; and +, denoting sequential composition and nondeterministic choice, respectively. A basic action is of the form a(~ where a is an action and i’are the action Figure 1: Agent Architecture parameters, a test is of the form ¢? where ¢ is a formula The architecture of the system is based on a modular of the representation language/2, and an achievement design to make such integration as easy as possible. The goal is of the form P(O, where P is a predicate from the programminglanguage 3APLitself specifies the control, language ~:. A goal represents the task an agent wants the execution of actions, and the application of rules to to achieve or the adopted plan to achieve a particular goals. task. Basic actions are represented as primitive, discrete actions in 3APL. Since actions performed by a robot are continuous instead of discrete, we need a method - ~ Rules to map the basic actions of 3APLto the continuous be- haviours of a robot. We use the methodology of map- ping discrete actions onto enable/disable instructions for the robot behavioural controller, and allow config- - ~ Goals uration information (like, for example, a speed param- eter) to be passed through the parameters of basic ac- tions (cf. (Firby 1992), and for a different approach, (Saffiotti, Konolige, ~ Ruspini 1995)). The arrow in fig- - Beliefs ure 1 from control to effectors represents this mapping. Weassume that success/failure reports are provided by Figure 2: Levels of Symbolic Operators the robot behavioural controller and is made available to the 3APL agent. We remark that a 3APL agent is In 3APLthree levels of (symbolic) operators are dis- a separate entity which does not incorporate the robot tinguished, as illustrated in figure 2. The dotted arrows controller, but consists of the beliefs, goals, rules and indicate the input from the belief base that is required capabilities as outlined in the previous section. to be able to apply operators at higher levels. These A complex goal can be graphically represented as a levels are, respectively, (i) beliefs, at the base level, (ii) tree, its goal tree which is a labelled tree representing goals, which update the belief base, at the second level, the task sequence information and choice points in the and (iii) practical reasoning rules, which modify goals, goal. The internal nodes of the tree are labelled by the at the third level. We assume a knowledge representa- program operators ; and +. The leaves of a goal tree tion language 1:, for example(a fragment of) first-order are labelled by basic actions, tests, and achievement logic, and a corresponding deduction system. 3APLal- goals. Goal trees are useful for defining the application so expects as input a specification of the (cap)abilities mechanism of rules to goals. This mechanism is the of the agent. In 3APL,the capability and rule base are basic means for implementing abilities for dealing with assumedto be static, although a planner from first prin- failure. A goal tree is recursively generated from the ciples might be added to provide a mechanismfor incor- syntactic structure of a goal. porating new rules and deleting old rules from the rule base. The belief and goal base are dynamically modified Definition I (goal tree T,~) during the execution of an agent. Goals represent the Let ~- be a goal, and e denote the empty tree (goal). tasks and adopted plans for achieving a task of an agent. Then: A goal tree T~ corresponding to ~" is a labelled 3APL is a multi-threaded system, which means that it tree defined by: can have multiple goals at the same time. Practical rea- (i) If rr is either a(Q, ¢?, or P(Q, soning rules can be used to synthesise or modify plans. then T,r = {e, rr, e), Practical reasoning rules are related to KnowledgeAr- eas in PRS(cf. also (Hindriks et al. 1998c)). Rules (ii) Ifrr = ~rl;~r2, then T~ (T,~I,;,T~), 3APLprovide for a very powerful and general goal revi- (iii) If ~r = ~rl + lr2, then T~ = (T~I, +, T~). 69 We call the goal tree T~, corresponding to a goal r reasoning rules are of the form ,’rh +- ¢ [ ,’vb, where ¢ the canonical representant of ~. However, we consid- is a formula from £, and ,’rh, ~rb are goals, which may er trees in which the left and right subtrees branching also include goal variables. Goal variables are basic, and from a choice point, i.e.