|
2 | 2 |
|
3 | 3 | # from nltk import ViterbiParser |
4 | 4 |
|
5 | | -from planners.fo_planner import Operator |
6 | | -from planners.fo_planner import FoPlanner |
7 | | -from learners.Grammar import grammar |
8 | | -from learners.WhatLearner import ViterbiParser |
| 5 | +from fo_planner import Operator |
| 6 | +from fo_planner import FoPlanner |
| 7 | +# from learners.Grammar import grammar |
| 8 | +# from learners.WhatLearner import ViterbiParser |
9 | 9 |
|
10 | 10 | _then_gensym_counter = 0 |
11 | 11 |
|
@@ -427,17 +427,81 @@ def concatenate_without_space(x, y): |
427 | 427 |
|
428 | 428 | if __name__ == "__main__": |
429 | 429 |
|
430 | | - facts = [(('value', 'a'), '3'), |
431 | | - (('value', 'b'), '3x')] |
432 | | - kb = FoPlanner(facts, [string_subtract_rule]) |
433 | | - kb.fc_infer() |
434 | | - print(kb.facts) |
| 430 | + # facts = [(('value', 'a'), '3'), |
| 431 | + # (('value', 'b'), '3x')] |
| 432 | + |
| 433 | + facts = [ |
| 434 | + # (('x', ('bound', '?b1')), '?xv') |
| 435 | + (('x', ('pos','rect1')),2), |
| 436 | + (('y', ('pos','rect1')),1), |
| 437 | + (('x', ('bound','rect1')),3), |
| 438 | + (('y', ('bound','rect1')),1), |
| 439 | + |
| 440 | + (('x', ('pos','block1')),1), |
| 441 | + (('y', ('pos','block1')),2), |
| 442 | + (('x', ('bound','block1')),1), |
| 443 | + (('y', ('bound','block1')),1), |
| 444 | + |
| 445 | + (('x', ('bound','block2')),1), |
| 446 | + (('y', ('bound','block2')),1), |
| 447 | + |
| 448 | + (('x', ('pos','check1')),1), |
| 449 | + (('y', ('pos','check1')),1), |
| 450 | + |
| 451 | + (('x', ('pos','check2')),1), |
| 452 | + (('y', ('pos','check2')),3), |
| 453 | + |
| 454 | + (('x', ('pos','check3')),3), |
| 455 | + (('y', ('pos','check3')),1), |
| 456 | + |
| 457 | + (('x', ('pos','check4')),3), |
| 458 | + (('y', ('pos','check4')),3), |
| 459 | + |
| 460 | + ] |
| 461 | + |
| 462 | + |
| 463 | + # kb = FoPlanner(facts, [string_subtract_rule]) |
| 464 | + # kb.fc_infer() |
| 465 | + # print(kb.facts) |
435 | 466 |
|
436 | 467 | # facts = [(('value', 'x'), '17'), |
437 | 468 | # (('value', 'y'), '7')] |
438 | | - # kb = FoPlanner(facts, arith_rules + [half_val]) |
439 | | - # from pprint import pprint |
440 | | - # for sol in kb.fc_query([(('value', '?a'), '98')], 3): |
| 469 | + kb = FoPlanner(facts, rb_rules) |
| 470 | + from pprint import pprint |
| 471 | + |
| 472 | + |
| 473 | + print('X') |
| 474 | + i = 0 |
| 475 | + for sol in kb.fc_query([(('x', '?a'),3)], 2): |
| 476 | + if i % 5 == 0: |
| 477 | + pprint(sol) |
| 478 | + if i > 5 * 10: |
| 479 | + break |
| 480 | + i += 1 |
| 481 | + |
| 482 | + |
| 483 | + print('Y') |
| 484 | + i = 0 |
| 485 | + for sol in kb.fc_query([(('y', '?a'),2)], 2): |
| 486 | + if i % 5 == 0: |
| 487 | + pprint(sol) |
| 488 | + if i > 5 * 10: |
| 489 | + break |
| 490 | + i += 1 |
| 491 | + |
| 492 | + |
| 493 | + |
| 494 | + # print(len(xs)) |
| 495 | + # pprint(xs[:10]) |
| 496 | + |
| 497 | + # ys = [sol for sol in kb.fc_query([(('y', '?a'),2)], 2)] |
| 498 | + # print('Y') |
| 499 | + # print(len(ys)) |
| 500 | + # pprint(ys[:10]) |
| 501 | + |
| 502 | + # print('Y') |
| 503 | + # for sol in kb.fc_query([(('y', '?a'),2)], 2): |
441 | 504 | # pprint(sol) |
442 | 505 | # kb.fc_infer() |
443 | | - # print(kb.facts) |
| 506 | + # pprint(kb.facts) |
| 507 | + |
0 commit comments