Skip to content

Instantly share code, notes, and snippets.

@MHenderson
Created August 10, 2013 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MHenderson/6200476 to your computer and use it in GitHub Desktop.
Save MHenderson/6200476 to your computer and use it in GitHub Desktop.
Essence' description of PSSSODLS.
language ESSENCE' 1.0
given n : int
letting Indices be domain int(0..n-1)
letting Symbols be domain int(0..n-1)
letting symbol_sum be (n*(n-1)/2)
find P: matrix indexed by [Indices, Indices] of Symbols
such that
$ all rows have to be different
forAll row : Indices .
allDiff(P[row,..]),
$ all columns have to be different
forAll col : Indices .
allDiff(P[..,col]),
$ pandiagonality constraints
forAll w : Indices .
(sum i: Indices .
P[i, (i + w) % n]) = symbol_sum /\
(sum i: Indices .
P[i, (w - i) % n]) = symbol_sum ,
$ strongly-symmetric constraints
forAll i,j : Indices .
P[i, j] + P[n - 1 - i, n - 1 - j] = n - 1,
$ orthogonality constraints
forAll i,j,k,l : Indices .
i<k \/ j<l -> P[i,j] != P[k,l] \/ P[j,i] != P[l,k]
language ESSENCE' 1.0
letting n be 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment