fd solver: inconsistent results. (was fd_all_different/1)

"Claude Certain" <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hello,

I found inconstent results while solving a CSP with gprolog.
I can hardly tweak the code to find out what's wrong since every try takes
at least 8-12 hours of elapsed time.
And working with smallest I was not able to prove some inconstency.
I give you the skeleton of my code which indeed is very simple and naive.
Please don't comment on my programing style, but just on my mistakes.
I can certainly do better.

populate(List,Delta) :-
	length(List,L_list),
	constrain(List,0,L_list-1),
	constrain(Delta,1,floor((L_list-1)/3)),
	solve(List,Delta).

constrain(List,Min,Max) :-
	M is Max,
	fd_domain(List,Min,M),
	fd_all_different(List).

solve([],[]) .
solve([A,B,C,D|R],[Delta|RDelta]) :-
	A #< B , B #< C , C #< D ,
	fd_labeling(Delta,[variable_method(ff),value_method(max)]),
	Delta #= B - A ,
	B - A #= D - C ,
	D - C #= C - B ,
 	fd_labeling([A,C],[variable_method(smallest),value_method(min)]) ,
	fd_labeling([B,D],[variable_method(largest),value_method(max)]) ,
	solve(R,RDelta).

Solving the following:
:- length(List,36) , length(Delta,9) , populate(List,Delta) .
succeeds (after 8-12 hours of ellapsd time) with inconsistent results on
both List and Delta (duplicated values).

Sumary:
Solving for a list of length 4*N with N=1 succeeds,
Solving for a list of length 4*N with N= 2,3,4,5,6,7,8 fails. I don't know
what the result has to be. This behavior does not prove inconstency.
The above results from N=1 to 6 are obtained in a glimpse. For 7 it takes
longuer, but it is still a matter of minutes. For 8 it is a matter of
several hours.
Solving for a list of length 4*N with N=9 succeeds with duplicated values.
This behavior does prove inconsistency. Success (?) for N=9 is a matter of
several hours.

fd_vector_max is set to 127, no error message appears during computation.
I urgently need your advice.

best regards,

Claude Certain
OS: windows XP Pro
gprolog version: 1.2.16
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.