Skip to content
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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Jul 10, 2023

  1. fix: use simplified mapping

    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).
    marcofavorito committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    ff771ed View commit details
    Browse the repository at this point in the history
  2. fix: change prefix to val__; check no atom starts with it

    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.
    marcofavorito committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    1559f0e View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2023

  1. fix: make encoding of derived predicate invertible

    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').
    marcofavorito committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    838f43c View commit details
    Browse the repository at this point in the history