Eclipse: instantiation fault in ic
- From: dayzman@xxxxxxxxxxx
- Date: 13 Apr 2005 19:01:10 -0700
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
.
- Follow-Ups:
- Re: Eclipse: instantiation fault in ic
- From: Bart Demoen
- Re: Eclipse: instantiation fault in ic
- Prev by Date: Re: Problems with SWI-Prolog?
- Next by Date: Re: nested list
- Previous by thread: Graph to tree structure
- Next by thread: Re: Eclipse: instantiation fault in ic
- Index(es):
Relevant Pages
|
|