Prolog测试始终是真正的var(sum)错误

Com*_*sNo 5 constraints prolog swi-prolog

我正在尝试编译一个SWI-Prolog程序,但一直在努力test is always true, var (sum) error on line 7.我无法弄清楚这意味着什么.有人可以帮忙吗?这是一个我希望最终解决拉丁方的程序.谢谢.

:- use_module(library(clpfd)).

magic_counter(Count) :-
    findall(a, magic_1(_Soln), As),
    length(As, Count).

magic_1(Soln) :-
    Row1 = [W1, W2, W3],
    Row2 = [X1, X2, X3],
    Row3 = [Y1, Y2, Y3],

    Row1 ins 1..3,
    Row2 ins 1..3,
    Row3 ins 1..3,

    Sum #= 6,

    all_different(Row1),
    all_different(Row2),
    all_different(Row3),

    all_different([W1,X1,Y1]),
    all_different([W2,X2,Y2]),
    all_different([W3,X3,Y3]),

    W1 + W2 + W3 #= Sum,
    X1 + X2 + X3 #= Sum,
    Y1 + Y2 + Y3 #= Sum,

    W1 + X1 + Y1 #= Sum,
    W2 + X2 + Y2 #= Sum,
    W3 + X3 + Y3 #= Sum,

    append(Row1,Row2,Row12),
    append(Row12,Row3,Soln),

    labeling([], Soln).
Run Code Online (Sandbox Code Playgroud)

Cap*_*liC 4

这是警告,而不是错误。

我再次在 SWI-Prolog 邮件列表上发布了针对此问题的请求,因为一些现有代码在对消息进行细化后开始引发此警告。是 Jan 的回答。

我认为您可以忽略该警告,或禁用它,但这似乎不可取。