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

Negation ("not") reported as an unknown token #7

Open
ivan-gavran opened this issue Nov 30, 2020 · 1 comment
Open

Negation ("not") reported as an unknown token #7

ivan-gavran opened this issue Nov 30, 2020 · 1 comment

Comments

@ivan-gavran
Copy link

Hi,

I was experimenting with the Automated Programming Framework, and I ran into the following problem: when the goal contains a negated predicate, the parser throws an UnknownToken exception.

The issue can be reproduced by running ./examples/parser/parser.bin domain.pddl problem.pddl where the domain and the problem are similar to the ones in the issue from a couple of days ago. Concretely,
domain:

(define (domain test-domain)
(:requirements :typing :action-costs :equality :adl)
(:types coordinate - integer)
(:predicates
(robot-at ?x ?y - coordinate)
(succ ?x ?y - coordinate)
(marked ?x ?y - coordinate )
)
(:functions (total-cost) - number)

(:action move
:parameters (?x1 ?y1 ?x2 ?y2 - coordinate)
:precondition (and (robot-at ?x1 ?y1) (succ ?x1 ?x2) (= ?y1 ?y2))
:effect (and (robot-at ?x2 ?y2) (not (robot-at ?x1 ?y1)) (increase (total-cost) 1)))

(:action mark
:parameters
(?x1 ?y1 - coordinate)
:precondition
(and
(robot-at ?x1 ?y1)
)
:effect
(and
(marked ?x1 ?y1)
)
)

(:action un-mark
:parameters (?x1 ?y1 - coordinate)
:precondition
(and
(robot-at ?x1 ?y1)
(marked ?x1 ?y1)
)
:effect
(and
(not (marked ?x1 ?y1))
)
)
)

Problem:

(define
(problem
test_problem
)
(:domain
test-domain
)
(:objects
x1 - coordinate
x2 - coordinate
x3 - coordinate
x4 - coordinate
x5 - coordinate
y1 - coordinate
)
(:init
(robot-at x1 y1)
(marked x5 y1)
(succ x1 x2)
(succ x2 x3)
(succ x3 x4)
(succ x4 x5)
(= (total-cost) 0)
)
(:goal
(and
(robot-at x5 y1)
(not (marked x5 y1))
)
)
(:metric minimize (total-cost))
)

@jsego
Copy link
Member

jsego commented Dec 1, 2020

Hi @Gergia ,

This parser do not consider negative goals, but it is true this should be included at some point.

A workaround for you would be to double the number of predicates, e.g. p and not-p, and be consistent with your actions / initial and goal state .

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

No branches or pull requests

2 participants