Hi Cristian.
Regarding the model. there are at least one, perhaps two missing "end" in the admissible/3 predicate.
With the "-log" logging parameter, Picat prints two
"--- SYNTAX WARNING --- (59-67) missing 'end' inserted for foreach."
I added two "end" and then it took < 1s (from 1 minute on my machine for your original model),:
- S=34: 0.6s
- S= 33: 0.2s
Here's the adjusted model ("<--" markes the two "end" that are added)..
"""
import sat.
admissible(A,N,K) =>
A=new_array(N,N),A::0..1,
foreach(I1 in 1..N,
I2 in 1..N, I2>I1,
I3 in 1..N, I3>I2,
J1 in 1..N, J2 in 1..N, J2>J1,
J3 in 1..N, J3>J2)
sum([A[Ii, Jj] : Ii in [I1,I2,I3], Jj in [J1,J2,J3]]) #> 0
end, % <---
foreach(I in 1..N-1)
lex_le([A[I,J]:J in 1..N],[A[I+1,J]:J in 1..N])
end. % <---
main0 =>
N=7,
S=34,
admissible(A,N,3),
sum([A[I,J]:I in 1..N,J in 1..N])#=N*N-S,
solve(A),
println(A).
main=>time2(main0).
"""
The output for S=33.
"""
{{0,0,0,0,0,1,1},{0,0,1,0,1,1,0},{0,0,1,1,0,0,0},{0,1,0,0,0,0,0},{1,0,0,0,1,0,0},{1,0,0,1,0,1,0},{1,0,1,0,0,0,1}}
"""
Without the "end" after the first foreach loop in adminissible/3 then then second loop is repeated many times.
Hope this help.
That being said, I like your suggestion on making it easier to swap the SAT solver, but it's on Neng-Fa's table.
Best,
Hakan