%%%% CILog axiomatization for Module 4, 1999.
%%%% Copyright (c) 1999, David Poole

%%%% load the file CILog hsearch.pl code, also available from:
%%%% http://www.cs.ubc.ca/spider/poole/ci/code/cilog/cilog_code/ch4/hsearch.pl

%%%% Try the queries:
% ask hsearch(depth,[node(s,[],0,0)],P).
% ask hsearch(breadth,[node(s,[],0,0)],P).
% ask hsearch(shortest,[node(s,[],0,0)],P).
% ask hsearch(best,[node(s,[],0,0)],P).
% ask hsearch(astar,[node(s,[],0,0)],P).

% neighbours(N,NN) is true if NN is the list of neighbours of node N
neighbours(s,[a,c,k]).
neighbours(a,[b]).
neighbours(b,[h,g]).
neighbours(c,[d]).
neighbours(d,[e]).
neighbours(e,[f]).
neighbours(f,[g]).
neighbours(g,[]).
neighbours(h,[i]).
neighbours(i,[j,g]).
neighbours(j,[]).
neighbours(k,[l]).
neighbours(l,[]).

% cost(N,M,C) is true if C is the arc cost for the arc from node N to node M
cost(s,a,2).
cost(s,c,1).
cost(s,k,2).
cost(a,b,2).
cost(b,h,2).
cost(b,g,3).
cost(c,d,1).
cost(d,e,1).
cost(e,f,1).
cost(f,g,1).
cost(h,i,2).
cost(i,j,1).
cost(i,g,5).
cost(k,l,1).

% is_goal(N) is true if N is a goal node.
is_goal(g).

% h(N,C) is true if C is the heuristic estimate the distance from N to g.

h(a,2).     h(b,3).
h(c,4).     h(d,3).
h(e,2).     h(f,1).
h(g,0).     h(h,4).
h(i,5).     h(j,6).
h(k,5).     h(l,6).
h(s,4).
