-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove mapping, proposition names *are* PDDL ground fluents. Fix ambiguity in DP names #262
base: main
Are you sure you want to change the base?
Conversation
b53af06
to
7095af9
Compare
from plan4past.utils.atoms_visitor import find_atoms | ||
_PDDL_NAME_REGEX = "[A-Za-z][-_A-Za-z0-9]*" | ||
_GROUND_FLUENT_REGEX = re.compile( | ||
rf"(\"({_PDDL_NAME_REGEX})( {_PDDL_NAME_REGEX})*\")|({_PDDL_NAME_REGEX})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either
"predicate_name const1 const2 ..."
or predicate_name
.
E.g.:
O("on a b") & O(emptyhand)
"s28-0": "O(served_p14 & served_p15 & served_p16 & served_p17 & served_p18 & served_p19 & served_p20 & served_p21 & served_p22 & served_p23 & served_p24 & served_p25 & served_p26 & served_p27) & O(served_p0 & served_p1 & served_p2 & served_p3 & served_p4 & served_p5 & served_p6 & served_p7 & served_p8 & served_p9 & served_p10 & served_p11 & served_p12 & served_p13 & !(Y(O(served_p14 | served_p15 | served_p16 | served_p17 | served_p18 | served_p19 | served_p20 | served_p21 | served_p22 | served_p23 | served_p24 | served_p25 | served_p26 | served_p27)))) & !(O(boarded_p0 & (boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9))) & !(O(boarded_p1 & (boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10))) & !(O(boarded_p2 & (boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11))) & !(O(boarded_p3 & (boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12))) & !(O(boarded_p4 & (boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13))) & !(O(boarded_p5 & (boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14))) & !(O(boarded_p6 & (boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15))) & !(O(boarded_p7 & (boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16))) & !(O(boarded_p8 & (boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17))) & !(O(boarded_p9 & (boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18))) & !(O(boarded_p10 & (boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19))) & !(O(boarded_p11 & (boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20))) & !(O(boarded_p12 & (boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21))) & !(O(boarded_p13 & (boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22))) & !(O(boarded_p14 & (boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23))) & !(O(boarded_p15 & (boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24))) & !(O(boarded_p16 & (boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25))) & !(O(boarded_p17 & (boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26))) & !(O(boarded_p18 & (boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27))) & !(O(boarded_p19 & (boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0))) & !(O(boarded_p20 & (boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1))) & !(O(boarded_p21 & (boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2))) & !(O(boarded_p22 & (boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3))) & !(O(boarded_p23 & (boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4))) & !(O(boarded_p24 & (boarded_p25 | boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5))) & !(O(boarded_p25 & (boarded_p26 | boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6))) & !(O(boarded_p26 & (boarded_p27 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7))) & !(O(boarded_p27 & (boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8)))", | ||
"s29-0": "O(served_p14 & served_p15 & served_p16 & served_p17 & served_p18 & served_p19 & served_p20 & served_p21 & served_p22 & served_p23 & served_p24 & served_p25 & served_p26 & served_p27 & served_p28) & O(served_p0 & served_p1 & served_p2 & served_p3 & served_p4 & served_p5 & served_p6 & served_p7 & served_p8 & served_p9 & served_p10 & served_p11 & served_p12 & served_p13 & !(Y(O(served_p14 | served_p15 | served_p16 | served_p17 | served_p18 | served_p19 | served_p20 | served_p21 | served_p22 | served_p23 | served_p24 | served_p25 | served_p26 | served_p27 | served_p28)))) & !(O(boarded_p0 & (boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9))) & !(O(boarded_p1 & (boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10))) & !(O(boarded_p2 & (boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11))) & !(O(boarded_p3 & (boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12))) & !(O(boarded_p4 & (boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13))) & !(O(boarded_p5 & (boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14))) & !(O(boarded_p6 & (boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15))) & !(O(boarded_p7 & (boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16))) & !(O(boarded_p8 & (boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17))) & !(O(boarded_p9 & (boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18))) & !(O(boarded_p10 & (boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19))) & !(O(boarded_p11 & (boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20))) & !(O(boarded_p12 & (boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21))) & !(O(boarded_p13 & (boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22))) & !(O(boarded_p14 & (boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23))) & !(O(boarded_p15 & (boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24))) & !(O(boarded_p16 & (boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25))) & !(O(boarded_p17 & (boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26))) & !(O(boarded_p18 & (boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27))) & !(O(boarded_p19 & (boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28))) & !(O(boarded_p20 & (boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0))) & !(O(boarded_p21 & (boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1))) & !(O(boarded_p22 & (boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2))) & !(O(boarded_p23 & (boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3))) & !(O(boarded_p24 & (boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4))) & !(O(boarded_p25 & (boarded_p26 | boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5))) & !(O(boarded_p26 & (boarded_p27 | boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6))) & !(O(boarded_p27 & (boarded_p28 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7))) & !(O(boarded_p28 & (boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8)))", | ||
"s30-0": "O(served_p15 & served_p16 & served_p17 & served_p18 & served_p19 & served_p20 & served_p21 & served_p22 & served_p23 & served_p24 & served_p25 & served_p26 & served_p27 & served_p28 & served_p29) & O(served_p0 & served_p1 & served_p2 & served_p3 & served_p4 & served_p5 & served_p6 & served_p7 & served_p8 & served_p9 & served_p10 & served_p11 & served_p12 & served_p13 & served_p14 & !(Y(O(served_p15 | served_p16 | served_p17 | served_p18 | served_p19 | served_p20 | served_p21 | served_p22 | served_p23 | served_p24 | served_p25 | served_p26 | served_p27 | served_p28 | served_p29)))) & !(O(boarded_p0 & (boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10))) & !(O(boarded_p1 & (boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11))) & !(O(boarded_p2 & (boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12))) & !(O(boarded_p3 & (boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13))) & !(O(boarded_p4 & (boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14))) & !(O(boarded_p5 & (boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15))) & !(O(boarded_p6 & (boarded_p7 | boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16))) & !(O(boarded_p7 & (boarded_p8 | boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17))) & !(O(boarded_p8 & (boarded_p9 | boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18))) & !(O(boarded_p9 & (boarded_p10 | boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19))) & !(O(boarded_p10 & (boarded_p11 | boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20))) & !(O(boarded_p11 & (boarded_p12 | boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21))) & !(O(boarded_p12 & (boarded_p13 | boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22))) & !(O(boarded_p13 & (boarded_p14 | boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23))) & !(O(boarded_p14 & (boarded_p15 | boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24))) & !(O(boarded_p15 & (boarded_p16 | boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25))) & !(O(boarded_p16 & (boarded_p17 | boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26))) & !(O(boarded_p17 & (boarded_p18 | boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27))) & !(O(boarded_p18 & (boarded_p19 | boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28))) & !(O(boarded_p19 & (boarded_p20 | boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29))) & !(O(boarded_p20 & (boarded_p21 | boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0))) & !(O(boarded_p21 & (boarded_p22 | boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1))) & !(O(boarded_p22 & (boarded_p23 | boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2))) & !(O(boarded_p23 & (boarded_p24 | boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3))) & !(O(boarded_p24 & (boarded_p25 | boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4))) & !(O(boarded_p25 & (boarded_p26 | boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5))) & !(O(boarded_p26 & (boarded_p27 | boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6))) & !(O(boarded_p27 & (boarded_p28 | boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7))) & !(O(boarded_p28 & (boarded_p29 | boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8))) & !(O(boarded_p29 & (boarded_p0 | boarded_p1 | boarded_p2 | boarded_p3 | boarded_p4 | boarded_p5 | boarded_p6 | boarded_p7 | boarded_p8 | boarded_p9)))" | ||
"s2-0": "O(\"served p1\") & O(\"served p0\" & !(Y(O(\"served p1\"))))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now formulas look like this...
in JSON we cannot use '
to wrap strings; therefore, escaping "
is the only way to specify the temporal goal.
Alternative considered: add parenthesis: Pros: more adherence to PDDL format; |
bac485a
to
0d19b23
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #262 +/- ##
==========================================
- Coverage 89.79% 88.84% -0.96%
==========================================
Files 12 11 -1
Lines 549 484 -65
==========================================
- Hits 493 430 -63
+ Misses 56 54 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Consider the formula:
We get the following derived predicates:
The derived predicate Idea: replace
Which is quite verbose, but now the two conflicting derived predicates now have distinct names:
Of course other alternatives than |
After this commit, there is no need to provide an explicit mapping, since it is assumed that the propositions *are* the ground fluents. E.g. if previously the formula was specified as follows: formula = "on_b_a & O(ontable_c)" Now we require that the propositions can be interpreted as PDDL predicates, i.e.: formula = '"on b a" & O("ontable c")' Pylogics does not allow spaces in the proposition name; therefore, the double quotes are always required. Only exception is when the predicate is unary: formula = 'Y(O(made-p4)))' (as in openstacks).
We now check if the prefix 'val' is in the atom name. This is because after the compilation there might be conflicts in the val predicate names. Consider the following example: '"p a b" & val-p-a-b' The formula is compiled as follows: "p a b" -> 'val-p-a-b' (:derived (val-p-a-b) (p a b)) ^ ^ derived-predicate condition (ground fluent, predicate name 'p', constants 'a' and 'b') "val-p-a-b" -> 'val-val-p-a-b' (:derived (val-val-p-a-b) (val-p-a-b)) ^ ^ derived-predicate condition (ground fluent, predicate name 'p-a-b', no constants The prefix is changed to `val__` to make the prefix less probable to occur in an atom name.
5704f6f
to
74a8cf6
Compare
An even simpler formula is:
Again, |
74a8cf6
to
c891195
Compare
Copying from c891195: with this change, we translate each formula special symbols (operator symbols, parenthesis etc.) into a sequence of characters that can be part of a valid derived predicate name. This means that, given a name of a derived predicate, one can simply do the inverse replacement and recover the original formula. This approach has two major drawbacks:
This policy might be more conservative than needed, but in this way we should have the guarantee that the encoding is an invertible mapping (such property basically proves non-ambiguity of the encoding, because it means there is a one-to-one relationship between 'string representation of pylogics formulas' and 'string representation encoded as PDDL predicate name'). |
with this change, we translate each formula special symbols (operator symbols, parenthesis etc.) into a sequence of characters that can be part of a valid derived predicate name. This means that, given a name of a derived predicate, one can simply do the inverse replacement and recover the original formula. This approach has two major drawbacks: 1) the output of the compiler is much more verbose; e.g. the formula 'Y(a)' gets translated into 'val__YLPAR__a__RPAR' 2) the new approach imposes restrictions on the allowed symbols in a PPLTL formula. E.g. symbols that start with 'VAL__' or 'Y__', or symbols that contain one of the following as substring: - "LPAR__" (left parenthesis) - "__RPAR" (right parenthesis) - "NOT__" (not symbol) - "__AND__" (and symbol) - "__OR__" (or symbol) - "__QUOTE__" (quote) are forbidden. This policy might be more conservative than needed, but in this way we should have the guarantee that the encoding is an invertible mapping (such property basically proves non-ambiguity of the encoding, because it means there is a one-to-one relationship between 'string representation of pylogics formulas' and 'string representation encoded as PDDL predicate name').
c891195
to
838f43c
Compare
Regarding the collision between "Val" (and "Y") PDDL predicates corresponding to different PPLTL subformulas, I think it is a good idea to use unique identifiers for these atoms. Other examples:
|
Proposed changes
After this commit, to specify the PPLTL formula, there is no need to provide an explicit mapping, since it is assumed that the propositions are the ground fluents.
E.g. if previously the formula was specified as follows:
formula = "on_b_a & O(ontable_c)"
Now we require that the propositions can be interpreted as PDDL predicates, i.e.:
formula = '"on b a" & O("ontable c")'
Pylogics does not allow spaces in the proposition name; therefore, the double quotes are always required.
Only exception is when the predicate is unary:
formula = 'Y(O(made-p4)))'
(as in openstacks).
@LBonassi95 @francescofuggitti I would like to make a thorough discussion with you on this PR since it changes quite a few things.
Fixes
n/a
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply.develop
branch (left side). Also, you should start your branch off ourdevelop
.Further comments
n/a