fifth-postulate / julian

Date and time library for Prolog
The Unlicense
27 stars 3 forks source link

experiment with clpfd:contracting/1 #4

Closed mndrix closed 10 years ago

mndrix commented 11 years ago

This undocumented predicate in library(clpfd), suggested by Markus Triska, can help the solver more accurately constrain variable domains. For example,

?- form_time(2000-02-29,datetime(A,B)),
|  form_time(1999-_-_, datetime(C,D)),
|  clpfd:contracting([A,B,C,D]).
A = 51603,
B in 0..86399999999999,
C in 51179..51543,
...

Which constrains C to completely legitimate values. Without clpfd:contracting/1, the constraint on C contains is too broad, containing some values that are impossible.

mndrix commented 10 years ago

Since commit 2ef01576054e67706d59db67911b67686e8facf7 contracting/1 is no longer needed.