longjing 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.ruby-version +1 -0
- data/.travis.yml +27 -0
- data/Gemfile +4 -0
- data/README.md +35 -0
- data/Rakefile +64 -0
- data/TODO +27 -0
- data/benchmark.log +10 -0
- data/bin/console +14 -0
- data/bin/longjing +37 -0
- data/bin/setup +7 -0
- data/lib/longjing.rb +54 -0
- data/lib/longjing/ff/action.rb +39 -0
- data/lib/longjing/ff/connectivity_graph.rb +35 -0
- data/lib/longjing/ff/ordering.rb +125 -0
- data/lib/longjing/ff/preprocess.rb +43 -0
- data/lib/longjing/ff/relaxed_graph_plan.rb +140 -0
- data/lib/longjing/logging.rb +65 -0
- data/lib/longjing/parameters.rb +32 -0
- data/lib/longjing/pddl.rb +24 -0
- data/lib/longjing/pddl/action.rb +32 -0
- data/lib/longjing/pddl/literal.rb +220 -0
- data/lib/longjing/pddl/obj.rb +26 -0
- data/lib/longjing/pddl/parser.tab.rb +842 -0
- data/lib/longjing/pddl/parser.y +326 -0
- data/lib/longjing/pddl/predicate.rb +20 -0
- data/lib/longjing/pddl/type.rb +24 -0
- data/lib/longjing/pddl/var.rb +20 -0
- data/lib/longjing/problem.rb +29 -0
- data/lib/longjing/search.rb +4 -0
- data/lib/longjing/search/base.rb +59 -0
- data/lib/longjing/search/ff.rb +138 -0
- data/lib/longjing/search/ff_greedy.rb +28 -0
- data/lib/longjing/search/greedy.rb +43 -0
- data/lib/longjing/search/statistics.rb +10 -0
- data/lib/longjing/state.rb +27 -0
- data/lib/longjing/version.rb +3 -0
- data/longjing.gemspec +24 -0
- metadata +123 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
module Longjing
|
2
|
+
module PDDL
|
3
|
+
class Obj
|
4
|
+
attr_reader :name, :type, :hash
|
5
|
+
def initialize(name, type=nil)
|
6
|
+
@name = name
|
7
|
+
@type = type || Type::OBJECT
|
8
|
+
@hash = name.hash
|
9
|
+
end
|
10
|
+
|
11
|
+
def is_a?(type)
|
12
|
+
t = @type
|
13
|
+
t = t.parent until t == type || t.nil?
|
14
|
+
!t.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
"#{@name} - #{@type}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def inspect
|
22
|
+
"(object #{to_s})"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,842 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.12
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
require 'strscan'
|
10
|
+
require 'longjing/pddl/type'
|
11
|
+
require 'longjing/pddl/var'
|
12
|
+
require 'longjing/pddl/obj'
|
13
|
+
require 'longjing/pddl/predicate'
|
14
|
+
require 'longjing/pddl/literal'
|
15
|
+
require 'longjing/pddl/action'
|
16
|
+
module Longjing
|
17
|
+
module PDDL
|
18
|
+
class Parser < Racc::Parser
|
19
|
+
|
20
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 210)
|
21
|
+
SUPPORTED_REQUIREMENTS = [:strips, :typing,
|
22
|
+
:'negative-preconditions',
|
23
|
+
:equality]
|
24
|
+
|
25
|
+
def domain(name)
|
26
|
+
@predicates, @types = {}, {}
|
27
|
+
@domains[name] = { domain: name }
|
28
|
+
end
|
29
|
+
|
30
|
+
def problem(name, domain_name)
|
31
|
+
domain = @domains[domain_name]
|
32
|
+
raise UnknownDomain unless domain
|
33
|
+
@predicates = Hash[domain[:predicates].map{|pred| [pred.name, pred]}]
|
34
|
+
@types = if domain[:types]
|
35
|
+
Hash[domain[:types].map{|t| [t.name, t]}]
|
36
|
+
end
|
37
|
+
@objects = {}
|
38
|
+
{ problem: name }.merge(domain)
|
39
|
+
end
|
40
|
+
|
41
|
+
def requirements(reqs)
|
42
|
+
unsupported = reqs - SUPPORTED_REQUIREMENTS
|
43
|
+
raise UnsupportedRequirements, unsupported unless unsupported.empty?
|
44
|
+
reqs
|
45
|
+
end
|
46
|
+
|
47
|
+
def predicate(name, vars=nil)
|
48
|
+
raise "Duplicated predicate name #{name}" if @predicates.has_key?(name)
|
49
|
+
@predicates[name] = Predicate.new(name, vars)
|
50
|
+
end
|
51
|
+
|
52
|
+
def type(name, parent=nil)
|
53
|
+
@types[name] ||= Type.new(name, parent)
|
54
|
+
end
|
55
|
+
|
56
|
+
def object(name, type=nil)
|
57
|
+
@objects[name] ||= Obj.new(name, type)
|
58
|
+
end
|
59
|
+
|
60
|
+
def parameters(params)
|
61
|
+
@params = Hash[params.map{|param| [param.name, param]}]
|
62
|
+
params
|
63
|
+
end
|
64
|
+
|
65
|
+
def parse(str, domains)
|
66
|
+
@domains = domains
|
67
|
+
@tokens = []
|
68
|
+
str = "" if str.nil?
|
69
|
+
scanner = StringScanner.new(str + ' ')
|
70
|
+
|
71
|
+
until scanner.eos?
|
72
|
+
case
|
73
|
+
when scanner.scan(/\s+/)
|
74
|
+
# ignore space
|
75
|
+
when scanner.scan(/;.*$/)
|
76
|
+
# ignore comments
|
77
|
+
when m = scanner.scan(/[\(]/)
|
78
|
+
@tokens.push [:OPEN_BRACE, m]
|
79
|
+
when m = scanner.scan(/[\)]/)
|
80
|
+
@tokens.push [:CLOSE_BRACE, m]
|
81
|
+
when m = scanner.scan(/-\s/)
|
82
|
+
@tokens.push [:DASH, m.strip.to_sym]
|
83
|
+
when m = scanner.scan(/=\s/)
|
84
|
+
@tokens.push [:EQUAL, m.strip.to_sym]
|
85
|
+
when m = scanner.scan(/define\b/i)
|
86
|
+
@tokens.push [:DEFINE, m.to_sym]
|
87
|
+
when m = scanner.scan(/\:?domain\b/i)
|
88
|
+
@tokens.push [:DOMAIN, m.to_sym]
|
89
|
+
when m = scanner.scan(/problem\b/i)
|
90
|
+
@tokens.push [:PROBLEM, m.to_sym]
|
91
|
+
when m = scanner.scan(/\:requirements\b/i)
|
92
|
+
@tokens.push [:REQUIREMENTS, m]
|
93
|
+
when m = scanner.scan(/\:types\b/i)
|
94
|
+
@tokens.push [:TYPES, m]
|
95
|
+
when m = scanner.scan(/\:predicates\b/i)
|
96
|
+
@tokens.push [:PREDICATES, m]
|
97
|
+
when m = scanner.scan(/\:action\b/i)
|
98
|
+
@tokens.push [:ACTION, m]
|
99
|
+
when m = scanner.scan(/\:parameters\b/i)
|
100
|
+
@tokens.push [:PARAMETERS, m]
|
101
|
+
when m = scanner.scan(/\:precondition\b/i)
|
102
|
+
@tokens.push [:PRECONDITION, m]
|
103
|
+
when m = scanner.scan(/\:effect\b/i)
|
104
|
+
@tokens.push [:EFFECT, m]
|
105
|
+
when m = scanner.scan(/\:objects\b/i)
|
106
|
+
@tokens.push [:OBJECTS, m]
|
107
|
+
when m = scanner.scan(/\:goal\b/i)
|
108
|
+
@tokens.push [:GOAL, m]
|
109
|
+
when m = scanner.scan(/\:init\b/i)
|
110
|
+
@tokens.push [:INIT, m]
|
111
|
+
when m = scanner.scan(/not\b/i)
|
112
|
+
@tokens.push [:NOT, m.to_sym]
|
113
|
+
when m = scanner.scan(/and\b/i)
|
114
|
+
@tokens.push [:AND, m.to_sym]
|
115
|
+
when m = scanner.scan(/\:[\w\-]+\b/i)
|
116
|
+
@tokens.push [:SYMBOL, m[1..-1].to_sym]
|
117
|
+
when m = scanner.scan(/\?[a-z][\w\-]*\b/i)
|
118
|
+
@tokens.push [:VAR, m.to_sym]
|
119
|
+
when m = scanner.scan(/[a-z][\w\-]*\b/i)
|
120
|
+
@tokens.push [:ID, m.to_sym]
|
121
|
+
else
|
122
|
+
raise "unexpected characters: #{scanner.peek(5).inspect}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
@tokens.push [false, false]
|
126
|
+
do_parse
|
127
|
+
end
|
128
|
+
|
129
|
+
def next_token
|
130
|
+
@tokens.shift
|
131
|
+
end
|
132
|
+
|
133
|
+
def on_error(t, val, vstack)
|
134
|
+
trace = vstack.each_with_index.map{|l, i| "#{' ' * i}#{l}"}
|
135
|
+
raise ParseError,
|
136
|
+
"\nparse error on value #{val.inspect}\n#{trace.join("\n")}"
|
137
|
+
end
|
138
|
+
...end parser.y/module_eval...
|
139
|
+
##### State transition tables begin ###
|
140
|
+
|
141
|
+
racc_action_table = [
|
142
|
+
37, 38, 37, 38, 16, 33, 140, 34, 117, 39,
|
143
|
+
106, 39, 17, 40, 41, 40, 41, 37, 38, 113,
|
144
|
+
36, 106, 36, 106, 48, 103, 39, 37, 38, 106,
|
145
|
+
40, 41, 26, 27, 28, 50, 39, 36, 27, 28,
|
146
|
+
40, 41, 37, 38, 46, 37, 38, 36, 69, 66,
|
147
|
+
57, 39, 32, 34, 39, 96, 41, 95, 40, 41,
|
148
|
+
37, 38, 36, 59, 60, 36, 28, 25, 70, 39,
|
149
|
+
37, 38, 71, 96, 93, 95, 25, 140, 73, 39,
|
150
|
+
36, 74, 25, 40, 41, 37, 38, 76, 50, 78,
|
151
|
+
36, 22, 81, 32, 39, 37, 38, 83, 40, 41,
|
152
|
+
57, 30, 62, 86, 39, 36, 69, 88, 96, 93,
|
153
|
+
95, 37, 38, 37, 38, 36, 25, 81, 91, 69,
|
154
|
+
39, 22, 39, 97, 40, 41, 40, 41, 37, 38,
|
155
|
+
98, 36, 100, 36, 20, 2, 107, 39, 37, 38,
|
156
|
+
110, 40, 41, 15, 12, 110, 25, 39, 36, 119,
|
157
|
+
120, 40, 41, 37, 38, 37, 38, 122, 36, 106,
|
158
|
+
81, 106, 39, 126, 39, 110, 40, 41, 40, 41,
|
159
|
+
8, 128, 129, 36, 130, 36, 131, 132, 5, 135,
|
160
|
+
138, 4, 141, 142, 138, 3, 145 ]
|
161
|
+
|
162
|
+
racc_action_check = [
|
163
|
+
95, 95, 94, 94, 8, 15, 120, 15, 97, 95,
|
164
|
+
120, 94, 8, 95, 95, 94, 94, 81, 81, 94,
|
165
|
+
95, 95, 94, 94, 25, 85, 81, 117, 117, 85,
|
166
|
+
81, 81, 12, 12, 12, 26, 117, 81, 20, 20,
|
167
|
+
117, 117, 110, 110, 23, 27, 27, 117, 34, 34,
|
168
|
+
28, 110, 29, 30, 27, 110, 110, 110, 27, 27,
|
169
|
+
138, 138, 110, 31, 32, 27, 22, 21, 35, 138,
|
170
|
+
48, 48, 42, 138, 138, 138, 43, 138, 44, 48,
|
171
|
+
138, 45, 19, 48, 48, 33, 33, 49, 50, 51,
|
172
|
+
48, 18, 53, 14, 33, 69, 69, 55, 33, 33,
|
173
|
+
56, 13, 33, 58, 69, 33, 60, 61, 69, 69,
|
174
|
+
69, 63, 63, 17, 17, 69, 11, 64, 65, 67,
|
175
|
+
63, 10, 17, 71, 63, 63, 17, 17, 57, 57,
|
176
|
+
72, 63, 75, 17, 9, 0, 87, 57, 54, 54,
|
177
|
+
93, 57, 57, 7, 6, 96, 24, 54, 57, 99,
|
178
|
+
100, 54, 54, 52, 52, 16, 16, 102, 54, 104,
|
179
|
+
105, 106, 52, 108, 16, 109, 52, 52, 16, 16,
|
180
|
+
4, 111, 112, 52, 114, 16, 115, 116, 3, 118,
|
181
|
+
119, 2, 133, 134, 135, 1, 139 ]
|
182
|
+
|
183
|
+
racc_action_pointer = [
|
184
|
+
117, 185, 179, 178, 152, nil, 126, 125, 1, 116,
|
185
|
+
103, 98, 28, 83, 75, -7, 153, 111, 73, 64,
|
186
|
+
33, 49, 60, 25, 128, 17, 15, 43, 32, 34,
|
187
|
+
39, 44, 51, 83, 30, 49, nil, nil, nil, nil,
|
188
|
+
nil, nil, 53, 58, 59, 62, nil, nil, 68, 68,
|
189
|
+
68, 70, 151, 71, 136, 78, 82, 126, 84, nil,
|
190
|
+
88, 88, nil, 109, 96, 99, nil, 101, nil, 93,
|
191
|
+
nil, 105, 111, nil, nil, 124, nil, nil, nil, nil,
|
192
|
+
nil, 15, nil, nil, nil, 6, nil, 117, nil, nil,
|
193
|
+
nil, nil, nil, 122, 0, -2, 127, 5, nil, 140,
|
194
|
+
132, nil, 138, nil, 136, 139, 138, nil, 144, 147,
|
195
|
+
40, 152, 153, nil, 155, 157, 158, 25, 169, 162,
|
196
|
+
-13, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
197
|
+
nil, nil, nil, 163, 164, 166, nil, nil, 58, 167,
|
198
|
+
nil, nil, nil, nil, nil, nil ]
|
199
|
+
|
200
|
+
racc_action_default = [
|
201
|
+
-68, -68, -68, -68, -68, 146, -68, -68, -68, -68,
|
202
|
+
-68, -68, -68, -68, -68, -68, -68, -68, -68, -68,
|
203
|
+
-68, -68, -68, -68, -18, -68, -68, -68, -68, -68,
|
204
|
+
-68, -68, -68, -68, -68, -68, -61, -62, -63, -64,
|
205
|
+
-65, -66, -68, -68, -68, -68, -4, -17, -68, -68,
|
206
|
+
-60, -68, -45, -46, -55, -68, -20, -68, -68, -6,
|
207
|
+
-68, -68, -13, -41, -42, -68, -15, -29, -30, -68,
|
208
|
+
-7, -68, -68, -2, -3, -68, -9, -59, -10, -44,
|
209
|
+
-47, -68, -54, -11, -19, -68, -5, -68, -12, -40,
|
210
|
+
-43, -14, -28, -66, -68, -68, -65, -68, -1, -68,
|
211
|
+
-68, -56, -68, -49, -51, -52, -58, -16, -68, -33,
|
212
|
+
-68, -68, -68, -38, -68, -68, -68, -68, -68, -68,
|
213
|
+
-68, -23, -48, -50, -53, -57, -31, -32, -34, -35,
|
214
|
+
-36, -37, -39, -68, -68, -68, -24, -25, -68, -68,
|
215
|
+
-67, -8, -21, -26, -27, -22 ]
|
216
|
+
|
217
|
+
racc_goto_table = [
|
218
|
+
35, 42, 87, 80, 121, 61, 55, 102, 51, 1,
|
219
|
+
65, 53, 23, 49, 90, 109, 112, 115, 116, 134,
|
220
|
+
44, 14, 45, 137, 108, 47, 123, 29, 99, 118,
|
221
|
+
31, 109, 75, 79, 84, 89, 53, 77, 82, 144,
|
222
|
+
127, 85, 139, 92, 72, 58, 11, 13, 10, 19,
|
223
|
+
21, 18, 7, 94, 9, 124, 6, 125, 43, nil,
|
224
|
+
nil, 136, nil, nil, nil, 101, 111, 114, nil, nil,
|
225
|
+
nil, nil, nil, nil, nil, nil, nil, 143, nil, nil,
|
226
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
227
|
+
nil, nil, nil, nil, 94, nil, nil, nil, nil, nil,
|
228
|
+
nil, 133, nil, nil, nil, nil, nil, nil, nil, nil,
|
229
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
230
|
+
nil, nil, 94 ]
|
231
|
+
|
232
|
+
racc_goto_check = [
|
233
|
+
11, 11, 17, 29, 24, 15, 14, 23, 13, 1,
|
234
|
+
16, 28, 6, 12, 29, 25, 23, 23, 25, 22,
|
235
|
+
6, 9, 6, 24, 26, 6, 23, 9, 20, 21,
|
236
|
+
10, 25, 11, 13, 14, 15, 28, 12, 28, 24,
|
237
|
+
26, 11, 23, 16, 6, 10, 5, 8, 4, 5,
|
238
|
+
5, 4, 7, 11, 3, 29, 2, 32, 5, nil,
|
239
|
+
nil, 17, nil, nil, nil, 11, 15, 15, nil, nil,
|
240
|
+
nil, nil, nil, nil, nil, nil, nil, 17, nil, nil,
|
241
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
242
|
+
nil, nil, nil, nil, 11, nil, nil, nil, nil, nil,
|
243
|
+
nil, 11, nil, nil, nil, nil, nil, nil, nil, nil,
|
244
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
245
|
+
nil, nil, 11 ]
|
246
|
+
|
247
|
+
racc_goto_pointer = [
|
248
|
+
nil, 9, 52, 48, 42, 40, 1, 48, 40, 14,
|
249
|
+
16, -16, -13, -19, -22, -28, -24, -58, nil, nil,
|
250
|
+
-47, -70, -99, -78, -96, -78, -69, nil, -16, -50,
|
251
|
+
nil, nil, -49 ]
|
252
|
+
|
253
|
+
racc_goto_default = [
|
254
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
255
|
+
nil, 54, nil, nil, nil, nil, nil, 67, 24, 56,
|
256
|
+
nil, nil, nil, nil, nil, 68, nil, 63, 64, nil,
|
257
|
+
52, 104, 105 ]
|
258
|
+
|
259
|
+
racc_reduce_table = [
|
260
|
+
0, 0, :racc_error,
|
261
|
+
8, 25, :_reduce_1,
|
262
|
+
7, 25, :_reduce_2,
|
263
|
+
7, 25, :_reduce_3,
|
264
|
+
6, 25, :_reduce_4,
|
265
|
+
7, 25, :_reduce_5,
|
266
|
+
6, 25, :_reduce_6,
|
267
|
+
4, 26, :_reduce_7,
|
268
|
+
8, 31, :_reduce_8,
|
269
|
+
4, 27, :_reduce_9,
|
270
|
+
4, 28, :_reduce_10,
|
271
|
+
4, 29, :_reduce_11,
|
272
|
+
4, 32, :_reduce_12,
|
273
|
+
3, 32, :_reduce_13,
|
274
|
+
4, 33, :_reduce_14,
|
275
|
+
3, 33, :_reduce_15,
|
276
|
+
4, 34, :_reduce_16,
|
277
|
+
2, 30, :_reduce_17,
|
278
|
+
1, 30, :_reduce_18,
|
279
|
+
2, 38, :_reduce_19,
|
280
|
+
1, 38, :_reduce_20,
|
281
|
+
7, 42, :_reduce_21,
|
282
|
+
4, 44, :_reduce_22,
|
283
|
+
2, 44, :_reduce_23,
|
284
|
+
2, 45, :_reduce_24,
|
285
|
+
2, 45, :_reduce_25,
|
286
|
+
2, 46, :_reduce_26,
|
287
|
+
2, 46, :_reduce_27,
|
288
|
+
2, 40, :_reduce_28,
|
289
|
+
1, 40, :_reduce_29,
|
290
|
+
1, 41, :_reduce_none,
|
291
|
+
4, 41, :_reduce_31,
|
292
|
+
2, 50, :_reduce_32,
|
293
|
+
1, 50, :_reduce_33,
|
294
|
+
4, 49, :_reduce_34,
|
295
|
+
4, 49, :_reduce_35,
|
296
|
+
4, 49, :_reduce_36,
|
297
|
+
4, 49, :_reduce_37,
|
298
|
+
3, 49, :_reduce_38,
|
299
|
+
4, 49, :_reduce_39,
|
300
|
+
2, 39, :_reduce_40,
|
301
|
+
1, 39, :_reduce_41,
|
302
|
+
1, 39, :_reduce_42,
|
303
|
+
2, 51, :_reduce_43,
|
304
|
+
2, 37, :_reduce_44,
|
305
|
+
1, 37, :_reduce_45,
|
306
|
+
1, 37, :_reduce_46,
|
307
|
+
2, 54, :_reduce_47,
|
308
|
+
4, 43, :_reduce_48,
|
309
|
+
3, 43, :_reduce_49,
|
310
|
+
2, 47, :_reduce_50,
|
311
|
+
1, 47, :_reduce_51,
|
312
|
+
1, 47, :_reduce_52,
|
313
|
+
2, 55, :_reduce_53,
|
314
|
+
2, 52, :_reduce_54,
|
315
|
+
1, 52, :_reduce_55,
|
316
|
+
2, 53, :_reduce_56,
|
317
|
+
2, 56, :_reduce_57,
|
318
|
+
1, 56, :_reduce_58,
|
319
|
+
2, 36, :_reduce_59,
|
320
|
+
1, 36, :_reduce_60,
|
321
|
+
1, 35, :_reduce_none,
|
322
|
+
1, 35, :_reduce_none,
|
323
|
+
1, 35, :_reduce_none,
|
324
|
+
1, 35, :_reduce_none,
|
325
|
+
1, 35, :_reduce_none,
|
326
|
+
1, 35, :_reduce_none,
|
327
|
+
2, 48, :_reduce_67 ]
|
328
|
+
|
329
|
+
racc_reduce_n = 68
|
330
|
+
|
331
|
+
racc_shift_n = 146
|
332
|
+
|
333
|
+
racc_token_table = {
|
334
|
+
false => 0,
|
335
|
+
:error => 1,
|
336
|
+
:DEFINE => 2,
|
337
|
+
:DOMAIN => 3,
|
338
|
+
:REQUIREMENTS => 4,
|
339
|
+
:TYPES => 5,
|
340
|
+
:PREDICATES => 6,
|
341
|
+
:ACTION => 7,
|
342
|
+
:PARAMETERS => 8,
|
343
|
+
:PRECONDITION => 9,
|
344
|
+
:EFFECT => 10,
|
345
|
+
:PROBLEM => 11,
|
346
|
+
:OBJECTS => 12,
|
347
|
+
:GOAL => 13,
|
348
|
+
:INIT => 14,
|
349
|
+
:NOT => 15,
|
350
|
+
:AND => 16,
|
351
|
+
:EQUAL => 17,
|
352
|
+
:OPEN_BRACE => 18,
|
353
|
+
:CLOSE_BRACE => 19,
|
354
|
+
:SYMBOL => 20,
|
355
|
+
:DASH => 21,
|
356
|
+
:ID => 22,
|
357
|
+
:VAR => 23 }
|
358
|
+
|
359
|
+
racc_nt_base = 24
|
360
|
+
|
361
|
+
racc_use_result_var = false
|
362
|
+
|
363
|
+
Racc_arg = [
|
364
|
+
racc_action_table,
|
365
|
+
racc_action_check,
|
366
|
+
racc_action_default,
|
367
|
+
racc_action_pointer,
|
368
|
+
racc_goto_table,
|
369
|
+
racc_goto_check,
|
370
|
+
racc_goto_default,
|
371
|
+
racc_goto_pointer,
|
372
|
+
racc_nt_base,
|
373
|
+
racc_reduce_table,
|
374
|
+
racc_token_table,
|
375
|
+
racc_shift_n,
|
376
|
+
racc_reduce_n,
|
377
|
+
racc_use_result_var ]
|
378
|
+
|
379
|
+
Racc_token_to_s_table = [
|
380
|
+
"$end",
|
381
|
+
"error",
|
382
|
+
"DEFINE",
|
383
|
+
"DOMAIN",
|
384
|
+
"REQUIREMENTS",
|
385
|
+
"TYPES",
|
386
|
+
"PREDICATES",
|
387
|
+
"ACTION",
|
388
|
+
"PARAMETERS",
|
389
|
+
"PRECONDITION",
|
390
|
+
"EFFECT",
|
391
|
+
"PROBLEM",
|
392
|
+
"OBJECTS",
|
393
|
+
"GOAL",
|
394
|
+
"INIT",
|
395
|
+
"NOT",
|
396
|
+
"AND",
|
397
|
+
"EQUAL",
|
398
|
+
"OPEN_BRACE",
|
399
|
+
"CLOSE_BRACE",
|
400
|
+
"SYMBOL",
|
401
|
+
"DASH",
|
402
|
+
"ID",
|
403
|
+
"VAR",
|
404
|
+
"$start",
|
405
|
+
"target",
|
406
|
+
"domain_name",
|
407
|
+
"requirements",
|
408
|
+
"types",
|
409
|
+
"predicates",
|
410
|
+
"actions",
|
411
|
+
"domain_problem",
|
412
|
+
"objects",
|
413
|
+
"init",
|
414
|
+
"goal",
|
415
|
+
"name",
|
416
|
+
"symbols",
|
417
|
+
"type_list",
|
418
|
+
"predicate_list",
|
419
|
+
"object_list",
|
420
|
+
"literals",
|
421
|
+
"literal",
|
422
|
+
"action",
|
423
|
+
"predicate",
|
424
|
+
"parameters",
|
425
|
+
"precondition",
|
426
|
+
"effect",
|
427
|
+
"vars_list",
|
428
|
+
"empty",
|
429
|
+
"atom_literal",
|
430
|
+
"atom_literals",
|
431
|
+
"objects_t",
|
432
|
+
"names",
|
433
|
+
"type",
|
434
|
+
"types_t",
|
435
|
+
"vars_t",
|
436
|
+
"var_names" ]
|
437
|
+
|
438
|
+
Racc_debug_parser = false
|
439
|
+
|
440
|
+
##### State transition tables end #####
|
441
|
+
|
442
|
+
# reduce 0 omitted
|
443
|
+
|
444
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
445
|
+
def _reduce_1(val, _values)
|
446
|
+
val[2].merge!({
|
447
|
+
requirements: val[3],
|
448
|
+
types: val[4],
|
449
|
+
predicates: val[5],
|
450
|
+
actions: val[6]
|
451
|
+
})
|
452
|
+
end
|
453
|
+
.,.,
|
454
|
+
|
455
|
+
module_eval(<<'.,.,', 'parser.y', 21)
|
456
|
+
def _reduce_2(val, _values)
|
457
|
+
val[2].merge!({
|
458
|
+
requirements: val[3],
|
459
|
+
predicates: val[4],
|
460
|
+
actions: val[5]
|
461
|
+
})
|
462
|
+
end
|
463
|
+
.,.,
|
464
|
+
|
465
|
+
module_eval(<<'.,.,', 'parser.y', 27)
|
466
|
+
def _reduce_3(val, _values)
|
467
|
+
val[2].merge!({
|
468
|
+
requirements: [:strips],
|
469
|
+
types: val[3],
|
470
|
+
predicates: val[4],
|
471
|
+
actions: val[5]
|
472
|
+
})
|
473
|
+
end
|
474
|
+
.,.,
|
475
|
+
|
476
|
+
module_eval(<<'.,.,', 'parser.y', 34)
|
477
|
+
def _reduce_4(val, _values)
|
478
|
+
val[2].merge!({
|
479
|
+
requirements: [:strips],
|
480
|
+
predicates: val[3],
|
481
|
+
actions: val[4]
|
482
|
+
})
|
483
|
+
end
|
484
|
+
.,.,
|
485
|
+
|
486
|
+
module_eval(<<'.,.,', 'parser.y', 40)
|
487
|
+
def _reduce_5(val, _values)
|
488
|
+
val[2].merge({ objects: val[3], init: val[4], goal: val[5] })
|
489
|
+
end
|
490
|
+
.,.,
|
491
|
+
|
492
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
493
|
+
def _reduce_6(val, _values)
|
494
|
+
val[2].merge({ objects: [], init: val[3], goal: val[4] })
|
495
|
+
end
|
496
|
+
.,.,
|
497
|
+
|
498
|
+
module_eval(<<'.,.,', 'parser.y', 46)
|
499
|
+
def _reduce_7(val, _values)
|
500
|
+
domain(val[2])
|
501
|
+
end
|
502
|
+
.,.,
|
503
|
+
|
504
|
+
module_eval(<<'.,.,', 'parser.y', 51)
|
505
|
+
def _reduce_8(val, _values)
|
506
|
+
problem(val[2], val[6])
|
507
|
+
end
|
508
|
+
.,.,
|
509
|
+
|
510
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
511
|
+
def _reduce_9(val, _values)
|
512
|
+
requirements(val[2])
|
513
|
+
end
|
514
|
+
.,.,
|
515
|
+
|
516
|
+
module_eval(<<'.,.,', 'parser.y', 59)
|
517
|
+
def _reduce_10(val, _values)
|
518
|
+
val[2]
|
519
|
+
end
|
520
|
+
.,.,
|
521
|
+
|
522
|
+
module_eval(<<'.,.,', 'parser.y', 63)
|
523
|
+
def _reduce_11(val, _values)
|
524
|
+
val[2]
|
525
|
+
end
|
526
|
+
.,.,
|
527
|
+
|
528
|
+
module_eval(<<'.,.,', 'parser.y', 67)
|
529
|
+
def _reduce_12(val, _values)
|
530
|
+
val[2]
|
531
|
+
end
|
532
|
+
.,.,
|
533
|
+
|
534
|
+
module_eval(<<'.,.,', 'parser.y', 68)
|
535
|
+
def _reduce_13(val, _values)
|
536
|
+
[]
|
537
|
+
end
|
538
|
+
.,.,
|
539
|
+
|
540
|
+
module_eval(<<'.,.,', 'parser.y', 72)
|
541
|
+
def _reduce_14(val, _values)
|
542
|
+
val[2]
|
543
|
+
end
|
544
|
+
.,.,
|
545
|
+
|
546
|
+
module_eval(<<'.,.,', 'parser.y', 73)
|
547
|
+
def _reduce_15(val, _values)
|
548
|
+
[]
|
549
|
+
end
|
550
|
+
.,.,
|
551
|
+
|
552
|
+
module_eval(<<'.,.,', 'parser.y', 77)
|
553
|
+
def _reduce_16(val, _values)
|
554
|
+
val[2]
|
555
|
+
end
|
556
|
+
.,.,
|
557
|
+
|
558
|
+
module_eval(<<'.,.,', 'parser.y', 81)
|
559
|
+
def _reduce_17(val, _values)
|
560
|
+
[val[0]] + val[1]
|
561
|
+
end
|
562
|
+
.,.,
|
563
|
+
|
564
|
+
module_eval(<<'.,.,', 'parser.y', 82)
|
565
|
+
def _reduce_18(val, _values)
|
566
|
+
[val[0]]
|
567
|
+
end
|
568
|
+
.,.,
|
569
|
+
|
570
|
+
module_eval(<<'.,.,', 'parser.y', 86)
|
571
|
+
def _reduce_19(val, _values)
|
572
|
+
[val[0]] + val[1]
|
573
|
+
end
|
574
|
+
.,.,
|
575
|
+
|
576
|
+
module_eval(<<'.,.,', 'parser.y', 87)
|
577
|
+
def _reduce_20(val, _values)
|
578
|
+
[val[0]]
|
579
|
+
end
|
580
|
+
.,.,
|
581
|
+
|
582
|
+
module_eval(<<'.,.,', 'parser.y', 92)
|
583
|
+
def _reduce_21(val, _values)
|
584
|
+
@params = nil; Action.new(val[2], val[3], val[4], val[5])
|
585
|
+
end
|
586
|
+
.,.,
|
587
|
+
|
588
|
+
module_eval(<<'.,.,', 'parser.y', 96)
|
589
|
+
def _reduce_22(val, _values)
|
590
|
+
parameters(val[2])
|
591
|
+
end
|
592
|
+
.,.,
|
593
|
+
|
594
|
+
module_eval(<<'.,.,', 'parser.y', 97)
|
595
|
+
def _reduce_23(val, _values)
|
596
|
+
[]
|
597
|
+
end
|
598
|
+
.,.,
|
599
|
+
|
600
|
+
module_eval(<<'.,.,', 'parser.y', 101)
|
601
|
+
def _reduce_24(val, _values)
|
602
|
+
val[1]
|
603
|
+
end
|
604
|
+
.,.,
|
605
|
+
|
606
|
+
module_eval(<<'.,.,', 'parser.y', 102)
|
607
|
+
def _reduce_25(val, _values)
|
608
|
+
val[1]
|
609
|
+
end
|
610
|
+
.,.,
|
611
|
+
|
612
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
613
|
+
def _reduce_26(val, _values)
|
614
|
+
val[1]
|
615
|
+
end
|
616
|
+
.,.,
|
617
|
+
|
618
|
+
module_eval(<<'.,.,', 'parser.y', 107)
|
619
|
+
def _reduce_27(val, _values)
|
620
|
+
val[1]
|
621
|
+
end
|
622
|
+
.,.,
|
623
|
+
|
624
|
+
module_eval(<<'.,.,', 'parser.y', 111)
|
625
|
+
def _reduce_28(val, _values)
|
626
|
+
[val[0]] + val[1]
|
627
|
+
end
|
628
|
+
.,.,
|
629
|
+
|
630
|
+
module_eval(<<'.,.,', 'parser.y', 112)
|
631
|
+
def _reduce_29(val, _values)
|
632
|
+
[val[0]]
|
633
|
+
end
|
634
|
+
.,.,
|
635
|
+
|
636
|
+
# reduce 30 omitted
|
637
|
+
|
638
|
+
module_eval(<<'.,.,', 'parser.y', 117)
|
639
|
+
def _reduce_31(val, _values)
|
640
|
+
And.new(val[2])
|
641
|
+
end
|
642
|
+
.,.,
|
643
|
+
|
644
|
+
module_eval(<<'.,.,', 'parser.y', 121)
|
645
|
+
def _reduce_32(val, _values)
|
646
|
+
[val[0]] + val[1]
|
647
|
+
end
|
648
|
+
.,.,
|
649
|
+
|
650
|
+
module_eval(<<'.,.,', 'parser.y', 122)
|
651
|
+
def _reduce_33(val, _values)
|
652
|
+
[val[0]]
|
653
|
+
end
|
654
|
+
.,.,
|
655
|
+
|
656
|
+
module_eval(<<'.,.,', 'parser.y', 126)
|
657
|
+
def _reduce_34(val, _values)
|
658
|
+
Fact[@predicates.fetch(val[1]), val[2]]
|
659
|
+
end
|
660
|
+
.,.,
|
661
|
+
|
662
|
+
module_eval(<<'.,.,', 'parser.y', 127)
|
663
|
+
def _reduce_35(val, _values)
|
664
|
+
Formula.new(@predicates.fetch(val[1]), val[2])
|
665
|
+
end
|
666
|
+
.,.,
|
667
|
+
|
668
|
+
module_eval(<<'.,.,', 'parser.y', 128)
|
669
|
+
def _reduce_36(val, _values)
|
670
|
+
Equal.new(*(val[2]))
|
671
|
+
end
|
672
|
+
.,.,
|
673
|
+
|
674
|
+
module_eval(<<'.,.,', 'parser.y', 129)
|
675
|
+
def _reduce_37(val, _values)
|
676
|
+
EqualFormula.new(*(val[2]))
|
677
|
+
end
|
678
|
+
.,.,
|
679
|
+
|
680
|
+
module_eval(<<'.,.,', 'parser.y', 130)
|
681
|
+
def _reduce_38(val, _values)
|
682
|
+
Fact[@predicates.fetch(val[1]), []]
|
683
|
+
end
|
684
|
+
.,.,
|
685
|
+
|
686
|
+
module_eval(<<'.,.,', 'parser.y', 131)
|
687
|
+
def _reduce_39(val, _values)
|
688
|
+
Not[val[2]]
|
689
|
+
end
|
690
|
+
.,.,
|
691
|
+
|
692
|
+
module_eval(<<'.,.,', 'parser.y', 135)
|
693
|
+
def _reduce_40(val, _values)
|
694
|
+
val[0] + val[1]
|
695
|
+
end
|
696
|
+
.,.,
|
697
|
+
|
698
|
+
module_eval(<<'.,.,', 'parser.y', 136)
|
699
|
+
def _reduce_41(val, _values)
|
700
|
+
val[0]
|
701
|
+
end
|
702
|
+
.,.,
|
703
|
+
|
704
|
+
module_eval(<<'.,.,', 'parser.y', 137)
|
705
|
+
def _reduce_42(val, _values)
|
706
|
+
val[0].map {|n| object(n)}
|
707
|
+
end
|
708
|
+
.,.,
|
709
|
+
|
710
|
+
module_eval(<<'.,.,', 'parser.y', 141)
|
711
|
+
def _reduce_43(val, _values)
|
712
|
+
val[0].map {|n| object(n, val[1])}
|
713
|
+
end
|
714
|
+
.,.,
|
715
|
+
|
716
|
+
module_eval(<<'.,.,', 'parser.y', 145)
|
717
|
+
def _reduce_44(val, _values)
|
718
|
+
val[0] + val[1]
|
719
|
+
end
|
720
|
+
.,.,
|
721
|
+
|
722
|
+
module_eval(<<'.,.,', 'parser.y', 146)
|
723
|
+
def _reduce_45(val, _values)
|
724
|
+
val[0]
|
725
|
+
end
|
726
|
+
.,.,
|
727
|
+
|
728
|
+
module_eval(<<'.,.,', 'parser.y', 147)
|
729
|
+
def _reduce_46(val, _values)
|
730
|
+
val[0].map {|t| type(t)}
|
731
|
+
end
|
732
|
+
.,.,
|
733
|
+
|
734
|
+
module_eval(<<'.,.,', 'parser.y', 151)
|
735
|
+
def _reduce_47(val, _values)
|
736
|
+
val[0].map {|t| type(t, val[1])}
|
737
|
+
end
|
738
|
+
.,.,
|
739
|
+
|
740
|
+
module_eval(<<'.,.,', 'parser.y', 155)
|
741
|
+
def _reduce_48(val, _values)
|
742
|
+
predicate(val[1], val[2])
|
743
|
+
end
|
744
|
+
.,.,
|
745
|
+
|
746
|
+
module_eval(<<'.,.,', 'parser.y', 156)
|
747
|
+
def _reduce_49(val, _values)
|
748
|
+
predicate(val[1])
|
749
|
+
end
|
750
|
+
.,.,
|
751
|
+
|
752
|
+
module_eval(<<'.,.,', 'parser.y', 160)
|
753
|
+
def _reduce_50(val, _values)
|
754
|
+
val[0] + val[1]
|
755
|
+
end
|
756
|
+
.,.,
|
757
|
+
|
758
|
+
module_eval(<<'.,.,', 'parser.y', 161)
|
759
|
+
def _reduce_51(val, _values)
|
760
|
+
val[0]
|
761
|
+
end
|
762
|
+
.,.,
|
763
|
+
|
764
|
+
module_eval(<<'.,.,', 'parser.y', 162)
|
765
|
+
def _reduce_52(val, _values)
|
766
|
+
val[0].map{|v| @params ? @params.fetch(v) : Var.new(v)}
|
767
|
+
end
|
768
|
+
.,.,
|
769
|
+
|
770
|
+
module_eval(<<'.,.,', 'parser.y', 166)
|
771
|
+
def _reduce_53(val, _values)
|
772
|
+
val[0].map{|v| Var.new(v, val[1])}
|
773
|
+
end
|
774
|
+
.,.,
|
775
|
+
|
776
|
+
module_eval(<<'.,.,', 'parser.y', 170)
|
777
|
+
def _reduce_54(val, _values)
|
778
|
+
[val[0]] + val[1]
|
779
|
+
end
|
780
|
+
.,.,
|
781
|
+
|
782
|
+
module_eval(<<'.,.,', 'parser.y', 171)
|
783
|
+
def _reduce_55(val, _values)
|
784
|
+
[val[0]]
|
785
|
+
end
|
786
|
+
.,.,
|
787
|
+
|
788
|
+
module_eval(<<'.,.,', 'parser.y', 175)
|
789
|
+
def _reduce_56(val, _values)
|
790
|
+
type(val[1])
|
791
|
+
end
|
792
|
+
.,.,
|
793
|
+
|
794
|
+
module_eval(<<'.,.,', 'parser.y', 179)
|
795
|
+
def _reduce_57(val, _values)
|
796
|
+
[val[0]] + val[1]
|
797
|
+
end
|
798
|
+
.,.,
|
799
|
+
|
800
|
+
module_eval(<<'.,.,', 'parser.y', 180)
|
801
|
+
def _reduce_58(val, _values)
|
802
|
+
[val[0]]
|
803
|
+
end
|
804
|
+
.,.,
|
805
|
+
|
806
|
+
module_eval(<<'.,.,', 'parser.y', 184)
|
807
|
+
def _reduce_59(val, _values)
|
808
|
+
[val[0]] + val[1]
|
809
|
+
end
|
810
|
+
.,.,
|
811
|
+
|
812
|
+
module_eval(<<'.,.,', 'parser.y', 185)
|
813
|
+
def _reduce_60(val, _values)
|
814
|
+
[val[0]]
|
815
|
+
end
|
816
|
+
.,.,
|
817
|
+
|
818
|
+
# reduce 61 omitted
|
819
|
+
|
820
|
+
# reduce 62 omitted
|
821
|
+
|
822
|
+
# reduce 63 omitted
|
823
|
+
|
824
|
+
# reduce 64 omitted
|
825
|
+
|
826
|
+
# reduce 65 omitted
|
827
|
+
|
828
|
+
# reduce 66 omitted
|
829
|
+
|
830
|
+
module_eval(<<'.,.,', 'parser.y', 198)
|
831
|
+
def _reduce_67(val, _values)
|
832
|
+
EMPTY
|
833
|
+
end
|
834
|
+
.,.,
|
835
|
+
|
836
|
+
def _reduce_none(val, _values)
|
837
|
+
val[0]
|
838
|
+
end
|
839
|
+
|
840
|
+
end # class Parser
|
841
|
+
end # module PDDL
|
842
|
+
end # module Longjing
|