In order to obtain more precise
estimates, Grt heuristic tries to
track the interactions that arise when estimating the distances between each
fact and the goals. By the word 'interaction' we mean that achieving a fact may
affect achieving other facts positively or negatively. In order to track these
interactions the notion of the related facts is introduced.
Definition 1 (Related facts). A fact q is related to
another fact p, if achieving p causes fact q to be
achieved as well.
We will use the
notation to denote that q
is related to p. The set of all facts related to a specific fact p
is denoted as rel(p), i.e.:
(8)
The set of related
facts of a set of facts P is defined as the union of the related facts
of P-facts:
(9)
Proposition 1. For an inverted action a
achieving a fact p, the related facts of p are defined as:
rel(p) = Pre(a) È rel(Pre(a)) È Add(a) \ Del(a) (10)
Proof: Formula 10 is inductive, since it defines the
related facts of a fact p based on the related facts of the
preconditions of the action achieving the fact. Thus, we prove it by induction.
The formula holds for the goal facts, for which we suppose that there is a
hypothetical inverted action without preconditions achieving them. So, the goal
facts are related to each other. Then, suppose that Formula 10 holds for the
preconditions of an inverted action a. It is enough to prove that it
holds also for the facts that action a adds. Let p be such a
fact. The facts that hold after the application of the action, which are the
related facts of p, are the same that hold before its application, i.e.
the preconditions of the action together with their related facts, plus the
facts that the action achieves, minus the facts that the action deletes,
exactly as Formula 10 states. n
According to Formula
10, facts achieved by the same action have the same related facts. Moreover,
each fact is at least related to itself.
If there was a single
path to achieve a specific fact, then its related facts would be defined in a
unique way. However, this is a rare situation. Thus, there are many actions
that achieve a fact, many paths that achieve the preconditions of these
actions; therefore, there is an extremely large number of possible
combinations. Storing, for each fact, the related facts for all the possible
ways of achieving it, requires huge amounts of time and space. For efficiency
reasons we decided to store only one set of related facts for each fact, the
set that corresponds to the shortest path that achieves the fact, according to
the heuristic.
Proposition 2. The relation is reflexive, but it
is neither symmetric, nor transitive.
Proof: The relation is reflexive, since
each fact is related to itself. The relation
is not symmetric,
since for a fact q, which is pre-requisite to achieve p, q
p may hold (if the action achieving p does not
delete q) while p
q may not hold, since q may have been achieved
before p. Finally, the relation
is not transitive,
since from the relations q
p and p
r we cannot conclude that q
r holds, since it is possible for the action achieving r
to delete q. n
For a fact p, dist(p)
denotes its estimated distance from the goals. Next, we present some axioms
concerning the distances of the facts.
Axiom 1. The cost of achieving a set of facts {p1,
p2, ..., pN} simultaneously, cannot be
lower than the maximum of their individual distances.
dist({p1, p2,
..., pN})³ (dist(pi)) (11)
Axiom 2. If an inverted action a achieves a fact
p, the distance of p is equal to the cost of simultaneously achieving
a's preconditions plus one.
dist(p)=dist({p1,p2,
...})+1, where pi Î Pre(a) (12)
Proposition 3. If qp is true for two facts q and p, then dist(q)≤dist(p).
Proof: We will prove Proposition 3 by induction. Proposition
3 holds for the Goals, since all the goal facts have zero distances and
are related to each other. Suppose now that Proposition 3 holds for the set of
the currently achieved facts Facts. It suffices to prove that for an
action a, such that Pre(a)ÍFacts, Proposition 3 holds for the set FactsÈAdd(a).
Suppose that there is
a fact pÎAdd(a) that has just been achieved, or
re-achieved with smaller cost. If there is another fact q Î FactsÈAdd(a), such that qp, then either q has also just been achieved by a
and hence dist(q)=dist(p), or q is a
precondition of a and then, according to Axiom2, dist(q)<dist(p),
or finally q is a related fact of an a's precondition, say q'
and then dist(q')<dist(p) (Axiom 2) and dist(q)£dist(q') (Proposition 3 holds for Facts),
so dist(q)<dist(p).
Let us suppose now
that there is another fact q, such that pq. If q has been achieved by a, then dist(p)=dist(q).
If q has not been achieved by a, then q has previously
been achieved by another action, so q Î Facts. In this case, p
would also have been previously achieved by another action, before being
re-achieved by a, so also p Î Facts. Since Proposition 3
holds for Facts, distOLD(p)£dist(q), where distOLD(p)
the previous distance of p. But the new distance of p is smaller
than its previous distance, dist(p)<distOLD(p),
so dist(p)<dist(q). Therefore, Proposition 3
holds in every case. n
Corollary 1. If qp and p
q, then dist(p)=dist(q).
Corollary 2. If qp but not p
q, then q has been achieved before p.
The above two
corollaries follow directly from Proposition 3. Concerning Corollary 2, the
expression 'has been achieved before' means that in the pre-processing phase,
when the distances from the goals are estimated progressively, dist(q)
has been computed before dist(p). In case where a fact has been
re-achieved with smaller distance, we consider the last time.
Corollary 3. For a sequence of facts p1,
p2, ..., pN, N>2, for which pipi+1, i=1,2,...,N-1, hold, without pi+1
pi also holding, it is impossible to have pN
p1.
Corollary 3 follows directly
from Corollary's 2 time ordering relation.
Proposition 4. Facts related to each other have
been achieved by the same action.
Proof: Let p and q be two facts related
to each other, i.e. qp and p
q. Let a1 be the action that achieves p
and a2 the action that achieves q, so pÎAdd(a1) and qÎAdd(a2). We will prove that a1ºa2. Suppose that a1¹a2. Since q
p, q may be an add effect of a1,
a precondition of a1, or a related fact of an a1's
precondition. However, according to Corollary 1, dist(p)=dist(q).
Thus, q cannot be anything else than an add effect of a1,
because in other case dist(q) < dist(p) would hold. In
the same way we can prove that pÎAdd(a2). Thus, {p,q}ÍAdd(a1)ÇAdd(a2). However, in this case,
the first action applied when computing the distances would achieve both facts.
So, the facts have been achieved by the same action. n
The related facts play
a critical role when estimating the cost of achieving a set of facts
simultaneously. Grt groups the
related facts and sums the maximum individual cost of each group. For example,
if qp, p
r and q
r hold for three facts q, p and r, these
three facts are grouped together and contribute to the total cost only with
their maximum cost, which is dist(r). However, if q
r does not hold (since the relation
is not transitive),
then p and r are grouped together, while q is not included
in the same group. In this case, q belongs to another group, which
contributes separately to the total cost.
The aggregation
process is performed by the function Aggregate,
which is described below. The function takes a set of facts {p1, p2, ...., pN} as
input, together with their distances dist(pi) and their lists of related facts rel(pi), and estimates the cost of
achieving them simultaneously. The function is used both in the pre-processing phase,
in order to estimate the application cost of the inverted actions, and in the
search phase, in order to estimate the distance of each intermediate state from
the goals.
Function Aggregate
Input: A set of facts {p1, p2, ..., pN
}, their distances dist(pi) and their lists of related facts rel(pi).
Output: An estimate of the cost of achieving the
facts simultaneously.
1. Set M1 = {p1, p2, ...,
pN }. Set Cost = 0.
2. While (M1 ¹ Æ) do:
a) Let M2 be the set of facts pi Î M1 that are not included in any list of related facts of
another fact pj Î M1, without pj being also included in their
list of related facts. More formally:
M2 = { pi: pi Î M1, " pj Î M1, pi Î rel(pj) Þ pj Î rel(pi) }
b) Let M3 be the set of those facts of M1 that
are not included in M2, but are included in at least
one of the lists of related facts of the elements of M2.
M3 = { pi: pi Î M1 \ M2, $ pj Î M2, pi Î rel(pj) }
c) Divide M2
in disjoint groups of facts that are related to each other. For each group add
the common cost of its facts to Cost.
d) Set M1 = M1 \ (M2ÈM3).
3.
Return Cost
The Aggregate function is illustrated with
the blocks-world problem of Figure 1. Part of the Greedy Regression
Table for this problem is shown in Table 1. For simplicity, for each fact p
we do not consider as related the facts that have zero distances (i.e. the Goals)
and the fact p itself. This simplification does not affect the estimated
distances.
Figure 1:
A 3-blocks problem.
Let us compute the
distance between the initial and the goal state. The initial state consists of
the following set of facts:
( (on a
table) (clear a) (on b table) (on c b) (clear c)
)[1]
As it results from
Table 1, all the initial state facts are related to (on c b), whereas (on
c b) is not related to any other fact. Thus, in the first iteration of the Aggregation loop, M2
is set to ((on c b)) (step 2a) and M3 is set to ((on
a table) (clear a) (on b table) (clear c)) (step 2b).
So, Cost becomes equal to the distance of (on c b), i.e. 3 (step
2c) and M1 becomes empty. A second iteration is not performed
and value 3, which is the actual distance between the initial and the goal
state, is returned.
Fact |
Distance from |
Related facts |
|
|
|
(on c table) |
0 |
( ) |
(on b c) |
0 |
( ) |
(on a b) |
0 |
( ) |
(clear a) |
0 |
( ) |
(on a table) |
1 |
( (clear b) ) |
(clear B) |
1 |
( (on a table) ) |
(on b table) |
2 |
( (on a table) (clear a) (clear b) (clear c)
) |
(clear c) |
2 |
( (on a table) (clear a) (clear b) (on
b table) ) |
(on c b) |
3 |
( (on a table) (clear a) (on b table)
(clear c) ) |
... |
... |
... |
Table 1: Part of the Greedy
Regression Table for the 3-blocks problem.
Corollary 3 ensures
that set M2 (step 2a of function Aggregate) will never be empty. Proposition 4 ensures that M2
can always be partitioned in groups of facts that have been achieved by the
same action (step 2c). The number of iterations that function Aggregate performs is bounded by the
initial size of M1, however usually a single
iteration is performed.
Ioannis
Refanidis
14-8-2001
[1] For the representation of facts, actions and states we adopt the PDDL (Planning Domain Definition Language) syntax throughout this paper. A manual for the PDDL language can be found at the URL http://www.cs.yale.edu/pub/mcdermott/software/pddl.tar.gz