/* Domain: objects are not equivalent, some of them (frozen) are to be
taken as late as possible.
*/
(define (domain briefcase)
(:requirements :typing )
(:types normal frozen - obj)
(:fluents (atRobby ?x - loc)
(at ?x - obj ?l -loc)
(in ?x - obj) )
(:static (normal ?x - obj)(frozen ?x - obj))
(:constants (home - loc))
(:theory (forall (?x - frozen)(frozen ?x))
(forall (?x - normal)(normal ?x)))
(:action go
:parameters (?from ?to - loc)
:precondition (atRobby ?from)
:effect (atRobby ?to) (not(atRobby ?from))
:only-if ; either go to the robot's destination
; or go to a place where an object can be taken
; or dropped
(or (exists (?x - obj)
(and (initially (at ?x ?to))(at ?x ?to)))
(exists (?x - obj)
(and (goal (at ?x ?to))(in ?x)))
(goal (atRobby ?to)) )
; move from home or from a place where initially
; there is something or something has to be dropped
(or (exists (?x - obj)(initially (at ?x ?from)))
(exists (?x - obj)(goal(at ?x ?from)))
(initially (atRobby ?from)))
:next ; either do something in the place where you get
; or there is nothing left to do
(or
(exists (?x - obj)
(or (take ?x ?to)(drop ?x ?to)))
(forall (?x - obj ?y -loc)
(implies (goal(at ?x ?y)) (at ?x ?y)))) )
(:action take
:parameters (?x - obj ?room - loc)
:precondition (atRobby ?room)(at ?x ?room)
:effect (in ?x)(not(at ?x ?room))
:only-if (initially(at ?x ?room)) (not(goal(at ?x ?room)))
; if x is normal, then
; there are no frozen objects in the briefcase
(implies (normal ?x)
(or (exists (?y - frozen)(take ?y ?room))
(forall (?y - frozen)(not(in ?y)))))
:s-asap )
(:action drop
:parameters (?x - obj ?room -loc)
:precondition (in ?x)(atRobby ?room)
:effect (not(in ?x)) (at ?x ?room)
:only-if (goal(at ?x ?room))
; drop all objects together in the room
; i.e. do not go, take, drop here several times
(forall (?y - obj)
(implies(goal(at ?y ?room))(in ?y)))
:s-asap )
)