-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLP(ℤ) in multiple files #36
Comments
Currently, it is only a single file. Conceptually, we can distinguish at least the following parts, occurring roughly in this order in the source file:
Are you interested in any of these portions in particular? Please let me know any time if you have any questions! Personally, I think the part that would most benefit from improvements is constraint propagation. For instance, we have: % X + Y = Z run_propagator(pplus(X,Y,Z,Morph), MState) --> ( nonvar(X) -> ( X =:= 0 -> kill(MState), Y = Z ; Y == Z -> kill(MState), X =:= 0 ; nonvar(Y) -> kill(MState), Z is X + Y ; nonvar(Z) -> kill(MState), Y is Z - X ; { fd_get(Z, ZD, ZPs), fd_get(Y, YD, _), domain_shift(YD, X, Shifted_YD), domains_intersection(ZD, Shifted_YD, ZD1) }, et cetera This is really subpar. The code is lengthy and error-prone, and uses impure constructs that are known to be incomplete, a rich source of mistakes that, due to their rarity, can be very hard to find even by exhaustive testing. Can we do better than this? I sure hope so! Let's stay with propagation of elementary arithmetic constraints, like addition. What must hold for the domains of I would much prefer if a lot more of the code were generated from shorter declarative descriptions. This would also simplify it and make it easier to understand. |
Current
clpz
is one file of 7.6k lines, I'm having trouble using/understanding it.Is there a version of
clpz
in multiple files? If no, any advice on how to split it?The text was updated successfully, but these errors were encountered: