# Encoding golomb-ruler_wikipedia.gringo

Name golomb-ruler_wikipedia.gringo [Root]    Miscellaneous (45)    ASP Contest 09 (45) Martin Gebser Martin Gebser and Roland Kaminski A Gringo encoding of Golomb Ruler (exploiting known optimums). 2009-03-27 12:58 2009-03-31 17:22 mark/1position/1 location/2mark/1position/1 No #hide order/1. #hide dist/2. order(O) :- O = max [ mark(M) : mark(M) = M ]. location(1,0) :- mark(1). 1 { location(M,P) : position(P) } 1 :- mark(M), M > 1, order(MP), MP > 26. :- location(M1,P1), location(M2,P2), M1 < M2, P1 >= P2, order(MP), MP > 26. dist(M1,P2-P1) :- location(M1,P1), location(M2,P2), M1 < M2, P1 < P2, order(MP), MP > 26. :- dist(M1,D), dist(M2,D), M1 < M2, order(MP), MP > 26. #minimize [ location(M,P) : order(M) : position(P) = P ]. % precalculated solutions (that are all solutions known so far) :- order(1), not position(0). location(2,1) :- order(2). :- order(2), not position(1). location(2,1) :- order(3). location(3,3) :- order(3). :- order(3), not position(3). location(2,1) :- order(4). location(3,4) :- order(4). location(4,6) :- order(4). :- order(4), not position(6). location(2,1) :- order(5). location(3,4) :- order(5). location(4,9) :- order(5). location(5,11) :- order(5). :- order(5), not position(11). location(2,1) :- order(6). location(3,4) :- order(6). location(4,10) :- order(6). location(5,12) :- order(6). location(6,17) :- order(6). :- order(6), not position(17). location(2,1) :- order(7). location(3,4) :- order(7). location(4,10) :- order(7). location(5,18) :- order(7). location(6,23) :- order(7). location(7,25) :- order(7). :- order(7), not position(25). location(2,1) :- order(8). location(3,4) :- order(8). location(4,9) :- order(8). location(5,15) :- order(8). location(6,22) :- order(8). location(7,32) :- order(8). location(8,34) :- order(8). :- order(8), not position(34). location(2,1) :- order(9). location(3,5) :- order(9). location(4,12) :- order(9). location(5,25) :- order(9). location(6,27) :- order(9). location(7,35) :- order(9). location(8,41) :- order(9). location(9,44) :- order(9). :- order(9), not position(44). location(2,1) :- order(10). location(3,6) :- order(10). location(4,10) :- order(10). location(5,23) :- order(10). location(6,26) :- order(10). location(7,34) :- order(10). location(8,41) :- order(10). location(9,53) :- order(10). location(10,55) :- order(10). :- order(10), not position(55). location(2,1) :- order(11). location(3,4) :- order(11). location(4,13) :- order(11). location(5,28) :- order(11). location(6,33) :- order(11). location(7,47) :- order(11). location(8,54) :- order(11). location(9,64) :- order(11). location(10,70) :- order(11). location(11,72) :- order(11). :- order(11), not position(72). location(2,2) :- order(12). location(3,6) :- order(12). location(4,24) :- order(12). location(5,29) :- order(12). location(6,40) :- order(12). location(7,43) :- order(12). location(8,55) :- order(12). location(9,68) :- order(12). location(10,75) :- order(12). location(11,76) :- order(12). location(12,85) :- order(12). :- order(12), not position(85). location(2,2) :- order(13). location(3,5) :- order(13). location(4,25) :- order(13). location(5,37) :- order(13). location(6,43) :- order(13). location(7,59) :- order(13). location(8,70) :- order(13). location(9,85) :- order(13). location(10,89) :- order(13). location(11,98) :- order(13). location(12,99) :- order(13). location(13,106) :- order(13). :- order(13), not position(106). location(2,4) :- order(14). location(3,6) :- order(14). location(4,20) :- order(14). location(5,35) :- order(14). location(6,52) :- order(14). location(7,59) :- order(14). location(8,77) :- order(14). location(9,78) :- order(14). location(10,86) :- order(14). location(11,89) :- order(14). location(12,99) :- order(14). location(13,122) :- order(14). location(14,127) :- order(14). :- order(14), not position(127). location(2,4) :- order(15). location(3,20) :- order(15). location(4,30) :- order(15). location(5,57) :- order(15). location(6,59) :- order(15). location(7,62) :- order(15). location(8,76) :- order(15). location(9,100) :- order(15). location(10,111) :- order(15). location(11,123) :- order(15). location(12,136) :- order(15). location(13,144) :- order(15). location(14,145) :- order(15). location(15,151) :- order(15). :- order(15), not position(151). location(2,1) :- order(16). location(3,4) :- order(16). location(4,11) :- order(16). location(5,26) :- order(16). location(6,32) :- order(16). location(7,56) :- order(16). location(8,68) :- order(16). location(9,76) :- order(16). location(10,115) :- order(16). location(11,117) :- order(16). location(12,134) :- order(16). location(13,150) :- order(16). location(14,163) :- order(16). location(15,168) :- order(16). location(16,177) :- order(16). :- order(16), not position(177). location(2,5) :- order(17). location(3,7) :- order(17). location(4,17) :- order(17). location(5,52) :- order(17). location(6,56) :- order(17). location(7,67) :- order(17). location(8,80) :- order(17). location(9,81) :- order(17). location(10,100) :- order(17). location(11,122) :- order(17). location(12,138) :- order(17). location(13,159) :- order(17). location(14,165) :- order(17). location(15,168) :- order(17). location(16,191) :- order(17). location(17,199) :- order(17). :- order(17), not position(199). location(2,2) :- order(18). location(3,10) :- order(18). location(4,22) :- order(18). location(5,53) :- order(18). location(6,56) :- order(18). location(7,82) :- order(18). location(8,83) :- order(18). location(9,89) :- order(18). location(10,98) :- order(18). location(11,130) :- order(18). location(12,148) :- order(18). location(13,153) :- order(18). location(14,167) :- order(18). location(15,188) :- order(18). location(16,192) :- order(18). location(17,205) :- order(18). location(18,216) :- order(18). :- order(18), not position(216). location(2,1) :- order(19). location(3,6) :- order(19). location(4,25) :- order(19). location(5,32) :- order(19). location(6,72) :- order(19). location(7,100) :- order(19). location(8,108) :- order(19). location(9,120) :- order(19). location(10,130) :- order(19). location(11,153) :- order(19). location(12,169) :- order(19). location(13,187) :- order(19). location(14,190) :- order(19). location(15,204) :- order(19). location(16,231) :- order(19). location(17,233) :- order(19). location(18,242) :- order(19). location(19,246) :- order(19). :- order(19), not position(246). location(2,1) :- order(20). location(3,8) :- order(20). location(4,11) :- order(20). location(5,68) :- order(20). location(6,77) :- order(20). location(7,94) :- order(20). location(8,116) :- order(20). location(9,121) :- order(20). location(10,156) :- order(20). location(11,158) :- order(20). location(12,179) :- order(20). location(13,194) :- order(20). location(14,208) :- order(20). location(15,212) :- order(20). location(16,228) :- order(20). location(17,240) :- order(20). location(18,253) :- order(20). location(19,259) :- order(20). location(20,283) :- order(20). :- order(20), not position(283). location(2,2) :- order(21). location(3,24) :- order(21). location(4,56) :- order(21). location(5,77) :- order(21). location(6,82) :- order(21). location(7,83) :- order(21). location(8,95) :- order(21). location(9,129) :- order(21). location(10,144) :- order(21). location(11,179) :- order(21). location(12,186) :- order(21). location(13,195) :- order(21). location(14,255) :- order(21). location(15,265) :- order(21). location(16,285) :- order(21). location(17,293) :- order(21). location(18,296) :- order(21). location(19,310) :- order(21). location(20,329) :- order(21). location(21,333) :- order(21). :- order(21), not position(333). location(2,1) :- order(22). location(3,9) :- order(22). location(4,14) :- order(22). location(5,43) :- order(22). location(6,70) :- order(22). location(7,106) :- order(22). location(8,122) :- order(22). location(9,124) :- order(22). location(10,128) :- order(22). location(11,159) :- order(22). location(12,179) :- order(22). location(13,204) :- order(22). location(14,223) :- order(22). location(15,253) :- order(22). location(16,263) :- order(22). location(17,270) :- order(22). location(18,291) :- order(22). location(19,330) :- order(22). location(20,341) :- order(22). location(21,353) :- order(22). location(22,356) :- order(22). :- order(22), not position(356). location(2,3) :- order(23). location(3,7) :- order(23). location(4,17) :- order(23). location(5,61) :- order(23). location(6,66) :- order(23). location(7,91) :- order(23). location(8,99) :- order(23). location(9,114) :- order(23). location(10,159) :- order(23). location(11,171) :- order(23). location(12,199) :- order(23). location(13,200) :- order(23). location(14,226) :- order(23). location(15,235) :- order(23). location(16,246) :- order(23). location(17,277) :- order(23). location(18,316) :- order(23). location(19,329) :- order(23). location(20,348) :- order(23). location(21,350) :- order(23). location(22,366) :- order(23). location(23,372) :- order(23). :- order(23), not position(372). location(2,9) :- order(24). location(3,33) :- order(24). location(4,37) :- order(24). location(5,38) :- order(24). location(6,97) :- order(24). location(7,122) :- order(24). location(8,129) :- order(24). location(9,140) :- order(24). location(10,142) :- order(24). location(11,152) :- order(24). location(12,191) :- order(24). location(13,205) :- order(24). location(14,208) :- order(24). location(15,252) :- order(24). location(16,278) :- order(24). location(17,286) :- order(24). location(18,326) :- order(24). location(19,332) :- order(24). location(20,353) :- order(24). location(21,368) :- order(24). location(22,384) :- order(24). location(23,403) :- order(24). location(24,425) :- order(24). :- order(24), not position(425). location(2,12) :- order(25). location(3,29) :- order(25). location(4,39) :- order(25). location(5,72) :- order(25). location(6,91) :- order(25). location(7,146) :- order(25). location(8,157) :- order(25). location(9,160) :- order(25). location(10,161) :- order(25). location(11,166) :- order(25). location(12,191) :- order(25). location(13,207) :- order(25). location(14,214) :- order(25). location(15,258) :- order(25). location(16,290) :- order(25). location(17,316) :- order(25). location(18,354) :- order(25). location(19,372) :- order(25). location(20,394) :- order(25). location(21,396) :- order(25). location(22,431) :- order(25). location(23,459) :- order(25). location(24,467) :- order(25). location(25,480) :- order(25). :- order(25), not position(480). location(2,1) :- order(26). location(3,33) :- order(26). location(4,83) :- order(26). location(5,104) :- order(26). location(6,110) :- order(26). location(7,124) :- order(26). location(8,163) :- order(26). location(9,185) :- order(26). location(10,200) :- order(26). location(11,203) :- order(26). location(12,249) :- order(26). location(13,251) :- order(26). location(14,258) :- order(26). location(15,314) :- order(26). location(16,318) :- order(26). location(17,343) :- order(26). location(18,356) :- order(26). location(19,386) :- order(26). location(20,430) :- order(26). location(21,440) :- order(26). location(22,456) :- order(26). location(23,464) :- order(26). location(24,475) :- order(26). location(25,487) :- order(26). location(26,492) :- order(26). :- order(26), not position(492).