%%%%%%%%%%%%Begin auxiliary predicates time(1..length). path(1..level). literal(F):- fluent(F). literal(neg(F)):- fluent(F). contrary(F, neg(F)):- fluent(F). contrary(neg(F), F):- fluent(F). new_branch(L, L1):- path(L), path(L1), L < L1. h(F, T+1, P1):- path(P), time(T), path(P1), P <= P1, sense(F), branch(F, T, P, P1). used(T+1, P1):- path(P), time(T), path(P1), P <= P1, sense(F), branch(F, T, P, P1). :- path(L), time(T), fluent(F), action(A), determines(A, F), occ(A, T, L), known(F, T, L). h(G, T+1, L1):- time(T), path(L1), path(L), literal(G), sense(F), L <= L1, branch(F, T, L, L1), h(G, T, L). unknown(F, T, L):- path(L), time(T), fluent(F), not known(F, T, L). known(F, T, L):- path(L), time(T), fluent(F), h(F, T, L). known(F, T, L):- path(L), time(T), fluent(F), contrary(F, G), h(G, T, L). used(1, 1). used(T+1, L):- time(T), path(L), used(T, L). 1{occ(A, T, P) : action(A)}1:- time(T), path(P), used(T, P), not goal(T, P). :- time(T), path(P), used(T, P), action(A), occ(A,T,P), not possible(A, T, P). %%%%% End auxiliary section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Domain Description %%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Fluents %%%% fluent(infected(1)). fluent(infected(2)). fluent(infected(3)). fluent(infected(4)). fluent(infected(5)). fluent(infected(none)). fluent(tcd). fluent(bsd). fluent(hc). fluent(dead). fluent(is_color(red)). fluent(is_color(blue)). fluent(is_color(white)). %%% End of Fluents %%% % non-inertial literals noninertial(armed). noninertial(neg(armed)). %%% Actions %%%% action(inspect). action(stain). action(blood_sample). action(analyze_blood). action(medicate(1)). action(medicate(2)). action(medicate(3)). action(medicate(4)). action(medicate(5)). %%% End of Actions %%% %%% Section: static causal laws %%%% h(neg(infected(1)), T, P):- time(T), path(P), h(is_color(blue), T, P), h(tcd, T, P). h(neg(infected(2)), T, P):- time(T), path(P), h(is_color(blue), T, P), h(tcd, T, P). h(neg(infected(5)), T, P):- time(T), path(P), h(is_color(blue), T, P), h(tcd, T, P). h(neg(infected(5)), T, P):- time(T), path(P), h(is_color(red), T, P), h(tcd, T, P). h(neg(infected(3)), T, P):- time(T), path(P), h(is_color(red), T, P), h(tcd, T, P). h(neg(infected(4)), T, P):- time(T), path(P), h(is_color(red), T, P), h(tcd, T, P). h(neg(infected(1)), T, P):- time(T), path(P), h(is_color(white), T, P), h(tcd, T, P). h(neg(infected(2)), T, P):- time(T), path(P), h(is_color(white), T, P), h(tcd, T, P). h(neg(infected(3)), T, P):- time(T), path(P), h(is_color(white), T, P), h(tcd, T, P). h(neg(infected(4)), T, P):- time(T), path(P), h(is_color(white), T, P), h(tcd, T, P). h(neg(infected(4)), T, P):- time(T), path(P), h(hc, T, P), h(bsd, T, P). h(neg(infected(2)), T, P):- time(T), path(P), h(hc, T, P), h(bsd, T, P). h(neg(infected(1)), T, P):- time(T), path(P), h(neg(hc), T, P), h(bsd, T, P). h(neg(infected(3)), T, P):- time(T), path(P), h(neg(hc), T, P), h(bsd, T, P). h(neg(infected(5)), T, P):- time(T), path(P), h(neg(hc), T, P), h(bsd, T, P). h(infected(1), T, P):- time(T), path(P), h(neg(infected(2)), T, P), h(neg(infected(3)), T, P), h(neg(infected(4)), T, P), h(neg(infected(5)), T, P), h(neg(infected(none)), T, P). h(infected(2), T, P):- time(T), path(P), h(neg(infected(1)), T, P), h(neg(infected(3)), T, P), h(neg(infected(4)), T, P), h(neg(infected(5)), T, P), h(neg(infected(none)), T, P). h(infected(3), T, P):- time(T), path(P), h(neg(infected(1)), T, P), h(neg(infected(2)), T, P), h(neg(infected(4)), T, P), h(neg(infected(5)), T, P), h(neg(infected(none)), T, P). h(infected(4), T, P):- time(T), path(P), h(neg(infected(1)), T, P), h(neg(infected(2)), T, P), h(neg(infected(3)), T, P), h(neg(infected(5)), T, P), h(neg(infected(none)), T, P). h(infected(5), T, P):- time(T), path(P), h(neg(infected(1)), T, P), h(neg(infected(2)), T, P), h(neg(infected(3)), T, P), h(neg(infected(4)), T, P), h(neg(infected(none)), T, P). h(infected(none), T, P):- time(T), path(P), h(neg(infected(1)), T, P), h(neg(infected(2)), T, P), h(neg(infected(3)), T, P), h(neg(infected(4)), T, P), h(neg(infected(5)), T, P). h(illness(3), T, P):- time(T), path(P), h(neg(illness(1)), T, P), h(neg(illness(2)), T, P). h(illness(2), T, P):- time(T), path(P), h(neg(illness(1)), T, P), h(neg(illness(3)), T, P). h(illness(1), T, P):- time(T), path(P), h(neg(illness(3)), T, P), h(neg(illness(2)), T, P). %%% End section: static causal laws %%%% %%% Section: dynamic causal laws %%%% h(tcd, T+1, P):- time(T), path(P), possible(stain, T, P), occ(stain,T,P). h(infected(none), T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(1), T, P). h(infected(none), T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(2), T, P). h(infected(none), T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(3), T, P). h(infected(none), T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(4), T, P). h(infected(none), T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(5), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(2), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(3), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(4), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(5), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(1), T, P), occ(medicate(1),T,P), h(infected(none), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(1), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(3), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(4), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(5), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(2), T, P), occ(medicate(2),T,P), h(infected(none), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(1), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(2), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(4), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(5), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(3), T, P), occ(medicate(3),T,P), h(infected(none), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(1), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(2), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(3), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(5), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(4), T, P), occ(medicate(4),T,P), h(infected(none), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(1), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(2), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(3), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(4), T, P). h(dead, T+1, P):- time(T), path(P), possible(medicate(5), T, P), occ(medicate(5),T,P), h(infected(none), T, P). h(bsd, T+1, P):- time(T), path(P), possible(blood_sample, T, P), occ(blood_sample,T,P). %%% End section: dynamic causal laws %%%% %%% Section: Executability Conditions %% possible(inspect, T, P):- time(T),path(P), h(tcd, T, P), h(neg(dead), T, P). possible(stain, T, P):- time(T),path(P), h(neg(dead), T, P). possible(blood_sample, T, P):- time(T),path(P), h(neg(dead), T, P). possible(analyze_blood, T, P):- time(T),path(P), h(bsd, T, P), h(neg(dead), T, P). possible(medicate(1), T, P):- time(T),path(P), h(neg(dead), T, P). possible(medicate(2), T, P):- time(T),path(P), h(neg(dead), T, P). possible(medicate(3), T, P):- time(T),path(P), h(neg(dead), T, P). possible(medicate(4), T, P):- time(T),path(P), h(neg(dead), T, P). possible(medicate(5), T, P):- time(T),path(P), h(neg(dead), T, P). %%% End of section: Executability Conditions %%%% %%% Section: Abnormality of fluent %% possibly_h(F, T, P):- literal(F), literal(G), contrary(F, G), time(T), path(P), not h(G, T, P). ab(neg(infected(none)), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(1), T, P). ab(neg(infected(none)), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(2), T, P). ab(neg(infected(none)), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(3), T, P). ab(neg(infected(none)), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(4), T, P). ab(neg(infected(none)), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(5), T, P). ab(neg(tcd), T, P):- time(T),path(P), occ(stain, T, P). ab(neg(bsd), T, P):- time(T),path(P), occ(blood_sample, T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(2), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(3), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(4), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(5), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(1), T, P), possibly_h(infected(none), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(1), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(3), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(4), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(5), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(2), T, P), possibly_h(infected(none), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(1), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(2), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(4), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(5), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(3), T, P), possibly_h(infected(none), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(1), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(2), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(3), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(5), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(4), T, P), possibly_h(infected(none), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(1), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(2), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(3), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(4), T, P). ab(neg(dead), T, P):- time(T),path(P), occ(medicate(5), T, P), possibly_h(infected(none), T, P). h(F, T+1, P):- literal(F), time(T), path(P), h(F, T, P), not noninertial(F), literal(G), contrary(F, G), not h(G, T+1, P), not ab(F, T, P). %%% End Section: Abnormality of fluent %% %%% Section: Sensing Actions %% sense(is_color(red)). sense(is_color(blue)). sense(is_color(white)). branch(is_color(red), T, P, P):- time(T), path(P), possible(inspect, T, P), occ(inspect, T, P). 1{branch(is_color(blue), T, P, P1):new_branch(P, P1)}1:- time(T), path(P), possible(inspect, T, P), occ(inspect, T, P). 1{branch(is_color(white), T, P, P1):new_branch(P, P1)}1:- time(T), path(P), possible(inspect, T, P), occ(inspect, T, P). sense(hc). sense(neg(hc)). branch(hc, T, P, P):- time(T), path(P), possible(analyze_blood, T, P), occ(analyze_blood, T, P). 1{branch(neg(hc), T, P, P1):new_branch(P, P1)}1:- time(T), path(P), possible(analyze_blood, T, P), occ(analyze_blood, T, P). :- time(T), path(P1), path(P2), path(L1), P1 <= P2, L1 <= P2, sense(F), sense(G), neq(F,G), domain(F,V), domain(G,V1), branch(F,V,T,P1,P2), branch(G,V,T,L1,P2). :- time(T), T > 1, path(P1), path(P2), P1 < P2, sense(F), domain(F,V), branch(F,V,T,P1,P2), used(T,P2). determines(inspect, is_color(red)). determines(inspect, is_color(blue)). determines(inspect, is_color(white)). determines(analyze_blood, hc). determines(analyze_blood, neg(hc)). %%% End of section: Sensing Actions %%%% %%% Section: Initial %% h(neg(infected(4)), 1, 1). h(neg(infected(5)), 1, 1). h(neg(infected(none)), 1, 1). h(neg(tcd), 1, 1). h(neg(bsd), 1, 1). h(neg(dead), 1, 1). %%% End of section: Initial %%%% %%% Section: Goal %% goal(T, P):- time(T), path(P), h(infected(none), T, P), h(neg(dead), T, P). goal(T+1, P):- time(T), path(P), goal(T, P). ggoal(P):- path(P), time(T), used(T, P), goal(length, P). :- path(P), used(length, P), not ggoal(P). %%% End of section: Goal %%%% :- time(T), path(P), literal (P), literal(G), contrary(F,G), h(F, T, P), h(G, T, P). hide time(T). hide path(L). hide action(A). hide determines(A,F). hide contrary(F,G). hide fluent(F). hide literal(L). hide unknown(F, T, L). hide known(F, T, L). hide used(T, L). hide sense(F). %hide ggoal(L). hide goal(T,L). hide new_branch(L, L1). hide executable(A,S). hide possible(A, T, L). hide ab(F, T, L). hide h(F, T, L). hide noninertial(F). hide possibly_h(F, T, L).