-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsample.html
290 lines (268 loc) · 7.69 KB
/
sample.html
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample</title>
<link rel="stylesheet" type="text/css" href="sample.css" />
<link rel="stylesheet" type="text/css" href="../styles/pddl-gantt.css" />
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script defer src="../out-sample/sample.js"></script>
</head>
<body>
<table width="100%">
<tr>
<th>Domain</th>
<th>Problem</th>
</tr>
<tr>
<td width="50%">
<textarea id="domainText">
(define (domain driverlog)
(:requirements :typing :durative-actions)
(:types location locatable - object
driver truck obj - locatable)
(:predicates
(at ?obj - locatable ?loc - location)
(in ?obj1 - obj ?obj - truck)
(driving ?d - driver ?v - truck)
(link ?x ?y - location) (path ?x ?y - location)
(empty ?v - truck)
)
(:durative-action LOAD-TRUCK
:parameters
(?obj - obj
?truck - truck
?loc - location)
:duration (= ?duration 2)
:condition
(and
(over all (at ?truck ?loc)) (at start (at ?obj ?loc)))
:effect
(and (at start (not (at ?obj ?loc))) (at end (in ?obj ?truck))))
(:durative-action UNLOAD-TRUCK
:parameters
(?obj - obj
?truck - truck
?loc - location)
:duration (= ?duration 2)
:condition
(and
(over all (at ?truck ?loc)) (at start (in ?obj ?truck)))
:effect
(and (at start (not (in ?obj ?truck))) (at end (at ?obj ?loc))))
(:durative-action BOARD-TRUCK
:parameters
(?driver - driver
?truck - truck
?loc - location)
:duration (= ?duration 1)
:condition
(and
(over all (at ?truck ?loc)) (at start (at ?driver ?loc))
(at start (empty ?truck)))
:effect
(and (at start (not (at ?driver ?loc)))
(at end (driving ?driver ?truck)) (at start (not (empty ?truck)))))
(:durative-action DISEMBARK-TRUCK
:parameters
(?driver - driver
?truck - truck
?loc - location)
:duration (= ?duration 1)
:condition
(and (over all (at ?truck ?loc)) (at start (driving ?driver ?truck)))
:effect
(and (at start (not (driving ?driver ?truck)))
(at end (at ?driver ?loc)) (at end (empty ?truck))))
(:durative-action DRIVE-TRUCK
:parameters
(?truck - truck
?loc-from - location
?loc-to - location
?driver - driver)
:duration (= ?duration 10)
:condition
(and (at start (at ?truck ?loc-from))
(over all (driving ?driver ?truck)) (at start (link ?loc-from ?loc-to)))
:effect
(and (at start (not (at ?truck ?loc-from)))
(at end (at ?truck ?loc-to))))
(:durative-action WALK
:parameters
(?driver - driver
?loc-from - location
?loc-to - location)
:duration (= ?duration 20)
:condition
(and (at start (at ?driver ?loc-from))
(at start (path ?loc-from ?loc-to)))
:effect
(and (at start (not (at ?driver ?loc-from)))
(at end (at ?driver ?loc-to))))
)
</textarea>
</td>
<td width="50%">
<textarea id="problemText">
(define (problem DLOG-2-2-3)
(:domain driverlog)
(:objects
driver1 - driver
driver2 - driver
truck1 - truck
truck2 - truck
package1 - obj
package2 - obj
package3 - obj
s0 - location
s1 - location
s2 - location
p0-1 - location
p0-2 - location
p1-0 - location
p2-1 - location
)
(:init
(at driver1 s0)
(at driver2 s0)
(at truck1 s0)
(empty truck1)
(at truck2 s1)
(empty truck2)
(at package1 s2)
(at package2 s1)
(at package3 s1)
(path s0 p0-1)
(path p0-1 s0)
(path s1 p0-1)
(path p0-1 s1)
(path s0 p0-2)
(path p0-2 s0)
(path s2 p0-2)
(path p0-2 s2)
(path s2 p2-1)
(path p2-1 s2)
(path s1 p2-1)
(path p2-1 s1)
(link s0 s2)
(link s2 s0)
(link s1 s0)
(link s0 s1)
(link s1 s2)
(link s2 s1)
)
(:goal (and
(at driver1 s1)
(at driver2 s1)
(at truck1 s2)
(at truck2 s0)
(at package1 s0)
(at package2 s2)
(at package3 s0)
))
(:metric minimize (total-time))
)
</textarea>
</td>
</tr>
<tr>
<th>Plan</th>
<th>Options</th>
</tr>
<tr>
<td>
<textarea id="planText" width="100%">
Metric: 126.010
0.0010: (board-truck driver1 truck1 s0) [1.0000]
0.0010: (load-truck package2 truck2 s1) [2.0000]
0.0010: (load-truck package3 truck2 s1) [2.0000]
0.0010: (walk driver2 s0 p0-1) [20.0000]
1.0020: (drive-truck truck1 s0 s2 driver1) [10.0000]
11.0030: (load-truck package1 truck1 s2) [2.0000]
13.0030: (drive-truck truck1 s2 s0 driver1) [10.0000]
20.0020: (walk driver2 p0-1 s1) [20.0000]
23.0040: (unload-truck package1 truck1 s0) [2.0000]
25.0040: (drive-truck truck1 s0 s2 driver1) [10.0000]
35.0050: (drive-truck truck1 s2 s1 driver1) [10.0000]
40.0030: (board-truck driver2 truck2 s1) [1.0000]
41.0040: (drive-truck truck2 s1 s0 driver2) [10.0000]
45.0060: (drive-truck truck1 s1 s2 driver1) [10.0000]
51.0050: (unload-truck package3 truck2 s0) [2.0000]
53.0050: (drive-truck truck2 s0 s2 driver2) [10.0000]
55.0070: (disembark-truck driver1 truck1 s2) [1.0000]
56.0080: (walk driver1 s2 p2-1) [20.0000]
63.0060: (unload-truck package2 truck2 s2) [2.0000]
65.0060: (drive-truck truck2 s2 s1 driver2) [10.0000]
75.0070: (drive-truck truck2 s1 s0 driver2) [10.0000]
76.0090: (walk driver1 p2-1 s1) [20.0000]
85.0080: (disembark-truck driver2 truck2 s0) [1.0000]
86.0090: (walk driver2 s0 p0-1) [20.0000]
106.0100: (walk driver2 p0-1 s1) [20.0000]
</textarea>
</td>
<td>
<textarea id="configuration">
{
"excludeActions": [
"^load"
],
"ignoreActionParameters": [
{
"action": "^(WALK|DRIVE)",
"parameterPattern": "loc-from"
}
],
"customVisualization": "disregarded-path-in-this-usecase"
}
</textarea>
</td>
</tr>
<tr>
<th>Relaxed plan</th>
<th>Plan visualization</th>
</tr>
<tr>
<td>
<label for="now">Time now:</label>
<input type="number" id="now" min="0.001" value="106.01">
<br>
<textarea id="relaxedPlanText" width="100%">
</textarea>
</td>
<td>
<textarea id="planVisualizationScript">
function visualizePlanHtml(plan, width) {
const height = 100;
return `<svg height="${height}" width="${width}">
<rect width="${width}" height="${height}" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
<circle cx="${height/2}" cy="${height/2}" r="${plan.metric}" stroke="black" stroke-width="3" fill="red" />
</svg> `;
}
module.exports = {
// define one of the following functions:
visualizePlanHtml: visualizePlanHtml,
visualizePlanInDiv: undefined, // function (hostDiv, plan, width)
visualizePlanSvg: undefined // function (plan, width)
};
</textarea>
See other <a target="_blank" href="https://github.com/jan-dolejsi/pddl-gantt/blob/master/src/CustomVisualization.ts">options for plan/state visualization</a>.
</td>
</tr>
</table>
<label for="planViewWidth">Plan width (in px):</label>
<input type="number" id="planViewWidth" name="planViewWidth" min="200" value="400" disabled>
<button id="addPlan">Add plan</button>
<button id="clear">Clear</button>
<table width="100%">
<tr>
<th>Single plan view</th>
<th>Multiple plan view</th>
</tr>
<tr>
<td><div id="plan"></div></td>
<td><div id="plans"></div></td>
</tr>
</table>
</body>
</html>