Title: Planning with sensing actions and incomplete information using Logic Programming
1Planning with sensing actions and incomplete
information using Logic Programming
2Introduction
- Classical Planning Agents are assumed to have
complete information about the world ?
unrealistic - This leads to planning with sensing actions and
incomplete information.
3Medication Example
- Problem
- A patient is infected. He can take medicine and
get cured if he were hydrated otherwise, the
patient will be dead. To become hydrated, the
patient can drink. The check action allows us to
determine if the patient is hydrated or not. - Goal not infected and not dead.
- Classical planners cannot solve such kind of
problems because - it contains incomplete information we dont know
whether he is initially hydrated or not. - it has a sensing action in order to determine
whether he is hydrated, the check action is
required.
4Planning with sensing actions and incomplete
information
- How to reason about the knowledge of agents?
- Lead to the development of several approaches to
reasoning about the effects of sensing actions - What is a plan?
- Conditional plans contain sensing actions and
conditionals such as if-then-else structure - Conformant plans a sequence of actions which
leads to the goal regardless of the value of the
unknown fluents in the initial state - Two approaches
- Conditional Planning
- Conformant Planning
5Previous works
- Conditional Planning
- Most of the early conditional planners use a
partial-order planning algorithm - Situation Calculus or STRIPS are used as the main
vehicle - Examples CoPlaS and FLUX
- Conformant Planning
- Deals with incomplete information
- A solution is a sequence of actions that achieves
the goal from every possible initial state - Example Graphplan
6Approach
- Approach Using Logic Programming
- Use the language Ak to represent and reason with
sensing actions. - Translate Ak programs into logic programs.
- Use smodels to generate the answer set for these
logic programs. - Reason
- Development of fast and efficient answer set
planners such as smodels and dlv. - Objectives
- Can generate both conformant plans and
conditional plans
7The language Ak
- Four types of propositions
- K-proposition
- determines(a, g) (1)
- Ef-proposition
- causes(a, f, p1,p2,,pn) (2)
- Ex-proposition
- executable(a, p1,p2,,pn) (3)
- V-proposition
- initially f (4)
- Actions in form (1) are called sensing action
- Actions in form (2) are called non-sensing actions
Domain Description
Initial State
8The language Ak (cont)
- initially(inf).
- initially(?dead).
- causes(med,?inf, inf,hyd).
- causes(med,dead, ?hyd).
- causes(dr,hyd,).
- determines(chk,hyd).
- executable(med, ).
- executable(dr, ).
- executable(chk, ).
Initial State
- A patient is infected (inf).
- He can take the medicine (med) and get cured if
he were hydrated (hyd) - otherwise, the patient will be dead (dead).
- To become hydrated, the patient can drink(dr).
- The check action (chk) is to determine whether
the patient is hydrated or not. - Every action can be taken at any time
Domain Description
9The language Ak (cont)
- An Action Theory is a pair (D,I), where
- D domain description, i.e., set of propositions
of the forms (1) (3) - I initial state, consisting of propositions of
the form (4) - Conditional Plan
- A sequence of non-sensing actions a1ak (k gt0
) is a conditional plan - If a1ak-1 is a non-sensing action sequence, ak
is a sensing action that determines f, and c1 and
c2 are conditional plans, then a1a2ak-1akif(
f,c1,c2) is a conditional plan - Nothing else is a conditional plan
10Definition of a conditional plan
- Conditional Plan
- A sequence of non-sensing actions a1ak (k gt0
) is a conditional plan - If a1ak-1 is a non-sensing action sequence, ak
is a sensing action that determines f, and c1 and
c2 are conditional plans, then
a1a2ak-1akif(f,c1,c2) is a conditional plan - Nothing else is a conditional plan
11Semantics of Ak
- An a-state ? ltT, Fgt
- A fluent f is
- True in ? if f ? T
- False in ? if f ? F
- Known if f ? T U F
- Unknown if f ? T U F
- Executing an action a in an a-state will cause
- Some fluents to become true, denoted by ea(?)
- Some fluents to become false ea-(?)
- Some fluents may become true Fa(?)
- Some fluents may become false Fa-(?)
12Result function and transition function
- Result Function is to represent the effects of a
nonsensing action - Res Action x State ? State
- Res(a, ltT,Fgt) ltT U ea \ Fa-, F U ea- \ Fagt
- Transition Function is to compute states that the
agent might be in after executing an action - ? Action X State ? 2State U ?
- Given D, the 0-transition function ? of D is
defined as - If a is not executable in ? then ?(a, ?) ?
- Else
- If a is executable and a is a non-sensing action
then ?(a, ?) Res(a, ?) - Else if a is a sensing action that occurs in the
k-proposition of the form determines(a,f) then - ?(a, ?) ltT U f, Fgt, ltT, FUfgt if f ?T U F
- ?(a, ?) ? otherwise
13Transition Function (cont)
Initial State ?0 ltinf, deadgt edr(?0)
hyd edr-(?0) ? Fdr(?0) hyd Fdr-(?0)
? emed(?0) ? emed-(?0) ? Fmed(?0)
dead Fmed-(?0) inf
- MEDICATION EXAMPLE
- initially(inf).
- initially(?dead).
- causes(dr,hyd,).
- causes(med,?inf, inf,hyd).
- causes(med,dead,?hyd).
- determines(chk,hyd).
RESULT FUNCTIONS Res(a,ltT,Fgt) ltT U ea \ Fa-,
F U ea- \ Fagt Res(dr, ?0) ltinf, hyd,
deadgt Res(med, ?0) lt ?, ?gt Res(chk,
?0) ltinf, deadgt
14Transition function (cont)
RESULT FUNCTIONS Res(a,ltT,Fgt) ltT U ea \ Fa-,
F U ea- \ Fagt Res(dr, ?0) ltinf, hyd,
deadgt Res(med, ?0) lt ?, ?gt Res(chk,
?0) ltinf, deadgt
TRANSITION FUNCTIONS ?(dr, ?0) ltinf,hyd,
deadgt ?(med, ?0) lt?, ?gt ?(chk, ?0)
ltinf, hyd, deadgt, ltinf, dead,
hydgt
15Transition function (cont.)
lt?,?gt
TRANSITION FUNCTION ?(med, ?0) lt?,
?gt ?(dr, ?0) ltinf,hyd, deadgt ?(chk
, ?0) ltinf, hyd, deadgt,
ltinf, dead, hydgt
med
dr
ltinf,hyd,deadgt
Initial State ltinf, deadgt
ch
ltinf, dead,hydgt
ch
So, the transition function computes states that
the agent might be in after executing some action
16Extended transition function
- The transition function is for a single action
only - The extended transition function aims to compute
all possible states that the agent might be in
after executing a sequence of actions (plan) - The extended transition function must be able to
compute results for both conditional plans and
conformant plans
17Extended transition function (cont)
- Definition
- a
- For every action a
- For a sequence of actions a1,,ak, k gt 0
- For a conditional plan c a1akif(f,c1,c2)
-
- where,
- For every conditional plan,
18A logic programming based conditional planner
- Planning problem
- P (D,I,G), where ltD, Igt is an action theory, G
is a conjunction of fluent literals - Approach
- Translate an Ak program into a logic program ?(P)
- Use smodels to compute the stable models for
?(P). These models represent solutions to P
19Graphical representation of a plan - Plan trees
- For a plan c
- If c , the plan tree Tc has only one node
labeled with nil - If c a1a2ak, Tc has k nodes with the labels
a1, a2, , ak respectively where ai is the child
of ai-1 and a1 is the root. - If c a1a2akif(f, c1, c2), where ak is the
sensing action that determines f, Tc is a binary
tree whose root has the label a1, ai has a child
with label ai1 for i0k-1 and ak has two
children which are the roots of two sub-trees Tc1
and Tc2. Two branches of ak are labeled with f
and ?f correspondingly
20Plan tree examples
nil
a
a
a
a
f
?f
b1
b
b
b2
g
?g
?h
h
f
?f
c
d
d2
d1
c2
c1
a ab
abif(f,c,d) aif(f,b1if(g,c1,c2)
b2if(h,d1,d2))
21Plan trees (cont)
- For a conditional plan c, let m and w be the
height and the width of Tc. Each node k of Tc is
assigned to a pair (t,p), denoted by n(k), where
t is the level of k, 1 ? p ? w, and - For every pair of leaves k1 ? k2 if n(k1)
(t1,p1) and n(k2) (t2,p2) then p1 ? p2 - If k1,,ks are the children of k with n(kj)
(t,pj) then n(k) (t-1, min p1,,ps)
22Plan trees (cont)
(1,1)
(1,1)
(1,1)
(1,1)
(1,1)
a
a
a
a
f
?f
(2,1)
(2,3)
(2,1)
b1
b
b
b2
(2,1)
g
?g
?f
f
c
d
c2
c1
(3,1)
(3,3)
(3,1)
(3,2)
a ab
abif(f,c,d)
aif(f,b1if(g,c1,c2) b2)
23Plan trees (cont)Example
(1,1)
Path
chk
chk
(1,1)
hyd
?hyd
?hyd
hyd
med
dr
med
dr
(2,2)
(2,1)
(2,1)
(2,2)
med
med
Time
(3,2)
(3,2)
24Why plan trees?
Path
(1,1)
- Think of each node as a state that the agent
might be in during the plan execution. - The root is the initial state.
- Every leaf can be the final state.
- The goal is satisfied if it holds in every final
states, i.e., leaves of the tree
(2,1)
(2,2)
Time
(3,2)
25Translating a planning problem into a logic
program
- Given a planning problem P ltD,I,Ggt, its
corresponding logic program consists of - Dependent Rules that describe the initial state
I, the set of propositions D and the goal G - Domain Independent Rules that describe the
transition functions ? and auxiliary rules such
as those generating action occurrences,
26Domain Dependent Rules
- Set Representation
- Use set and in predicates to describe sets and
the member relationship - To describe a set s m1,,mn, we use n1
predicates - set(s). that s is a set
- in(m1, s). m1..mn are members of s
-
- in(mn, s).
27Domain Dependent Rules (cont)
- Action Theory Representation
- A negative fluent f is represented as neg(f).
- A set of literals l1,,ln is represented as
- set(s). state that s is a set
- in(l1, s). l1..ln are elements of s
- in(l2, s).
-
- in(ln, s).
- Example causes(med, dead, ?hyd) will be
represented in the logic program as - causes(med, dead, set1).
- set(set1).
- in(neg(hyd), set1).
- Initial State representation
- Intially(f) ? initially(f).
- Initially(?f) ? initially(neg(f)).
- Goal representation
- For each fluent f in G, the encoding of G is
represented as the set of facts finally(f).
28Domain Dependent Rules (cont) - Medication Example
- initially(inf).
- initially(?dead).
- causes(dr,hyd,).
- causes(med,?inf, inf,hyd).
- causes(med,dead, ?hyd).
- determines(chk,hyd).
initially(infected). initially(neg(dead)). causes
(drink, hydrated, nil). causes(medicate,
neg(infected), set1). set(set1). in(infected,
set1). in(hydrated, set1). causes(medicate,
dead, set2). set(set2). in(neg(hydrated),
set2). determines(check, hydrated). executable(m
edicate, nil). executable(drink,
nil). executable(check,nil).
29Domain Independent Rules
- Main predicates
- h(L,T,P) L holds at (T,P)
- possible(A,T,P) action A is executable at (T,P)
- occ(A,T,P) action A occurs at (T,P)
- nocc(A,T,P) action A doesnt occur at (T,P)
- hs(S,T,P) Set of literals S hold at (T,P)
- ph(L,T,P) L possibly holds at (T,P)
- phs(S,T,P) Set of literals S hold at (T,P)
- used(T,P) starting from T, there is a node lying
on the path P - br(F,T,P,P1) node (T,P) has two children (T1,P)
and (T1,P1), where F holds at (T1,P) and ?F
holds at (T1,P1)
30Domain Independent Rules (cont)Main Rules
- Rules for encoding the initial situation
- h(F,1,1) ? literal(F), initially(F).
- used(1,1) ?.
- Rules for reasoning about the effect of
non-sensing actions - h(F,T1,P) ? occ(A,T,P), causes(A,F,S),
hs(S,T,P). - ab(G,T,P) ? causes(A,?G,S), occ(A,T,P),
phs(S,T,P). - h(F,T1,P) ? h(F,T,P), not ab(G,T,P).
31Domain Independent RulesMain rules
- Rules for reasoning about the effect of sensing
actions - Only two branches are allowed at a node
associated with a sensing action - new_br(P,P1) ? P ? P1.
- 1br(F,T,P,P1)new_br(P,P1) 1 ? occ(A,T,P),
determines(A,F). - ? fluent(F), P ? P1, br(F,T,P,P1), used(T,P1).
- Executing a sensing action will generate two
new possible states - 3h(F,T1,P),h(?F,T1,P1),used(T1,P1)3 ? P ?
P1, fluent(F), br(F,T,P,P1) - Sensing actions do not change the world
- h(G,T1,P1) ? P ? P1, br(F,T,P,P1), h(G,T,P).
- h(G,T1,P) ? P ? P1, br(F,T,P,P1), h(G,T,P).
32Domain Independent Rules (cont)
- Rules for reasoning about what is known/unknown
- unknown(F,T,P) ? fluent(F), not known(F,T,P).
- known(F,T,P) ? fluent(F), h(F,T,P).
- known(F,T,P) ? fluent(F), h(?F,T,P).
- Rules for generating action occurences
- possible(A,T,P) ? used(T,P), hs(S,T,P),
executable(A,S). - occ(A,T,P) ? used(T,P), not sgoal(T,P),
possible(A,T,P), not nocc(A,T,P). - nocc(B,T,P) ? used(T,P), not sgoal(T,P), A ? B,
not occ(A,T,P). - ? A ? B, occ(A,T,P), occ(B,T,P).
- a sensing action a of the form determines(a,f)
is not necessary if f is known - ? determines(A,F), occur(A,T,P), known(F,T,P).
- Rules for guaranteeing that the goal must be
achieved for every path of the plan tree - sgoal(T,P) ? not not_sgoal(T,P).
- not_sgoal(T,P) ? finally(F), not holds(F,T,P).
- ? used(length, P), not sgoal(length, P).
33Experiment Result
Path
chk
- Running the medication example with path 2 and
length 4 on smodels yields the following output - occ(chk, 1, 1),
- occ(med, 2, 1),
- occ(dr, 2, 2),
- occ(med, 3, 2) and
- the branching literal
- br(hyd, 1, 1, 2)
(1,1)
?hyd
hyd
med
dr
(2,1)
(2,2)
med
Time
(3,2)
34Summary
- Why planning with sensing actions is necessary?
- What is a conditional plan?
- Language Ak and semantics of Ak
- A logic programming based approach to solving the
planning problem with sensing actions and
incomplete information - An experiment
35Future Work
- Comparison with other planners
- Adding static causal laws to Ak