# Encoding hydraulic-planning_decision.gringo

Name hydraulic-planning_decision.gringo [Root]    Unclassified (114)    Hydraulic System (8)    Hydraulic Planning (3) Martin Gebser Martin Gebser and Roland Kaminski A Gringo encoding of Hydraulic Planning. (No search needed) 2009-03-22 16:11 2009-06-03 21:01 Hydraulic Planning full/1goal/1jet/1junction/1link/3numValves/1stuck/1tank/1valve/1 switchon/2 No ASP Contest 09 (Martin Gebser)No Search (Martin Gebser) conn(I,J,V) :- link(I,J,V), not stuck(V). relay(I) :- conn(J,I,V1), conn(I,K,V2), J != K. step(0..S) :- S = { relay(I) : relay(I) : not goal(I) }. reach(I,0) :- goal(I). reach(I,N+1) :- conn(I,J,V), reach(J,N), step(N). % , not done(N). % reach(I,N+1) :- conn(I,J,V), reach(J,N), step(N), not reached(I,N), not done(N). % reached(I,N) :- reach(I,N), step(N), not full(I). % reached(I,N+1) :- reached(I,N), relay(I), step(N;N+1), not full(I). % done(N) :- full(I), reach(I,N). done(N) :- N = min [ reach(I,M) : reach(I,M) : full(I) = M ]. done :- reach(I,M), full(I). % done(N). :- not done. switchon(V,0) :- full(I), done(N), reach(I,N), not reach(II,N) : full(II) : II < I, conn(I,J,V), reach(J,N-1), not reach(JJ,N-1) : conn(I,JJ,VV) : VV < V. switchon(V,N+1) :- switchon(W,N), conn(K,I,W), step(N), done(M), M > N+1, conn(I,J,V), reach(J,M-(N+2)), not reach(JJ,M-(N+2)) : conn(I,JJ,VV) : VV < V. #hide. #show switchon(V,N).