Skip to content

Commit 2932c73

Browse files
author
Chris MacLellan
committed
updated fo_planner operators for multicolumn
1 parent 8eca72a commit 2932c73

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

apprentice/working_memory/fo_planner_operators.py

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ def int3_float_add_then_tens(x, y, w):
295295
add_then_ones = Operator(('Add_Then_Ones', '?x', '?y'),
296296
[(('value', '?x'), '?xv'),
297297
(('value', '?y'), '?yv'),
298-
# (lambda x, y: x <= y, '?x', '?y')
298+
(lambda x, y: x <= y, '?x', '?y')
299299
],
300300
[(('value', ('Add_Then_Ones', ('value', '?x'), ('value', '?y'))),
301301
(int2_float_add_then_ones, '?xv', '?yv'))])
302302

303303
add_then_tens = Operator(('Add_Then_Tens', '?x', '?y'),
304304
[(('value', '?x'), '?xv'),
305305
(('value', '?y'), '?yv'),
306-
# (lambda x, y: x <= y, '?x', '?y')
306+
(lambda x, y: x <= y, '?x', '?y')
307307
],
308308
[(('value', ('Add_Then_Tens', ('value', '?x'), ('value', '?y'))),
309309
(int2_float_add_then_tens, '?xv', '?yv'))])
@@ -312,7 +312,7 @@ def int3_float_add_then_tens(x, y, w):
312312
[(('value', '?x'), '?xv'),
313313
(('value', '?y'), '?yv'),
314314
(('value', '?w'), '?wv'),
315-
# (lambda x, y: x <= y, '?x', '?y')
315+
(lambda x, y: x <= y, '?x', '?y')
316316
],
317317
[(('value', ('Add_Then_Ones3', ('value', '?x'), ('value', '?y'), ('value', '?w'))),
318318
(int3_float_add_then_ones, '?xv', '?yv', '?wv'))])
@@ -321,7 +321,53 @@ def int3_float_add_then_tens(x, y, w):
321321
[(('value', '?x'), '?xv'),
322322
(('value', '?y'), '?yv'),
323323
(('value', '?w'), '?wv'),
324-
# (lambda x, y: x <= y, '?x', '?y')
324+
(lambda x, y: x <= y, '?x', '?y')
325+
],
326+
[(('value', ('Add_Then_Tens3', ('value', '?x'), ('value', '?y'), ('value', '?w'))),
327+
(int3_float_add_then_tens, '?xv', '?yv', '?wv'))])
328+
329+
add_then_ones_same_column = Operator(('Add_Then_Ones', '?x', '?y'),
330+
[(('value', '?x'), '?xv'),
331+
(('value', '?y'), '?yv'),
332+
(lambda x, y: x < y, '?x', '?y'),
333+
(('column', '?x'), '?c'),
334+
(('column', '?y'), '?c')
335+
],
336+
[(('value', ('Add_Then_Ones', ('value', '?x'), ('value', '?y'))),
337+
(int2_float_add_then_ones, '?xv', '?yv'))])
338+
339+
add_then_ones3_same_column = Operator(('Add_Then_Ones3', '?x', '?y', '?w'),
340+
[(('value', '?x'), '?xv'),
341+
(('value', '?y'), '?yv'),
342+
(('value', '?w'), '?wv'),
343+
(lambda x, y: x < y, '?x', '?y'),
344+
(lambda y, w: y < w, '?y', '?w'),
345+
(('column', '?x'), '?c'),
346+
(('column', '?y'), '?c'),
347+
(('column', '?w'), '?c')
348+
],
349+
[(('value', ('Add_Then_Ones3', ('value', '?x'), ('value', '?y'), ('value', '?w'))),
350+
(int3_float_add_then_ones, '?xv', '?yv', '?wv'))])
351+
352+
add_then_tens_same_column = Operator(('Add_Then_Tens', '?x', '?y'),
353+
[(('value', '?x'), '?xv'),
354+
(('value', '?y'), '?yv'),
355+
(lambda x, y: x < y, '?x', '?y'),
356+
(('column', '?x'), '?c'),
357+
(('column', '?y'), '?c')
358+
],
359+
[(('value', ('Add_Then_Tens', ('value', '?x'), ('value', '?y'))),
360+
(int2_float_add_then_tens, '?xv', '?yv'))])
361+
362+
add_then_tens3_same_column = Operator(('Add_Then_Tens3', '?x', '?y', '?w'),
363+
[(('value', '?x'), '?xv'),
364+
(('value', '?y'), '?yv'),
365+
(('value', '?w'), '?wv'),
366+
(lambda x, y: x < y, '?x', '?y'),
367+
(lambda y, w: y < w, '?y', '?w'),
368+
(('column', '?x'), '?c'),
369+
(('column', '?y'), '?c'),
370+
(('column', '?w'), '?c')
325371
],
326372
[(('value', ('Add_Then_Tens3', ('value', '?x'), ('value', '?y'), ('value', '?w'))),
327373
(int3_float_add_then_tens, '?xv', '?yv', '?wv'))])
@@ -562,10 +608,19 @@ def int3_float_add_then_tens(x, y, w):
562608
fraction_fun = [add_rule, mult_rule]
563609
fraction_feat = [equal_rule, editable_rule]
564610

611+
multicolumn_fun = [add_then_ones_same_column,
612+
add_then_tens_same_column,
613+
add_then_ones3_same_column,
614+
add_then_tens3_same_column
615+
]
616+
617+
multicolumn_feat = []
618+
565619
functionsets = {'tutor knowledge': arith_rules,
566620
'stoichiometry': stoichiometry_rules,
567621
'rumbleblocks': rb_rules, 'article selection': [],
568-
'fraction arith': fraction_fun}
622+
'fraction arith': fraction_fun,
623+
'multicolumn': multicolumn_fun}
569624

570625
featuresets = {'tutor knowledge': [equal_rule,
571626
grammar_parser_rule,
@@ -575,7 +630,8 @@ def int3_float_add_then_tens(x, y, w):
575630
bigram_rule,
576631
equal_rule,
577632
editable_rule],
578-
'fraction arith': fraction_feat}
633+
'fraction arith': fraction_feat,
634+
'multicolumn': multicolumn_fun}
579635

580636

581637
if __name__ == "__main__":

0 commit comments

Comments
 (0)