zlacker

[return to "Can logic programming be liberated from predicates and backtracking? [pdf]"]
1. 2-3-7-+UA2[view] [source] 2024-10-13 09:39:31
>>matt_d+(OP)
Is this about the problem that Prolog tends to ping pong infinitely between leafs? I wrote a fully declarative solitaire game solver and remember this being a big issue forcing me to memorize past states of the backtracking and basically exclude them by another predicate. This is obviously slow. I thought, why not at least have a plugin to avoid trivial cases where backtracking gets stuck switching between A and B. Or a plugin for a stochastic traversal of the solution tree.
◧◩
2. usgrou+6Q2[view] [source] 2024-10-13 12:38:31
>>2-3-7-+UA2
There are. Tabling (available in most mature implementations) helps when recalculation of the same states is a problem. Meanwhile, custom search strategy is always an option to implement directly in Prolog. You'll see this in many Advent of Code solutions in Prolog when it is applied to path finding puzzles, in which depth first search is rarely a workable solution.
[go to top]