Re: clpfd constraints not taking effect
James Hogan <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAAG0J9837SKFSc8TZH_YtJQKf_08Bn05SmCOuKa-7=G1JMpf7g@mail.gmail.com> |
Hi Markus, On 18 August 2013 23:24, Markus Triska <[email protected]> wrote: > James Hogan <[email protected]> writes: > >> The last constraint doesn't seem to have taken effect B in 101..sup, >> but B < D, so D should be reduced to 102..sup. > > Very well, I have committed a change that makes this and other cases > behave as you expect with the example above. > > Note that in SWI-Prolog, CLP(FD) propagation always terminates, so you > still get for example: > > ?- X #> Y, Y #> X, X #> 0. > %@ X in 3..sup, > %@ X#=<Y+ -1, > %@ Y#=<X+ -1, > %@ Y in 4..sup. > > In this case, since X #> Y, we could constrain X to 5..sup. Moving on, > since Y #> X, we could then constrain Y to 6..sup, then X to 7..sup etc. > In SWI-Prolog, each involved constraint now gets a new propagation > opportunity when a new constraint is added. When unbounded domains are > involved, infinite propagation chains are (as before) avoided by > imposing certain restrictions on admissible domain changes. So there > necessarily are examples where the solver does not propagate fully. > > Please let me know how this works and whether you need anything else. Thanks for the patch. I gave it a spin, and tested before and after your change, but it appears that although it fixes the simple case, it makes my big case (with over 2000 constraints) go much slower (gets slower as it goes through the constraints, keeps stopping momentarily on a constraint), and then about half way it says: ERROR: Out of global stack Is there an expected limit of how many constraints you should be able to give it? Cheers James