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

.



Relevant Pages

  • Re: summing numbers with in a cell
    ... >in cell a1 i have 4099227911503, i know that if i add these numbers up, ... >the sum would be 52. ... >mod 10 to get the check digit. ... To enter an array formula, after typing or pasting it into the formula bar, ...
    (microsoft.public.excel.misc)
  • Re: summing numbers with in a cell
    ... in cell a1 i have 4099227911503, i know that if i add these numbers up, ... the sum would be 52. ... mod 10 to get the check digit. ... Prev by Date: ...
    (microsoft.public.excel.misc)