# 6.1.3 Feature-Based Representation of Actions

Whereas STRIPS is an action-centric representation, a feature-centric representation is more flexible, as it allows for conditional effects, and non-local effects.

A feature-based representation of actions models

• the precondition of each action

• for each feature, the feature values in the next state as a function of the feature values of the previous state and the action.

The feature-based representation of actions uses definite clauses to specify the value of each variable in the state resulting from an action. The bodies of these rules can include propositions about the action carried out and propositions about values of features in the previous state. We assume these propositions can be equalities and inequalities between features and values.

The rules have two forms:

• A causal rule specifies when a feature gets a new value.

• A frame rule specifies when a feature keeps its value.

It is useful to think of these as two separate cases: what makes the feature change its value, and what makes it keep its value.

###### Example 6.7.

In Example 6.1, Rob’s location depends on its previous location and where it moved. Let $RLoc^{\prime}$ be the variable that specifies the location in the resulting state. The following rules specify the conditions under which Rob is at the coffee shop:

 $\displaystyle{RLoc^{\prime}{=}cs\leftarrow\mbox{}RLoc{=}off\wedge\mbox{}Act{=}% mcc.}$ $\displaystyle{RLoc^{\prime}{=}cs\leftarrow\mbox{}RLoc{=}mr\wedge\mbox{}Act{=}% mc.}$ $\displaystyle{RLoc^{\prime}{=}cs\leftarrow\mbox{}RLoc{=}cs\wedge\mbox{}Act{% \neq}mcc\wedge\mbox{}Act{\neq}mc.}$

The first two rules are causal rules and the last rule is a frame rule.

Whether the robot has coffee in the resulting state depends on whether it has coffee in the previous state and its action. A causal rule specifies that picking up the coffee causes the robot to have coffee in the next time step:

 $\displaystyle{rhc^{\prime}\leftarrow\mbox{}Act{=}puc.}$

A frame rule specifies that the robot having coffee persists unless the robot delivers the coffee.

 $\displaystyle{rhc^{\prime}\leftarrow\mbox{}rhc\wedge\mbox{}Act{\neq}{dc}.}$

The rule implicitly implies that the robot cannot drop the coffee, drink it or lose it, and the coffee cannot be stolen.

The feature-based representation is more powerful than the STRIPS representation; it can represent anything representable in STRIPS, but can also represent conditional effects. It may be more verbose because it requires explicit frame axioms, which are implicit in the STRIPS representation.

The mapping from STRIPS to the feature-based representation for Boolean features is as follows. If the effect of an action $act$ is $\{e_{1},\dots,e_{k}\}$, the STRIPS representation is equivalent to the causal rules

 $e_{i}^{\prime}\leftarrow\mbox{}act.$

for each $e_{i}$ that is made true by the action and the frame rules

 $c^{\prime}\leftarrow\mbox{}c\wedge\mbox{}act.$

for each condition $c$ that does not involve a variable on the effects list. Thus each $e_{i}$ that assigns a feature to be false does not result in a rule. The precondition of each action is the same in both representations. Non-Boolean features may require multiple rules for the different values of the feature.

A conditional effect of an action depends on the value of other features. The feature-based representation is able to specify conditional effects, whereas STRIPS cannot represent these directly. Example 6.6 shows how to represent in STRIPS the action moving clockwise, where the effect depends on the previous state, by inventing new actions. Example 6.7 shows how the feature-based representation can represent actions without needing to invent those new actions by adding conditions to the rules. The feature-based representation also allows for non-local effects, as in the following example.

###### Example 6.8.

Suppose that all of the actions make the robot dirty, except for the $wash$ action that makes the robot clean. In STRIPS this would entail having dirty as an effect of every action. In the feature-based representation, we could add a rule that robot is dirty after every action that is not $wash$:

 $robot\_dirty^{\prime}\leftarrow Act{\neq}wash.$