Skip to content

Instantly share code, notes, and snippets.

@rpgoldman
Created September 1, 2023 00:45
Show Gist options
  • Save rpgoldman/b3bb1f71756e77cc6f324a4f39cbdf07 to your computer and use it in GitHub Desktop.
Save rpgoldman/b3bb1f71756e77cc6f324a4f39cbdf07 to your computer and use it in GitHub Desktop.
Inputs causing Panda HDDL parser to run forever (?)
(define (domain satellite)
(:requirements :equality :typing :conditional-effects :negative-preconditions
:universal-preconditions :htn-method-prec)
(:types satellite direction instrument mode)
(:predicates
(on_board ?i - instrument ?s - satellite)
(supports ?i - instrument ?m - mode)
(pointing ?s - satellite ?d - direction)
(power_avail ?s - satellite)
(power_on ?i - instrument)
(calibrated ?i - instrument)
(have_image ?d - direction ?m - mode)
(calibration_target ?i - instrument ?d - direction)
;; translating goals to tasks
(goal_have_image ?d - direction ?m - mode)
(goal_pointing ?s - satellite ?d - direction))
(:task main)
(:task have-image :parameters (?d - direction ?m - mode))
(:task take-image :parameters (?s - satellite ?i - instrument ?d - direction ?m - mode))
(:task prepare-instrument :parameters (?s - satellite ?i - instrument))
(:task turn-on-instrument :parameters (?s - satellite ?i - instrument))
(:task calibrate-instrument :parameters (?s - satellite ?i - instrument))
(:action turn_to
:parameters (?s - satellite ?d_new - direction ?d_prev - direction)
:precondition (and (pointing ?s ?d_prev)
(not (= ?d_new ?d_prev))
)
:effect (and (pointing ?s ?d_new)
(not (pointing ?s ?d_prev))
)
)
(:action switch_on
:parameters (?i - instrument ?s - satellite)
:precondition (and (on_board ?i ?s)
(power_avail ?s)
)
:effect (and (power_on ?i)
(when (calibrated ?i) (not (calibrated ?i)))
(not (power_avail ?s))
)
)
(:action switch_off
:parameters (?i - instrument ?s - satellite)
:precondition (and (on_board ?i ?s)
(power_on ?i)
)
:effect (and (not (power_on ?i))
(power_avail ?s)
)
)
(:action calibrate
:parameters (?s - satellite ?i - instrument ?d - direction)
:precondition (and (on_board ?i ?s)
(calibration_target ?i ?d)
(pointing ?s ?d)
(power_on ?i)
)
:effect (calibrated ?i)
)
(:action take_image
:parameters (?s - satellite ?d - direction ?i - instrument ?m - mode)
:precondition (and (calibrated ?i)
(on_board ?i ?s)
(supports ?i ?m)
(power_on ?i)
(pointing ?s ?d)
(power_on ?i)
)
:effect (when (not (have_image ?d ?m)) (have_image ?d ?m))
)
(:method take-one
:parameters (?d - direction ?m - mode)
:task (main)
:precondition (and
(goal_have_image ?d ?m)
(not (have_image ?d ?m)))
:ordered-subtasks
(and
(have-image ?d ?m)
(main)))
(:method turn-first
:parameters (?s - satellite ?d ?d1 - direction)
:task (main)
:precondition
(and
(goal_pointing ?s ?d)
(pointing ?s ?d1)
(not (= ?d ?d1)))
:ordered-subtasks
(and (turn_to ?s ?d ?d1)
(main)))
(:method all-done
:parameters ()
:task (main)
:precondition
(and (forall (?d - direction ?m - mode)
(imply (goal_have_image ?d ?m)
(have_image ?d ?m)))
(forall (?s - satellite ?d - direction)
(imply
(goal-pointing ?s ?d)
(pointing ?s ?d))))
:ordered-subtasks ())
(:method prepare-then-take
:parameters (?d - direction ?m - mode ?i - instrument ?s - satellite)
:task (have-image ?d ?m)
:precondition
(on_board ?i ?s)
:ordered-subtasks
(and
(prepare-instrument ?s ?i)
(take-image ?s ?i ?d ?m)))
(:method prepare
:parameters (?i - instrument ?s - satellite)
:task (prepare-instrument ?s ?i)
:ordered-subtasks
(and (turn-on-instrument ?s ?i)
(calibrate-instrument ?s ?i)))
(:method already-on
:parameters (?i - instrument ?s - satellite)
:task (turn-on-instrument ?s ?i)
:precondition
(power_on ?i)
:ordered-subtasks
())
(:method turn-on
:parameters (?i - instrument ?s - satellite)
:task (turn-on-instrument ?s ?i)
:precondition
(power_avail ?s)
:ordered-subtasks
(switch_on ?i ?s))
(:method swap-instruments
:parameters (?i ?j - instrument ?s - satellite)
:task (turn-on-instrument ?s ?i)
:precondition (and (power_on ?j)
(not (= ?i ?j)))
:ordered-subtasks
(and (switch_off ?j ?s)
(switch_on ?i ?s)))
(:method no-calibration-needed
:parameters (?i - instrument ?s - satellite)
:task (calibrate-instrument ?s ?i)
:precondition
(and (power_on ?i)
(calibrated ?i))
:ordered-subtasks ())
(:method do-calibrate
:parameters (?i - instrument ?s - satellite ?d - direction)
:task (calibrate-instrument ?s ?i)
:precondition
(and
(power_on ?i)
(pointing ?s ?d)
(calibration_target ?i ?d))
:ordered-subtasks (calibrate ?s ?i ?d))
(:method repoint-then-calibrate
:parameters (?i - instrument ?s - satellite ?d ?d2 - direction)
:task (calibrate-instrument ?s ?i)
:precondition
(and (pointing ?s ?d2)
(calibration_target ?i ?d)
(not (= ?d ?d2)))
:ordered-subtasks (and (turn_to ?s ?d ?d2)
(calibrate ?s ?i ?d)))
(:method turn-then-take
:parameters (?s - satellite ?i - instrument ?d ?d-prev - direction ?m - mode)
:task (take-image ?s ?i ?d ?m)
:precondition
(and
(pointing ?s ?d-prev)
(different ?d-prev ?d))
:ordered-subtasks
(and (turn_to ?s ?d ?d-prev)
(take-image ?s ?d ?i ?m))))
(define (problem strips-sat-x-1)
(:domain satellite)
(:objects
satellite0 - satellite
instrument0 - instrument
image1 - mode
spectrograph2 - mode
thermograph0 - mode
Star0 - direction
GroundStation1 - direction
GroundStation2 - direction
Phenomenon3 - direction
Phenomenon4 - direction
Star5 - direction
Phenomenon6 - direction)
(:htn :ordered-subtasks (main))
(:init
(supports instrument0 thermograph0)
(calibration_target instrument0 GroundStation2)
(on_board instrument0 satellite0)
(power_avail satellite0)
(pointing satellite0 Phenomenon6)
(goal_have_image Phenomenon4 thermograph0)
(goal_have_image Star5 thermograph0)
(goal_have_image Phenomenon6 thermograph0)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment