aig-upf / tarski

Tarski - An AI Planning Modeling Framework
Apache License 2.0
61 stars 20 forks source link

Error in processing negated preconditions #73

Closed anubhav-cs closed 5 years ago

anubhav-cs commented 5 years ago

Faced following issue while running some tests on openstacks ipc benchmark problem.

Error in method LPGroundingStrategy._solve_lp:-

  1. When negated atoms in action preconditions, for example precondition (not (made ?p)) in setup-machine action causes an error /tmp/tmp6_w8s8li:676:62-63: error: syntax error, unexpected (.
  2. The content of file tmp6_w8s8li at line 676 is move(Curpos, Nextpos) :- place(Curpos), place(Nextpos), -None(Curpos), connected(Curpos, Nextpos).
Suggested Fix-

Issue seems to be arising from line number 200 in reachability/asp.py, the negated value is None in negated = "-{}".format(negated). Hence, a LPAtom with symbol = -None is getting created. Changing the line to negated = "-{}".format(atom.symbol) seems to be the fix here. Requesting a review.

gfrances commented 5 years ago

Thanks @anubhav-cs. Could you please tell us what test or code exactly are you running, so that I can reproduce the bug?

anubhav-cs commented 5 years ago

Full script is here:- test.py

  1. I ran the test on a modified domain with the two (forall ...) preconditions removed. It still threw error because of (not (made ?p)) in precondition of action setup-machine.
anubhav-cs commented 5 years ago

@gfrances I had a query. How would tarski handle a negated precondition like (not (made ?p)). Currently, I get an error, where the file tmp5pun7pck shows that the rule for head - setup__machine(P, Avail) has a -None(P) lp-atom - the error occurs here. Should I be compiling away negated precondition before I call the grounder?

This can be reproduced by cloning tarski-test, and then executing test.py

gfrances commented 5 years ago

Yes, that appears to be a different issue, give me a couple of hours and I'll look into that as well. Thanks for the report again!

gfrances commented 5 years ago

Negated literals in preconditions and goal should no longer be a problem - they are now assumed to be true, as per Helmert, Concise finite-domain representations for PDDL planning tasks, Section 6.1.3. Let me close this issue and open a new one for the handling of universally-quantified preconditions, which indeed is yet not implemented.