8.1 Representing States, Actions, and Goals

To reason about what to do, an agent must have goals, some model of the world, and a model of the consequences of its actions.

A deterministic action is a partial function from states to states. It is partial because not every action can be carried out in every state. For example, a robot cannot carry out the action to pick up a particular object if it is nowhere near the object. The precondition of an action specifies when the action can be carried out. The effect of an action specifies the resulting state.

Example 8.1: Consider a delivery robot world with mail and coffee to deliver. Assume a simplified domain with four locations as shown in Figure 8.1.

Features to describe states

- Rob's location
- Rob has coffee
- Sam wants coffee
- Mail is waiting
- Rob has mail


- move clockwise
- move counterclockwise
- pickup coffee
- deliver coffee
- pickup mail
- deliver mail
Figure 8.1: The delivery robot domain

The robot, called Rob, can buy coffee at the coffee shop, pick up mail in the mail room, move, and deliver coffee and/or mail. Delivering the coffee to Sam's office will stop Sam from wanting coffee. There can be mail waiting at the mail room to be delivered to Sam's office. This domain is quite simple, yet it is rich enough to demonstrate many of the problems in representing actions and in planning.

The state can be described in terms of the following features:

  • the robot's location (RLoc), which is one of the coffee shop (cs), Sam's office (off), the mail room (mr), or the laboratory (lab).
  • whether the robot has coffee (RHC). Let rhc mean Rob has coffee and ¬rhc mean Rob does not have coffee.
  • whether Sam wants coffee (SWC). Let swc mean Sam wants coffee and ¬swc mean Sam does not want coffee.
  • whether mail is waiting at the mail room (MW). Let mw mean there is mail waiting and ¬mw mean there is no mail waiting.
  • whether the robot is carrying the mail (RHM). Let rhm mean Rob has mail, and ¬rhm mean Rob does not have mail.

Suppose Rob has six actions:

  • Rob can move clockwise (mc).
  • Rob can move counterclockwise (mcc).
  • Rob can pick up coffee if Rob is at the coffee shop. Let puc mean that Rob picks up coffee. The precondition of puc is ¬rhc∧RLoc=cs; that is, Rob can pick up coffee in any state where its location is cs, and it is not already holding coffee. The effect of this action is to make RHC true. It does not affect the other features.
  • Rob can deliver coffee if Rob is carrying coffee and is at Sam's office. Let dc mean that Rob delivers coffee. The precondition of dc is rhc ∧RLoc=off. The effect of this action is to make RHC false and make SWC false.
  • Rob can pick up mail if Rob is at the mail room and there is mail waiting there. Let pum mean Rob picks up the mail.
  • Rob can deliver mail if Rob is carrying mail and at Sam's office. Let dm mean Rob delivers mail.

Assume that it is only possible for Rob to do one action at a time. We assume that a lower-level controller can implement these actions.