Closed JeanChristopheRohner closed 4 years ago
Currently, that's expected behaviour. The intervals in the constraint network reference each other via their attributes which contain a list of the constraints in which they're mentioned. That's how changes in one interval get propagated to others. But this results in an "indirect" cyclic structure, i.e., a graph, not a tree. attributes(write)
just passes the attribute to recursively to write
so it gets caught in an infinite loop which usually ends up in a crash (seg fault). portray
is the recommended value (set as default by clpBNR
) but obviously dots
or ignore
work as well.
Not too much I can do about it although it should probably be documented. And it's a bit tricky to check in write_term
because the cycles are indirect through attributes rather than just variable unification (which is what cyclic_term/1
and acyclic_term/1
check for). It's all a bit unsanitary but do you think it's a big issue?
Hi! "It's all a bit unsanitary but do you think it's a big issue?" No not at all, i just stumbled on it by accident and thought it might be useful to know (but you already did :-) ). Cheers/JC
Thanks. I'll try to remember to document this somewhere.
Just a heads up: I pushed a new version (0.9.2) to GitHub today. Nothing earth shattering, but a few enhancements (like print_interval
), bug fixes (corner cases in couple of the primitives), and optimizations. Also some additional User Guide material and cleanups there (https://ridgeworks.github.io/clpBNR_pl/CLP_BNR_Guide/CLP_BNR_Guide.html) ; probably going to work on reference material next.
Any feedback welcome.
Not sure if this is a bug or not but when i do
?- {X == 1.1}, write_term(X, [attributes(write)]).
i get a massive printout and then a crash (mac OS X Catalina, SWI-Prolog version 8.2.1, clpBNR 0.9.0). /JC