On Wed, Mar 09, 2005 at 07:45:27PM +0100, chegivara wrote: > Hi people, > > I have a little problem. Why it doesn't work ??? Use of the FD library is discouraged. It has quite a few bugs that we have no intention of fixing and is not supported any more. I suggest you upgrade your ECLiPSe to the latest version and use the IC library instead. > I tried to simulate absolut value (domain) > > lib(fd), > D :: 2..20, mindomain(D,Min),maxdomain(D,Max), > A::[-Max.. -Min,Min..Max]. > > problem: > out of range in integer_list_to_dom([2 .. 20, -20 .. -2], _360) The FD library appears not to support properly arithmetic expressions in domain declarations, probably due to its (partial, buggy) support for compound terms as elements of the domain. E.g. [1 .. 1+3] evaluates to [1 .. 4] but [1, 1+3] is the domain containing the integer 1 and the compound term 1+3 (not 4). Clearly this is inconsistent (and poorly documented) and should be considered a bug one way or the other. If you still want to use FD, you can get around the problem by evaluating any expressions in advance rather than putting them in the domain declaration: ?- D :: 2..20, mindomain(D,Min),maxdomain(D,Max), NegMin is -Min, NegMax is -Max, A :: [NegMax .. NegMin, Min .. Max]. D = D{[2..20]} A = A{[-20 .. -2, 2..20]} NegMax = -20 NegMin = -2 Min = 2 Max = 20 Yes (0.00s cpu) Cheers, WarwickReceived on Wed Mar 09 19:21:56 2005
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:34 PM GMT GMT