e58f174d4d542eebf67f91f8195c74eff448763b
[ker1415-1.git] / sample-blocks-domain.pl
1 % -------------------- Sample of a planning domain --------------------
2
3
4 % the following line specifies which predicates or fluents are defined
5 % across two or more files. These predicates appear here, and in the
6 % initial state and goal definitions, in sample-blocks.pl
7
8 :- multifile on/3, clear/2. % <name>/<number of parameters>
9
10
11
12
13 % -- Primitive control actions: this section defines the name and
14 % the number of parameters of the actions available to the planner
15
16 primitive_action( move(_,_) ). % underscore means `anything'
17
18
19
20
21 % -- Preconditions for primitive actions: describe when an action
22 % can be carried out, in a generic situation S
23
24 poss( move(What, Where), S ) :- % implication poss() <= precond
25 clear(What, S),
26 clear(Where, S),
27 not(heavy(What)), % can't move the table (or other heavy obj)
28 not(What = Where), % can't move a block on top of itself
29 not(on(What, Where, S)). % can't move around the same support
30 % (applies for the table)
31
32
33
34 % -- Successor State Axioms for primitive fluents: describe the value
35 % of fluent based on the previous situation and the action chosen for
36 % the plan.
37
38 % The general form of a successor state axiom is:
39 %
40 % a fluent is true in the situation resulting from applying action A
41 % in situation S, if
42 % - action A makes the fluent true; OR
43 % - the fluent was already true in the previous situation S,
44 % AND action A will not change this fact, by making it false.
45
46
47 on(Block, Support, result(A, S)) :-
48 A = move(Block, Support);
49 on(Block, Support, S), not(A = move(Block, _)).
50
51
52 clear(table, _). % special case, the table is clear any situation
53 % (i.e. there is always space on the table)
54
55 clear(Block, result(A, S)) :-
56 A = move(Something, _), on(Something, Block, S);
57 not(A = move(_, Block)), clear(Block, S).
58
59
60 % ---------------------------------------------------------------------
61 % ---------------------------------------------------------------------