forked from potassco/pddl-instances
-
Notifications
You must be signed in to change notification settings - Fork 1
/
domain.pddl
129 lines (125 loc) · 2.99 KB
/
domain.pddl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
(define (domain nurikabe)
(:requirements :typing :adl)
(:types
cell num group - object
)
(:constants
n0 - num
)
(:predicates
(NEXT ?n1 - num ?n2 - num)
; Defines the graph structure
(CONNECTED ?c - cell ?c2 - cell)
; The initial position from which the robot must start painting
(SOURCE ?x - cell ?g - group)
; Whether a tile has been painted
(painted ?r - cell)
; A cell does not belong to any group
(available ?x - cell)
; Whether a cell "belongs to" a group. This happens when an adjacent cell belongs to such group
(part-of ?x - cell ?y - group)
; A cell belongs to two different groups so it cannot be painted of any color
(blocked ?x - cell)
; How many tiles remain to be painted for every group
(remaining-cells ?x - group ?y - num)
; Position of the robot
(robot-pos ?x - cell)
; The robot is currently not painting
(moving)
; The robot is currently painting a group
(painting ?g - group)
; The robot has painted a group
(group-painted ?g - group)
)
(:action move
:parameters (?from - cell ?to - cell)
:precondition
(and
(CONNECTED ?from ?to)
(moving)
(not (painted ?to))
(robot-pos ?from)
)
:effect
(and
(robot-pos ?to)
(not (robot-pos ?from))
)
)
(:action start-painting
:parameters (?c - cell ?g - group ?n1 - num ?n2 - num)
:precondition
(and
(NEXT ?n2 ?n1)
(SOURCE ?c ?g)
(moving)
(robot-pos ?c)
(remaining-cells ?g ?n1)
)
:effect
(and
(not (moving))
(painting ?g)
(painted ?c)
(remaining-cells ?g ?n2)
(not (remaining-cells ?g ?n1))
)
)
(:action move-painting
:parameters (?from - cell ?to - cell ?g - group ?n1 - num ?n2 - num)
:precondition
(and
(NEXT ?n2 ?n1)
(CONNECTED ?from ?to)
(not (painted ?to))
(not (blocked ?to))
(painting ?g)
(remaining-cells ?g ?n1)
(robot-pos ?from)
)
:effect
(and
(robot-pos ?to)
(not (robot-pos ?from))
(painted ?to)
(remaining-cells ?g ?n2)
(not (remaining-cells ?g ?n1))
(forall (?cadj - cell)
(when
(and
(CONNECTED ?to ?cadj)
(available ?cadj)
)
(and
(not (available ?cadj))
(part-of ?cadj ?g)
)
)
)
(forall (?cadj - cell)
(when
(and
(CONNECTED ?to ?cadj)
(not (available ?cadj))
(not (part-of ?cadj ?g))
)
(blocked ?cadj)
)
)
)
)
(:action end-painting
:parameters (?g - group)
:precondition
(and
(painting ?g)
(remaining-cells ?g n0)
)
:effect
(and
(not (painting ?g))
(moving)
(group-painted ?g)
)
)
)