Download
language ESSENCE 1.3.0
$ Problem Alien Tiles
$
$ Problem details available at http://www.csplib.org/Problems/prob027/
$
$ Essence model by Andrew Martin
$
$ Licenced under CC-BY-4.0 : http://creativecommons.org/licenses/by/4.0/
given gridSize : int(1..)
given colours : int(1..)
letting dGridSize be domain int(1..gridSize)
letting dColours be domain int(0..colours-1)
$ colours moves is always equal to no moves
find clickMatrix : matrix indexed by [dGridSize, dGridSize] of dColours
maximising (sum i,j : dGridSize . clickMatrix[i][j])
such that
$ no way of reaching same state faster exists
forAll simplerClickMatrix : matrix indexed by [dGridSize, dGridSize] of dColours .
$ ensure not faster
(sum i,j : dGridSize . clickMatrix[i][j]) <= (sum i,j : dGridSize . simplerClickMatrix[i][j])
\/
$ ensure not same (for each tile, check if sum of clicks effecting it %colours same as other clickmatrix)
exists x,y : dGridSize .
((sum index : dGridSize . clickMatrix[index][y] + clickMatrix[x][index]) - clickMatrix[x][y]) % colours
!=
((sum index : dGridSize . simplerClickMatrix[index][y] + simplerClickMatrix[x][index]) - simplerClickMatrix[x][y]) % colours