% DEFINITION OF DELIVERY ROBOT WORLD IN STRIPS NOTATION

% ACTIONS
% move(Ag,Pos,Pos_1) is the action of Ag moving from Pos to Pos_1
preconditions(move(Ag,Pos,Pos_1),
    autonomous(Ag) & adjacent(Pos,Pos_1) & sitting_at(Ag,Pos)).
addlist(move(Ag,Pos,Pos_1),[sitting_at(Ag,Pos_1)]).
deletelist(move(Ag,Pos,Pos_1),[sitting_at(Ag,Pos)]).

% pickup(Ag,Obj,Pos) is the action of agent Ag picking up Obj.
preconditions(pickup(Ag,Obj,Pos),
    autonomous(Ag) & Ag \= Obj & sitting_at(Obj,Pos) & at(Ag,Pos)).
addlist(pickup(Ag,Obj,Pos), [carrying(Ag,Obj)]).
deletelist(pickup(Ag,Obj,Pos), [sitting_at(Obj,Pos)]).

% putdown(Ag,Obj,Pos)
preconditions(putdown(Ag,Obj,Pos), 
    autonomous(Ag) &  Ag \= Obj &  at(Ag,Pos) & carrying(Ag,Obj)).
addlist(putdown(Ag,Obj,Pos),[sitting_at(Obj,Pos)]).
deletelist(putdown(Ag,Obj,Pos),[carrying(Ag,Obj)]).

% unlock(Ag,Door)
preconditions(unlock(Ag,Door),
    autonomous(Ag) & blocks(Door,P_1,_) & opens(Key,Door) &
        carrying(Ag,Key) & at(Ag,P_1)).
addlist(unlock(Ag,Door),[unlocked(Door)]).
deletelist(unlock(Ag,Door),[]).

% wet(Obj,B) is the action of wetting the Obj withthe water in bucket B
preconditions(wet(Obj,B),
    bucket(B) & autonomous(Ag) & full(B) & carrying(Ag,B) & at(Obj,Loc) & at(Ag,Loc)).
addlist(wet(Obj,B),[is_wet(Obj)]).
deletelist(wet(Obj,B),[full(B)]).

% fill(B) is the action of filling bucket B
preconditions(fill(B),
   bucket(B) & autonomous(Ag) & carrying(Ag,B) & at(Ag,o111)).
addlist(fill(B),[full(B)]).
deletelist(fill(B),[]).

% PRIMITIVE RELATIONS
primitive(carrying(_,_)).
primitive(sitting_at(_,_)).
primitive(unlocked(_)).
primitive(full(_)).
primitive(is_wet(_)).

% DERIVED RELATIONS

at(Obj,Pos) <= sitting_at(Obj,Pos).
at(Obj,Pos) <= autonomous(Ag) & Ag \= Obj & carrying(Ag,Obj) & at(Ag,Pos).

adjacent(o109,o103)<= true.
adjacent(o103,o109)<= true.
adjacent(o109,storage)<= true.
adjacent(storage,o109)<= true.
adjacent(o109,o111)<= true.
adjacent(o111,o109)<= true.
adjacent(o103,mail)<= true.
adjacent(mail,o103)<= true.
adjacent(lab2,o109)<= true.
adjacent(P_1,P_2) <= blocks(Door,P_1,P_2) & unlocked(Door).
blocks(door1,o103,lab2)<= true.
opens(k1,door1)<= true.
autonomous(rob)<= true.
bucket(b1) <= true.

% INITIAL SITUATION
holds(sitting_at(rob,o109),init).
holds(sitting_at(parcel,storage),init).
holds(sitting_at(k1,mail),init).
holds(sitting_at(b1,storage),init).

%%% load 'c:/david/teach/cs322/1999/Module10/strips_strips.pl'.
%%% load 'c:/david/teach/cs322/1999/Module10/delrob_strips.pl'.


