0

我试图让这个问题自行解决。求解器一直说第 36 行有语法错误。我检查了很多次。我没有看到任何语法错误。我试过引入打字,但仍然产生了同样的错误。现在我完全没有线索了。我对 PDDL 很陌生。如果有人在这里看到这个问题,请告诉我。

谢谢你。

这是 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)
)
)

这就是问题.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)
    )
)
)
4

1 回答 1

0

域中的问题。尽管解析器告诉您它在第 36 行,但实际上并非如此——解析器只是由于较早的错误而卡在那里。

真正的问题在第 19 行:

(path ?l1, ?l2)

逗号是错误的。如果删除它,一切正常。

于 2020-10-12T15:59:09.363 回答