% Modifying the module to introduce sequences of elementary actions. %%%%%%%%%%%%%%%%% Trips %%%%%%%%%%%%%%%%% %%%%%%% Input Variables %%%%%% #domain location(L;L1;L2;L3). #domain position(Pos;Pos1;Pos2;Pos3). position(L). position(en_route). #domain trip(J;J1;J2;J3). #domain object(O;O1;O2;O3). object(J). % Trips are objects of this module. #domain step(S;S1;S2;S3). #domain action(A;A1;A2;A3). #domain sequence(Seq; Seq1; Seq2). #domain index(K;K1;K2;K3). #domain fluent(Fl;Fl1;Fl2;Fl3). %%%%%%%%%% Trip's actions, action sequences and fluents: action(depart(J)). actor(depart(J),J). action(stop(J,L)). actor(stop(J,L),J). sequence(go(J)). % trip J leaves its origin. fluent(at(J,Pos)). % Definition of the sequence go(J) atomic(depart(J)). atomic(stop(J,L)). s(depart(J),K2,go(J)) :- planned_stop(J,L,K), num_of_planned_stops(J,K1), K < K1, K2 = 2 * K + 1. s(stop(J,L),K2,go(J)) :- planned_stop(J,L,K), K2 = 2 * K. length(go(J),M) :- num_of_planned_stops(J,N), M = 2*N. %%%%%%%%%% Direct effects h(at(J,en_route),S+1) :- o(depart(J),S). h(at(J,L),S+1) :- o(stop(J,L),S). %%%%%%%%%% State constraints -h(at(O,Pos1),S) :- h(at(O,Pos2),S), neq(Pos1,Pos2). %%%%%%%%%% Executability conditions -o(depart(J),S) :- h(at(J,en_route),S). -o(stop(J,L),S) :- -h(at(J,en_route),S). -o(stop(J,L),S) :- o(stop(J,L1),S), neq(L,L1).