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

constant predicate in init error #4

Open
happysf128 opened this issue Feb 18, 2019 · 3 comments
Open

constant predicate in init error #4

happysf128 opened this issue Feb 18, 2019 · 3 comments

Comments

@happysf128
Copy link

happysf128 commented Feb 18, 2019

Although it does not make sense to have a constant predicate in the problem file (init:), it might be involved in debug your PDDL code.
Here is the issue:
Firstly, I define a predicate in the domain file, (start)
Then, put it in the problem file (:init (start)), and make sure there is no action can change it.
Then, here are the error message I got:
Problem domain: s_media_2 Problem instance: problem Working directory: /home/ghu1/Dropbox/fs/workspace/190218/s_media_2/problem Processing 1 action schemas Action schema "post" has arity 2 and 12 potential groundings 0/1 action schemas pruned for lack of groundings There is a total of 1.20E+01 potential ground actions Traceback (most recent call last): File "run.py", line 17, in <module> runner.main(sys.argv[1:]) File "/home/ghu1/Dropbox/fs/python/parser/runner.py", line 244, in main return run(parse_arguments(args)) File "/home/ghu1/Dropbox/fs/python/parser/runner.py", line 234, in run representation.generate() File "/home/ghu1/Dropbox/fs/python/parser/representation.py", line 41, in generate self.serialize_static_extensions() File "/home/ghu1/Dropbox/fs/python/parser/representation.py", line 62, in serialize_static_extensions serialized = elem.serialize_data(self.index.objects.data) File "/home/ghu1/Dropbox/fs/python/parser/static.py", line 138, in serialize_data return [serialize_symbol(self.elems[()], symbols)] # We simply print the only element File "/home/ghu1/Dropbox/fs/python/parser/static.py", line 33, in serialize_symbol serialized = symbol if python.utils.is_int(symbol) else table[symbol] File "/home/ghu1/Dropbox/fs/python/utils.py", line 62, in is_int int(s) TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

The issue get fixed by add a dummy action, that contains (start) as it effect, although this action will never appeared in any solution.

@gfrances
Copy link
Member

Thanks for the report, @happysf128 . Could you attach the domain and instance files so that we can reproduce the issue? Could you also paste the exact command you use to invoke the planner?

@guanghuhappysf128
Copy link

I have rewrite a simple example about what's wrong.
Here is the running command and error I got:

guang@guang-desktop:~/projects/code/fs$ python3 run.py --driver=smart --instance /home/guang/projects/code/benchmarks/modeling/test/problem.pddl


WARNING! Fixing PYTHONHASHSEED to 1 to obtain more reliable results


Problem domain: test Problem instance: problem Working directory: /home/guang/projects/code/fs/workspace/190222/test/problem Processing 2 action schemas Action schema "move-to-block" has arity 2 and 9 potential groundings Action schema "move-to-table" has arity 2 and 9 potential groundings 0/2 action schemas pruned for lack of groundings There is a total of 1.80E+01 potential ground actions Traceback (most recent call last): File "run.py", line 17, in <module> runner.main(sys.argv[1:]) File "/home/guang/projects/code/fs/python/parser/runner.py", line 222, in main return run(parse_arguments(args)) File "/home/guang/projects/code/fs/python/parser/runner.py", line 212, in run representation.generate() File "/home/guang/projects/code/fs/python/parser/representation.py", line 41, in generate self.serialize_static_extensions() File "/home/guang/projects/code/fs/python/parser/representation.py", line 58, in serialize_static_extensions serialized = elem.serialize_data(self.index.objects.data) File "/home/guang/projects/code/fs/python/parser/static.py", line 133, in serialize_data return [serialize_symbol(self.elems[()], symbols)] # We simply print the only element File "/home/guang/projects/code/fs/python/parser/static.py", line 32, in serialize_symbol serialized = symbol if python.utils.is_int(symbol) else table[symbol] File "/home/guang/projects/code/fs/python/utils.py", line 62, in is_int int(s) TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

I am not sure how to attach files, here is a link to the problem file and domain file:
If you comment out the (start) from the problem file (:init), then the planner would work.

@guanghuhappysf128
Copy link

Hi, I had another look on the problem. It looks like the parser treats special predicates (for example (test) as test()), then used () as its arguments. I tried to add "()" into the variable index table, it fixed this problem, but the planner cannot find solution anymore.
PS. The special predicates need to meet three criteria:

  1. It does not have any arguments
  2. It does not appear in any action effects
  3. It is in the init from the problem.pddl

Currently, my quick fix on this issue is to create a dummy action in the domain.pddl to put all those special predicates as effects. It would not affect the planning results, and it get around the problem (those predicates will not be treated as constants anymore).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants