[Yap-6.0.0] compiling plus/2 with input unbound

View: New views
2 Messages — Rating Filter:   Alert me  

[Yap-6.0.0] compiling plus/2 with input unbound

by jos.deroo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When loading the following classical example

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:- use_module(library(clpfd)).

fac(0,1).
fac(N,F) :-
        N #> 0, N1 #= N-1, F #= N*F1, fac(N1,F1).


test(Vs) :-
        Vs = [A,B,C,D], Vs ins 0..711, A*B*C*D #= 711*1000000, A+B+C+D #= 711, A #>= B, B #>= C, C #>= D, labeling([ff],Vs).


puzzle([S,E,N,D] + [M,O,R,E] = [M,O,N,E,Y]) :-
        Vars = [S,E,N,D,M,O,R,Y],
        Vars ins 0..9,
        all_different(Vars),
        S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= K, K #= M*10000 + O*1000 + N*100 + E*10 + Y,
        M #\= 0, S #\= 0.
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

we get

YAP version Yap-6.0.0
     ERROR!!  (/home/jdroo/temp/testclp.yap:12).
     TYPE ERROR- in line 12, compiling plus/2 with input unbound: expected unbound variable, got _131193*1000+_131196*100+_131199*10+_131185+_131202*1000+_131205*100+_131208*10+_131196


After replacing
        S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= M*10000 + O*1000 + N*100 + E*10 + Y,
with
        S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= K, K #= M*10000 + O*1000 + N*100 + E*10 + Y,


everything works fine.


Kind regards,

Jos De Roo | Agfa HealthCare
Senior Researcher | HE/Advanced Clinical Applications Research
T  +32 3444 7618
http://www.agfa.com/w3c/jdroo/

Quadrat NV, Kortrijksesteenweg 157, 9830 Sint-Martens-Latem, Belgium
http://www.agfa.com/healthcare
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

Re: [Yap-6.0.0] compiling plus/2 with input unbound

by jos.deroo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops..
The example should have been with line 12
        S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= M*10000 + O*1000 + N*100 + E*10 + Y,

Kind regards,

Jos De Roo | Agfa HealthCare
Senior Researcher | HE/Advanced Clinical Applications Research
T  +32 3444 7618
http://www.agfa.com/w3c/jdroo/

Quadrat NV, Kortrijksesteenweg 157, 9830 Sint-Martens-Latem, Belgium
http://www.agfa.com/healthcare


Jos De Roo/AMDUS/AGFA@AGFA

08/03/2009 11:08 AM

To
yap-users@...
cc
Subject
[Yap-users] [Yap-6.0.0] compiling plus/2 with input unbound






When loading the following classical example

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:- use_module(library(clpfd)).


fac(0,1).

fac(N,F) :-

       N #> 0, N1 #= N-1, F #= N*F1, fac(N1,F1).



test(Vs) :-

       Vs = [A,B,C,D], Vs ins 0..711, A*B*C*D #= 711*1000000, A+B+C+D #= 711, A #>= B, B #>= C, C #>= D, labeling([ff],Vs).



puzzle([S,E,N,D] + [M,O,R,E] = [M,O,N,E,Y]) :-

       Vars = [S,E,N,D,M,O,R,Y],

       Vars ins 0..9,

       all_different(Vars),

       S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= K, K #= M*10000 + O*1000 + N*100 + E*10 + Y,

       M #\= 0, S #\= 0.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


we get


YAP version Yap-6.0.0

    ERROR!!  (/home/jdroo/temp/testclp.yap:12).

    TYPE ERROR- in line 12, compiling plus/2 with input unbound: expected unbound variable, got _131193*1000+_131196*100+_131199*10+_131185+_131202*1000+_131205*100+_131208*10+_131196



After replacing

       S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= M*10000 + O*1000 + N*100 + E*10 + Y,

with

       S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= K, K #= M*10000 + O*1000 + N*100 + E*10 + Y,



everything works fine.



Kind regards,

Jos De Roo | Agfa HealthCare
Senior Researcher | HE/Advanced Clinical Applications Research
T  +32 3444 7618

http://www.agfa.com/w3c/jdroo/

Quadrat NV, Kortrijksesteenweg 157, 9830 Sint-Martens-Latem, Belgium

http://www.agfa.com/healthcare
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  
http://p.sf.net/sfu/bobj-july
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users