PDDL Segmentation fault

135 Views Asked by At

I'm new in PDDL, I tried to replicate a basic example of my error

I did a basic domain to manage the activation/deactivation of a led, I declared a type for that

Domain:

(define (domain led_domain)
    (:requirements :strips :typing :negative-preconditions)

    (:types
        led - object
    )

    (:predicates
      (activated ?led - led)
    )

    (:action activate_led
        :parameters
            (?led - led)
        :precondition
            (not (activated ?led))
        :effect
            (activated ?led)
    )   


    (:action deactivate_led
        :parameters
            (?led - led)
        :precondition
            (activated ?led)
        :effect
            (not (activated ?led))
    )
)

Problem:

(define (problem led_problem)
    (:domain led_domain)
    
    (:objects
      led1 - led
    )
    
    (:init
      (not (activated led1))
    )
    
    (:goal
      (and
        (activated led1)
      )
    )
)

Error:

/app/plan: line 3: 19581 Segmentation fault timeout 10 "$(dirname "$0")"/siw-then-bfsf --domain $1 --problem $2 --output $3

I expect an output like:

(activate_led led1)

But if I change the problem to:

(define (problem led_problem)
    (:domain led_domain)
    
    (:objects
      led1 - led
    )
    
    (:init
      (activated led1)
    )
    
    (:goal
      (and
        (not (activated led1))
      )
    )
)   

I get the correct plan:

(deactivate_led led1)

Is there any step or any predicate wrong?

2

There are 2 best solutions below

0
Javier Sánchez On BEST ANSWER

Solution:

I read that we can't set something false, so I can write (deactivated ?led - led) predicate (like in this github comment)

Domain:

(define (domain led_domain)
    (:requirements :strips :typing :negative-preconditions)

    (:types
        led - object
    )

    (:predicates
      (activated ?led - led)
      (deactivated ?led - led)
    )

    (:action activate_led
        :parameters
            (?led - led)
        :precondition
            (deactivated ?led)
        :effect
            (and
                (activated ?led)
                (not (deactivated ?led))
            )

    )   

    (:action deactivate_led
        :parameters
            (?led - led)
        :precondition
            (activated ?led)
        :effect
            (and 
                (not (activated ?led))
                (deactivated ?led)
            )
    )
)

Problem1:

(define (problem led_problem)
    (:domain led_domain)

    (:objects
      led1 - led
    )

    (:init
      (deactivated led1)
    )

    (:goal
      (and
        (activated led1)
      )
    )
)

Problem2:

(define (problem led_problem)
    (:domain led_domain)

    (:objects
      led1 - led
    )

    (:init
      (activated led1)
    )

    (:goal
      (and
        (deactivated led1)
      )
    )
)

Hope this could help someone!!

1
Michael Katz On

:init specifies the list of facts (ground predicates) that are true in the initial state. All facts that are not mentioned in that list are assumed to be true. If you specify an empty list in the first example, it should work.