Graphplan找不到计划

Graphplan找不到计划

本文介绍了PDDL Graphplan找不到计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在PDDL中编写了一个域和测试问题,但是显然graphplan实现找不到计划.这是域:

I've written a domain and a test problem in PDDL, but apparently the graphplan implementation can't find a plan. Here's the domain:

(define (domain aperture)
    (:requirements :strips :typing :negative-preconditions)
    (:types
        cube
        hallway room - location
        )
    (:predicates
        (at ?l - location)
        (has ?c - cube)
        (connected ?l1 - location ?l2 - location)
        (in ?c - cube ?l - location)
        )
    (:action enter
        :parameters (?h - hallway ?r - room)
        :precondition (and (connected ?h ?r) (connected ?r ?h) (at ?h)
                        (not (at ?r)))
        :effect (and (at ?r) (not (at ?h)))
        )
    (:action exit
        :parameters (?r - room ?h - hallway)
        :precondition (and (connected ?r ?h) (connected ?h ?r) (at ?r)
                        (not (at ?h)))
        :effect (and (at ?h) (not (at ?r)))
        )
    (:action move
        :parameters (?h1 ?h2 - hallway)
        :precondition (and (connected ?h1 ?h2) (connected ?h2 ?h1)
                           (at ?h1) (not (at ?h2)))
        :effect (and (at ?h2) (not (at ?h1)))
        )
    (:action pickup
        :parameters (?c - cube ?l - location)
        :precondition (and (at ?l) (not (has ?c)) (in ?c ?l))
        :effect (and (has ?c) (not (in ?c ?l)))
        )
    (:action drop
        :parameters (?c - cube ?l - location)
        :precondition (and (at ?l) (has ?c) (not (in ?c ?l)))
        :effect (and (not (has ?c)) (in ?c ?l))
        )
)

这是问题所在:

(define (problem pb1)
  (:domain aperture)
  (:requirements :strips :typing)
  (:objects h1 - hallway
        h2 - hallway
        h3 - hallway
        r1 - room
        c1 - cube)
  (:init (at h1)
     (connected h1 h2)
     (connected h2 h1)
     (connected h2 h3)
     (connected h3 h2)
     (connected h2 r1)
     (connected r1 h2)
     (in c1 r1)
     )
  (:goal (and
      (has c1)
      )
    )
)

对于此特定问题,解决方案的状态集应为:

For this particular problem the set of states for the solution should be:

move(h1,h2)
enter(h2,r1)
pickup(c1,r1)

但是,正如我所说的,我正在使用的graphplan实现( graphplan )找不到任何计划.

but, as I've said, the graphplan implementation that I'm using (graphplan) can't find any plan.

推荐答案

我能够使用 strips找到解决方案.但是,我不得不稍微调整一下您的域.具体来说,我更改了域操作提取"和放置",将参数类型位置"替换为房间".通过此更改,我能够找到以下解决方案:

I was able to find a solution plan using strips. However, I had to tweak your domain slightly. Specifically, I changed the domain actions "pickup" and "drop" to replace the parameter type "location" with "room". With this change, I was able to find the following solution:

1. move h1 h2
2. enter h2 r1
3. pickup c1 r1

也许这可能是graphplan也无法找到解决方案的原因?这是修改后的域和问题pddl文件.

Maybe this could be the reason graphplan was unable to find a solution as well? Here are the modified domain and problem pddl files.

domain.pddl

domain.pddl

(define (domain aperture)
    (:requirements :strips :typing :negative-preconditions)
    (:types
        cube
        hallway room - location
        )
    (:action enter
        :parameters (?h - hallway ?r - room)
        :precondition (and (connected ?h ?r) (connected ?r ?h) (at ?h)
                        (not (at ?r)))
        :effect (and (at ?r) (not (at ?h)))
        )
    (:action exit
        :parameters (?r - room ?h - hallway)
        :precondition (and (connected ?r ?h) (connected ?h ?r) (at ?r)
                        (not (at ?h)))
        :effect (and (at ?h) (not (at ?r)))
        )
    (:action move
        :parameters (?h1  - hallway ?h2 - hallway)
        :precondition (and (connected ?h1 ?h2) (connected ?h2 ?h1)
                           (at ?h1) (not (at ?h2)))
        :effect (and (at ?h2) (not (at ?h1)))
        )
    (:action pickup
        :parameters (?c - cube ?l - room)
        :precondition (and (at ?l) (not (has ?c)) (in ?c ?l))
        :effect (and (has ?c) (not (in ?c ?l)))
        )
    (:action drop
        :parameters (?c - cube ?l - room)
        :precondition (and (at ?l) (has ?c) (not (in ?c ?l)))
        :effect (and (not (has ?c)) (in ?c ?l))
        )
)

problem.pddl

problem.pddl

(define (problem pb1)
  (:domain aperture)
  (:objects h1 - hallway
        h2 - hallway
        h3 - hallway
        r1 - room
        c1 - cube)
  (:init (at h1)
     (connected h1 h2)
     (connected h2 h1)
     (connected h2 h3)
     (connected h3 h2)
     (connected h2 r1)
     (connected r1 h2)
     (in c1 r1)
     )
  (:goal (and
      (has c1)
      )
    )
)

这篇关于PDDL Graphplan找不到计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:46