# Encoding hydraulic-leaking_decision.iclingo

Name hydraulic-leaking_decision.iclingo [Root]    Unclassified (114)    Hydraulic System (8)    Hydraulic Leaking (3) Martin Gebser Martin Gebser and Roland Kaminski An incremental encoding of Hydraulic Leaking. The time indexes in solutions can be made non-negative by using the script here: http://asp.haiti.cs.uni-potsdam.de/encoding/show/id/6080 2009-03-29 17:20 2009-05-09 12:00 Hydraulic Leaking full/1goal/1jet/1junction/1leaking/1link/3numValves/1tank/1valve/1 switchon/2 No ASP Contest 09 (Martin Gebser) #base. relay(J) :- link(I,J,V1), link(J,K,V2), I != K. maxstep(S+1) :- S = { relay(J) : relay(J) : not goal(J) }. leaky(L) :- L = { leaking(V) : leaking(V) }. steps(M) :- M = min [ maxstep(S) : maxstep(S) = S, leaky(L) : leaky(L) = L ]. leak(0,J) :- goal(J). leak(L,I) :- link(I,J,V), leak(L,J), not leaking(V), steps(M), L = 0..M. leak(L+1,I) :- link(I,J,V), leak(L,J), leaking(V), steps(M), L = 0..M-1. :- not leak(L,I) : steps(M) : L = 0..M : full(I). minleaks(N) :- N = min [ leak(L,I) : steps(M) : L = 0..M : full(I) = L ]. reach(1,J) :- goal(J). leaks(1,0). #cumulative t. 1 { switchon(V,-t+2) : link(I,J,V) } 1 :- t > 1. :- switchon(V,-t+2), not reach(t-1,J) : link(I,J,V). reach(t,I) :- link(I,J,V), switchon(V,-t+2), reach(t-1,J). leaks(t,L) :- leaks(t-1,L), switchon(V,-t+2), not leaking(V), minleaks(N), L = 0..N. leaks(t,L+1) :- leaks(t-1,L), switchon(V,-t+2), leaking(V), minleaks(N), L = 0..N. :- leaks(t,N+1), minleaks(N). #volatile t. :- not reach(t,I) : full(I). #base. #hide. #show switchon/2.