# Encoding hydraulic_leaking.enc.asp

Name hydraulic_leaking.enc.asp [Root]    Unclassified (114)    Hydraulic System (8)    Hydraulic Leaking (3) Barbara Nardi Francesco Calimeri and Maria Carmela Santoro 2012-04-11 15:41 2012-04-11 18:31 No % graph nodes node(N) :- jet(N). node(N) :- junction(N). node(N) :- tank(N). % lengths of paths to goal, bounded by the number of valves, recording also % the number of leaking valves on the path dist(J,0,0) :- goal(J). dist(N,DN,LN) :- dist(K,DK,LK), link(N,K,V), DN=DK+1, LN=LK+1, numValves(NV), DN <= NV, leaking(V). dist(N,DN,LK) :- dist(K,DK,LK), link(N,K,V), DN=DK+1, numValves(NV), DN <= NV, not leaking(V). % minimum leaking distance of a node to the goal node nodemindist(N,DN,LDN) :- node(N), minLkDist(N,LDN), minDist(N,DN,LDN). minLkDist(N,LDN) :- dist(N,Fv1,LDN), not existLdnLessThan(N,LDN). existLdnLessThan(N,LDN) :- dist(N,Fv1,LDN), dist(N,Fv2,LDN1), LDN1 N2, link(N,N1,V), link(N,N2,V). smallestnodeforvalve(N1,D1,LD1) :- smallestvalve(V,D1,LD1), reached(N,D,LD), D1=D-1, link(N,N1,V), not nsmallestnodeforvalve(N1,D1,LD1). reached(N,D,LD) :- smallestnodeforvalve(N,D,LD).