Skip to content
Snippets Groups Projects
Commit 288ed55b authored by GATEAU Thibault's avatar GATEAU Thibault
Browse files

[hddl] adding example

parent d6db12f4
Branches
No related tags found
No related merge requests found
(define (domain cooking)
(:requirements :typing)
(:types
location - object
ingredient - object
agent - object
)
(:predicates
(at ?a - agent ?x - location)
(isIdle ?a - agent)
(isChoppedOnion ?i - ingredient)
(isChopLoc ?l - location)
(isOnion ?i - ingredient)
(isCookLoc ?l - location)
(recipie ?o1 ?o2 ?o3 ?s - ingredient)
(recipie ?o ?co - ingredient)
(deliveryloc ?l - location)
(isReadyToServe ?i - ingredient)
(isServed ?i - ingredient)
(isActive ?a - agent)
(notenoughingredients)
)
(:task goto
:parameters (?a - agent ?l - location)
)
(:task deliver_foods
:parameters (?a - agent)
)
(:task deliver_food
:parameters (?a - agent)
)
(:task cookrecipe
:parameters (?a - agent)
)
(:task deliver_ingredient
:parameters (?i - ingredient ?l - location)
)
(:task prepare_ingredients
:parameters (?i - ingredient)
)
(:task prepare_ingredient
:parameters (?i - ingredient)
)
(:method m_deliver_food_ready
:parameters (?a - agent ?l - location ?i - ingredient)
:task (deliver_food ?a)
:precondition (and
(deliveryloc ?l)
(isReadyToServe ?i)
)
:subtasks (and
(goto ?a ?l)
(serve ?a ?i ?l)
)
)
(:method m_deliver_food_stop
:parameters (?a - agent)
:task (deliver_food ?a)
:precondition (and
)
:subtasks (and
(stop ?a)
)
)
(:method m_deliver_foods_notAnyFood
:parameters (?a - agent ?l - location)
:task (deliver_foods ?a)
:precondition (and
(not-enough-ingredients)
(at ?a ?l)
)
:subtasks (and
(idle ?a ?l) ;; can be removed
)
)
(:method m_deliver_foods_loop
:parameters (?a - agent)
:task (deliver_foods ?a)
:precondition (and
(isActive ?a)
)
:subtasks (and
(deliver_food ?a)
(deliver_foods ?a)
;;(deliver_food ?a)
;;(deliver_food ?a)
;;(deliver_food ?a)
;;(deliver_food ?a)
)
)
(:method m_goto_already_there
:parameters (?a - agent ?l - location)
:task (goto ?a ?l)
:precondition (at ?a ?l)
:subtasks (and
(idle ?a ?l) ;; can be removed
)
)
(:method m_ingredient_there
:parameters (?i - ingredient ?l - location)
:task (deliver_ingredient ?i ?l)
:precondition (at ?i ?l)
:subtasks ()
)
;;====== ACTIONS ===============================================
(:action idle
:parameters (?a - agent ?l - location)
:precondition (and
)
:effect (and (isIdle ?a))
)
(:action yes
:parameters ()
:precondition (and
)
:effect ()
)
(:action move
:parameters (?a - agent ?from ?to - location)
:precondition (and
(at ?a ?from)
)
:effect (and (not (at ?a ?from)) (at ?a ?to))
)
(:action pickup
:parameters (?a - agent ?i - ingredient ?l - location)
:precondition (and
(at ?i ?l)
(at ?a ?l)
)
:effect (and
(not (at ?i ?l))
(ingredient-pickedByAgent ?a ?i)
)
)
(:action drop
:parameters (?a - agent ?i - ingredient ?l - location)
:precondition (and
(ingredient-pickedByAgent ?a ?i)
(at ?a ?l)
)
:effect (and
(not (ingredient-pickedByAgent ?a ?i))
(at ?i ?l)
)
)
(:action stop
:parameters (?a - agent)
:precondition (and
)
:effect (and
(not-enough-ingredients)
(not (isActive ?a))
)
)
(:action chop
:parameters (?a - agent ?i - ingredient ?l - location)
:precondition (and
(at ?a ?l)
(at ?i ?l)
(isChopLoc ?l)
)
:effect (and
(isChoppedOnion ?i))
)
(:action cook
:parameters (?a - agent ?o1 ?o2 ?o3 ?s - ingredient ?l - location)
:precondition (and
(at ?a ?l)
(isCookLoc ?l)
(isChoppedOnion ?o1)
(isChoppedOnion ?o2)
(isChoppedOnion ?o3)
(at ?o1 ?l)
(at ?o2 ?l)
(at ?o3 ?l)
)
:effect (and
(not (isChoppedOnion ?o1))
(not (isChoppedOnion ?o2))
(not (isChoppedOnion ?o3))
(not (at ?o1 ?l))
(not (at ?o2 ?l))
(not (at ?o3 ?l))
(isReadyToServe ?s)
(at ?s ?l)
)
)
(:action serve
:parameters (?a - agent ?i - ingredient ?l - location)
:precondition (and
(at ?a ?l)
(deliveryloc ?l)
(isReadyToServe ?i)
)
:effect (and
(isServed ?i)
(not (isReadyToServe ?i))
)
)
(:action get_position
:parameters (?a - agent ?l - location)
:precondition (and
(at ?a ?l)
)
:effect (and
)
)
)
(define (problem cookSoup) (:domain cooking)
(:objects
centerloc choploc deliveryloc stockloc faraway cookLoc - location
a1 - agent
onion1 onion2 onion3 onion4 onion5 onion6 soup soupAlreadyReady soupFromRaw - ingredient
)
(:htn
;;:tasks (and (deliver_food a1)(deliver_food a1))
:tasks (and (deliver_foods a1))
:ordering ()
:constraints ()
)
(:init
(at a1 deliveryloc)
;(at a1 faraway)
(at onion1 cookLoc)
(at onion2 stockloc)
(at onion3 stockloc)
(at onion4 stockloc)
(at onion5 stockloc)
(at onion6 stockloc)
(isReadyToServe soupAlreadyReady)
(at soupAlreadyReady deliveryloc)
;(at soupAlreadyReady cookLoc)
(isChoppedOnion onion1)
(isChoppedOnion onion2)
(isChoppedOnion onion3)
(isChoppedOnion onion4)
(isChopLoc choploc)
(isCookLoc cookLoc)
(deliveryloc deliveryloc)
(connected centerloc cookLoc)
(connected cookLoc centerloc)
(connected centerloc choploc)
(connected choploc centerloc)
(connected centerloc stockloc)
(connected stockloc centerloc)
(connected centerloc deliveryloc)
(connected deliveryloc centerloc)
(connected deliveryloc faraway)
(connected faraway deliveryloc)
(recipie onion1 onion2 onion3 soup)
(recipie onion4 onion5 onion6 soupFromRaw)
(isActive a1)
;;(not-enough-ingredients)
)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment