Blame view

code/asp/drafts/paths.lp 311 Bytes
3e0f9b8a   Francisco Coelho   back to work?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
obs(a, c, 9, 1).
obs(c, b, 7, 3).
obs(d, c, 3, 2).
obs(d, b, 9, 1).

edge(A,B); -edge(A,B) :- obs(A, B, _, _).

prob(X,Y, P, P + N) :- edge(X,Y), obs(X,Y, P, N).
prob(X,Y, N, P + N) :- -edge(X,Y), obs(X,Y, P, N).

path(X,Y, 1) :- edge(X,Y).
path(X,Y, 2) :- edge(X,Z), path(Z, Y, _).

#show prob/4.
#show path/3.