# Encoding hydraulic-leaking_chk.lp

Name hydraulic-leaking_chk.lp [Root]    Miscellaneous (45)    ASP Contest 09 (45) Martin Gebser Martin Gebser and Roland Kaminski 2009-03-22 16:26 2009-05-09 11:44 No leak(0,0,J) :- goal(J). leak(L,N+1,I) :- link(I,J,V), leak(L,N,J), not leaking(V), step(N), leak(L). leak(L+1,N+1,I) :- link(I,J,V), leak(L,N,J), leaking(V), step(N), leak(L;L+1). :- not leak(L,N,I) : leak(L) : maxstep(M) : N = 0..M : full(I). minleaks(Y) :- Y = min [ leak(L,N,I) : leak(L) : maxstep(M) : N = 0..M : full(I) = L ]. :- minleaks(M), leak(N), N > M. minsteps(Y) :- Y = min [ leak(L,N,I) : minleaks(L) : maxstep(M) : N = 0..M : full(I) = N ]. :- minsteps(M), step(N), N == M. maxstep(S+1) :- step(S), not step(S+1). step(0..S-1) :- S = { switchon(V,N) : switchon(V,N) }. leak(0..L) :- L = { switchon(V,N) : switchon(V,N) : leaking(V) }. :- step(N), not 1 { switchon(V,N) : switchon(V,N) } 1. % :- switchon(V,N), not step(N). :- switchon(V,N), not valve(V). follow(I,0) :- full(I). follow(I,N+1) :- follow(J,N), link(J,I,V), switchon(V,N). % :- switchon(V,N), not follow(J,N) : link(J,I,V). :- goal(I), maxstep(N), not follow(I,N). #hide. #show switchon(V,N).