FD problem: "vector too small"

"Jesper Eskilson" <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hi,

I'm using the FD solver in GNU prolog to solve a couple of problems
over at http://ProjectEuler.net. The problem I'm currently solving is
this: http://projecteuler.net/index.php?section=problems&id=39:

If p is the perimeter of a right angle triangle with integral length
sides, {a,b,c}, there are exactly three solutions for p = 120.

{20,48,52}, {24,45,51}, {30,40,50}

For which value of p 1000, is the number of solutions maximised?

This sounds like an excellent problem for applying some CLP/FD, I
thought, and wrote this program:

perimeter([P,X,Y,Z]) :-
	X #>= 1,
	Y #>= X,
	Z #>= Y,
	P #= X + Y + Z,
	X ** 2 + Y ** 2 #= Z ** 2,
	fd_all_different([X,Y,Z]),
	fd_labeling([P,X,Y,Z]).

p39(0, Length, Length).
p39(P, MaxLen, Length) :-
	findall([X,Y,Z], perimeter([P,X,Y,Z]), Solutions),
	length(Solutions, NewLen),
	max_list([NewLen, MaxLen], NewMaxLen),
	P0 is P - 1,
	p39(P0, NewMaxLen, Length).

p39(MaxLen) :-
	p39(1000, 0, MaxLen).

but when I run it, I get lots and lots of warnings on the form:

    Warning: Vector too small - maybe lost solutions (FD Var:_54)

What does this warning mean? And how do I avoid getting it?

-- 
/Jesper
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.