users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FD with large domains


From: Fred Bapst
Subject: FD with large domains
Date: Fri, 20 Jan 2012 15:45:11 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Hello,

I'd like to point out a couple of questionable situations in GnuProlog when dealing with FD variables with large domains (eg default domain).

- A*B #= C.                           no
- fd_domain([A,B,C],0,1000000),
  A*B #= C.                           no
- fd_domain([A,B,C],0,10000000),
  A*B #= C.                           yes
- X#<1000000,  4321 rem X #= 1.       no
- X#<10000000, 4321 rem X #= 1.       yes
-   X*X #= Y.                         yes
- X*X*X #= Y.                         no
-  X**3 #= Y.                         yes

Some of these issues might be due to integer overflow. My "numerical problem sniffer" tool suggested for instance to double-check this code snippet from BipsFD/fd_math_fd.fd:

pl_xy_eq_z(fdv X, fdv Y, fdv Z) {
 ...
 start Z in min(X)*min(Y)..max(X)*max(Y)
}

Depending how it gets translated, the integer multiplication might overflow.

Am I off-topic? If not, do you think it is desirable to provide a "mode" where it is ensured that propagation rules avoids overflows that could crash a domain? Could it be proposed as a student project (for how many hours of work)?

Best regards.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]