The solver says syntax error for this pddl problem, but I can't find any. What's gone wrong here?

608 views Asked by At

I have tried to get this problem to solve itself. The solver keeps saying that there is a syntax error on line 36. I have checked many times. I don't see any syntax error. I ave tried introducing typing but still, the same error was produced. Now I am completely out of clues. I am very new to PDDL. Please let me know if anyone sees the issue here.

Thank You.

This is the domain.pddl:

(define (domain domain4)
(:requirements
    :strips 
    :equality
)

(:predicates
    (robot ?r)
    (alarm ?a)
    (trap ?t)
    (location ?x ?l)
    (alarmOn ?a)
    (trapSet ?t)
    (path ?x ?y)
)

(:action move_robot
    :parameters
        (?r ?l1 ?l2)
    :precondition
        (and
            (robot ?r)
            (path ?l1, ?l2)
            (location ?r ?l1)
        )
    :effect
        (and
            (not (location ?r ?l1))
            (location ?r ?l2)
        )
)


(:action turn_on_alarm
    :parameters
        (?r ?a ?l)
    :precondition
        (and
            (alarm ?a)
            (robot ?r)
            (location ?a ?l)
            (location ?r ?l)
        )
    :effect
        (alarmOn ?a)
)


(:action set_trap
    :parameters
        (?r1 ?r2 ?t ?l)
    :precondition
        (and
            (not (= ?r1 ?r2))
            (trap ?t)
            (robot ?r1)
            (robot ?r2)
            (location ?t ?l)
            (location ?r1 ?l)
            (location ?r2 ?l)
        )
    :effect
        (trapSet ?t)
)
)

And this is the problem.pddl:

(define (problem problem4)
(:domain domain4)

(:objects
    room1
    room2
    room3

    robot1
    robot2
  
    alarm1
    alarm2

    trap1
    trap2
)

(:init
    (robot robot1)
    (robot robot2)

    (alarm alarm1)
    (alarm alarm2)

    (trap trap1)
    (trap trap2)

    (location robot1 room1)
    (location robot2 room1)

    (location alarm1 room1)
    (location alarm2 room2)
    (location trap1  room2)
    (location trap2  room3)

    (path room1 room2)
    (path room2 room3)
    (path room3 room1)
)

(:goal
    (and
        (alarmOn alarm1)
        (alarmOn alarm2)
        (trapSet trap1)
        (trapSet trap2)
    )
)
)
1

There are 1 answers

1
Gregor Behnke On

The problem in in the domain. Although the parser tells you it is in line 36, it really is not -- the parser just gets stuck there due to an earlier error.

The true problem is in line 19:

(path ?l1, ?l2)

The comma is wrong. If you remove it, everything works out fine.