prolog-tabling

Anytime strongly connected components via Prolog

回眸只為那壹抹淺笑 提交于 2020-01-25 09:18:04
问题 Markus Triska has reported an algorithm to determine strongly connected components (SCC). Is there a solution which determines the SCC without making use of attributed variable and that can work anytime. So that some vertices can have infinitely many edges? I am asking because I am wondering whether B-Prologs anytime tabling which they call eager can be replicated. B-Prolog determines clusters which is their name for SCC. But it has also a tabling mode where it returns tabled results eagerly.

Uneven tabling performance in BProlog 8.1

…衆ロ難τιáo~ 提交于 2019-12-19 19:50:06
问题 I did a few experiments with the tabling capabilities of b-prolog version 8.1 and was quite surprised by the performance I observed. Here is the code that I used. It counts the number of Collatz steps N required for reducing some positive integer I down to 1 : %:- table posInt_CollatzSteps/2. % remove comment to enable tabling posInt_CollatzSteps(I,N) :- ( I == 1 -> N = 0 % base case ; 1 is I /\ 1 -> I0 is I*3+1, posInt_CollatzSteps(I0,N0), N is N0+1 % odd ; I0 is I>>1, posInt_CollatzSteps(I0

Bounded tabling

痞子三分冷 提交于 2019-12-10 15:32:49
问题 Quite recently, I started playing around with tabling in Prolog; some experiments that I did with b-prolog and xsb can be found in this question. With the tables getting bigger and bigger, I realized that I needed to find some tabling options / parameters that would allow me to limit the amount of memory dedicated to tabling. So far, I didn't find anything suitable in the manuals of yap, b-prolog and xsb. Could you please pinpoint me to some useful information? 回答1: In the case of YAP, there

Removing left recursion in DCG - Prolog

自闭症网瘾萝莉.ら 提交于 2019-12-06 02:14:01
问题 I've got a small problem with left recursion in this grammar. I'm trying to write it in Prolog, but I don't know how to remove left recursion. <expression> -> <simple_expression> <simple_expression> -> <simple_expression> <binary_operator> <simple_expression> <simple_expression> -> <function> <function> -> <function> <atom> <function> -> <atom> <atom> -> <number> | <variable> <binary_operator> -> + | - | * | / expression(Expr) --> simple_expression(SExpr), { Expr = SExpr }. simple_expression