## Eclipse: instantiation fault in ic

### Eclipse: instantiation fault in ic

Hi,

I'm trying to write a program that solves an NxN UNISOL puzzle. There
is a NxN matrix, where each cell contains a letter, and each letter
represents a different digit. The sum of every row and every column is
given. A solution of this problem give each lettter a digit value so
that the sums are valid. With the following piece of code, I keep
getting the error "instantiation fault in ic : (_2331 =:=
sum([]([](_1054{}(..(0, 100)), _1072{}(..(0, 100)), _1054, _1054),
[](_1054, _1072, _1162{}(..(0, 100)), _1054), [](_1054, _1054, _1054,
_1054), [](_1054, _1054, _1054, _1054))[1, 1 .. N]))". It seems that it
doesn't like the way my Sqaure is constructed, why's that?

unisol(Matrix,
SumRows,
SumCols,
Vars):-
N #= length(Matrix),
dim(Square,[N,N]),
Square[1..N,1..N] :: 0..100,
(
for(I,1,N),
foreach(Row,Matrix),
param(N, Square)
do
(
for(J,1,N),
foreach(R,Row),
param(I, Square)
do
R :: 0..100,
Square[I,J] #= R
)
),
(
for(I,1,N),
foreach(SR,SumRows),
foreach(SC,SumCols),
param(Square)
do
sum(Square[I,1..N]) #= SR,
sum(Square[1..N,I]) #= SC
),
search(Vars,0,first_fail,indomain,complete,[]).

Any help will be much appreciated.

Cheers,
Michael

### Eclipse: instantiation fault in ic

[..]

Put N also in the param.
(next time, tell us which is the query - it saves us time).

Cheers

Bart Demoen