Download
$
$ N-queens in Essence'.
$
$ Using the 3 alldifferent approach with matrix comprehensions.
$
$ Model created by Hakan Kjellerstrand, hakank@gmail.com
$ See also my Essence'/Tailor page: http://www.hakank.org/savile_row/
$
$ Licenced under CC-BY-4.0 : http://creativecommons.org/licenses/by/4.0/
$
language ESSENCE' 1.0
$ given n : int(1..)
letting n be 8
letting dom be domain int(1..n)
find x: matrix indexed by [ dom ] of dom
$ branching on x
$ heuristic srf
such that
allDiff(x),
allDiff([x[i]+i | i : dom]),
allDiff([x[i]-i | i : dom])