[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: negative values of Finite Domain Variables
From: |
Salvador Abreu |
Subject: |
Re: negative values of Finite Domain Variables |
Date: |
Fri, 27 May 2022 15:27:27 -0700 |
hi Daniel,
You can try with the negative domain variant; to do that
(1) clone get the gprolog source (from github or sourceforge)
(2) in the GNU prolog src subdir, do:
git switch negative-domains
make distclean
./configure
make
(3) you will have a version that can handle domains which range into negative
values; a easy way to use it without installing system-wide is to continue with
the commands:
. SETVARS
(in the same directory)
here’s a transcript:
15:21:52$ . SETVARS
15:21:54$ gprolog
GNU Prolog 1.5.0 (64 bits)
Compiled May 27 2022, 15:21:42 with gcc
Copyright (C) 1999-2022 Daniel Diaz
| ?- fd_domain(X,-100,100), 2 #= X + 9.
X = -7
yes
| ?-
if you want to remain with the main branch, you need to remodel your problems
to work with positive numbers only (e.g. with an offset).
hope this helps.
-spa
> On 27 May 2022, at 12:28, Daniel Ajoy <da.ajoy@gmail.com> wrote:
>
> Hi,
>
> I was expecting:
>
> fd_domain(X,-100,100), 2 #= X + 9.
>
> to produce
>
> X = -7
>
> But it didn't find that answer. Is it the case that the FD variables can only
> be positive?
>
> If that's the case, is there a workaround?
>
> Daniel
>