PrologError: error(resource_error(stack)...) in Popper v2.0.0
Closed this issue · 1 comments
hakank commented
The following examples throws an error.
bias.pl
max_vars(6).
max_body(4).
max_clauses(4).
% head
head_pred(target,2).
type(target,(element,element)).
direction(target,(in,out)).
% body
body_pred(target,2).
type(target,(element,element)).
direction(target,(in,out)).
body_pred(succ,2).
type(succ,(element,element)).
direction(succ,(in,out)).
bk.pl (empty)
exs.pl
pos(target(1,3)).
pos(target(2,5)).
pos(target(3,7)).
pos(target(4,10)).
pos(target(5,9)).
pos(target(6,8)).
pos(target(7,9)).
pos(target(8,10)).
pos(target(9,10)).
neg(target(3,1)).
neg(target(7,1)).
neg(target(2,2)).
neg(target(8,2)).
neg(target(4,3)).
neg(target(9,3)).
neg(target(4,0)).
neg(target(10,4)).
neg(target(5,5)).
neg(target(6,5)).
The error:
$ time python3 popper.py hakank/less_than
23:10:08 Num. pos examples: 9
23:10:08 Num. neg examples: 10
23:10:08 Searching programs of size: 2
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:1 fn:8 size:2
23:10:08 target(A,B):- succ(A,B).
23:10:08 ********************
23:10:08 Searching programs of size: 3
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:5 fn:4 size:5
23:10:08 target(A,B):- succ(A,B).
23:10:08 target(A,B):- succ(C,B),succ(A,C).
23:10:08 ********************
23:10:08 Searching programs of size: 4
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:6 fn:3 size:9
23:10:08 target(A,B):- succ(A,B).
23:10:08 target(A,B):- succ(C,B),succ(A,C).
23:10:08 target(A,B):- succ(C,D),succ(A,C),succ(D,B).
23:10:08 ********************
Traceback (most recent call last):
File "popper.py", line 8, in <module>
prog, score, stats = learn_solution(settings)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/loop.py", line 198, in learn_solution
timeout(settings, popper, (settings,), timeout_duration=int(settings.timeout),)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/util.py", line 65, in timeout
result = func(*args, **kwargs)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/loop.py", line 83, in popper
pos_covered, inconsistent = tester.test_prog(prog)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/tester.py", line 83, in test_prog
pos_covered = frozenset(self.query('pos_covered(Xs)', 'Xs'))
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/tester.py", line 14, in query
return set(next(self.prolog.query(query))[key])
File "/usr/local/lib/python3.7/site-packages/pyswip/prolog.py", line 129, in __call__
"Returned: '", str(term), "'."]))
pyswip.prolog.PrologError: Caused by: 'pos_covered(Xs)'. Returned: 'error(resource_error(stack), Atom('27909')(stack_overflow, 6340089, choicepoints, 6340095, depth, 6340092, environments, 49582, globalused, 990639, localused, [Functor(565645,3,6340095,:(user, target(6340092, 9)),[]), Functor(565645,3,6340094,:(user, target(6340091, 9)),[])], non_terminating, 1048576, stack_limit, 0, trailused))'.
(Perhaps this is related to #43?)
andrewcropper commented
Same as #43. Remove body_pred(target,2) from the bias file and add enable_recursion.
I’ll add a guard to prevent people from adding both head_pred(P,A) and body_pred(P,A) for some P.
Kind regards,
Andrew
… On 2 Jun 2022, at 22:14, Hakan Kjellerstrand ***@***.***> wrote:
The following examples throws an error.
bias.pl
max_vars(6).
max_body(4).
max_clauses(4).
% head
head_pred(target,2).
type(target,(element,element)).
direction(target,(in,out)).
% body
body_pred(target,2).
type(target,(element,element)).
direction(target,(in,out)).
body_pred(succ,2).
type(succ,(element,element)).
direction(succ,(in,out)).
bk.pl (empty)
exs.pl
pos(target(1,3)).
pos(target(2,5)).
pos(target(3,7)).
pos(target(4,10)).
pos(target(5,9)).
pos(target(6,8)).
pos(target(7,9)).
pos(target(8,10)).
pos(target(9,10)).
neg(target(3,1)).
neg(target(7,1)).
neg(target(2,2)).
neg(target(8,2)).
neg(target(4,3)).
neg(target(9,3)).
neg(target(4,0)).
neg(target(10,4)).
neg(target(5,5)).
neg(target(6,5)).
The error:
$ time python3 popper.py hakank/less_than
23:10:08 Num. pos examples: 9
23:10:08 Num. neg examples: 10
23:10:08 Searching programs of size: 2
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:1 fn:8 size:2
23:10:08 target(A,B):- succ(A,B).
23:10:08 ********************
23:10:08 Searching programs of size: 3
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:5 fn:4 size:5
23:10:08 target(A,B):- succ(A,B).
23:10:08 target(A,B):- succ(C,B),succ(A,C).
23:10:08 ********************
23:10:08 Searching programs of size: 4
23:10:08 ********************
23:10:08 New best hypothesis:
23:10:08 tp:6 fn:3 size:9
23:10:08 target(A,B):- succ(A,B).
23:10:08 target(A,B):- succ(C,B),succ(A,C).
23:10:08 target(A,B):- succ(C,D),succ(A,C),succ(D,B).
23:10:08 ********************
Traceback (most recent call last):
File "popper.py", line 8, in <module>
prog, score, stats = learn_solution(settings)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/loop.py", line 198, in learn_solution
timeout(settings, popper, (settings,), timeout_duration=int(settings.timeout),)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/util.py", line 65, in timeout
result = func(*args, **kwargs)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/loop.py", line 83, in popper
pos_covered, inconsistent = tester.test_prog(prog)
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/tester.py", line 83, in test_prog
pos_covered = frozenset(self.query('pos_covered(Xs)', 'Xs'))
File "/home/hakank/inductive_programming/andrewcropper/popper/Popper/popper/tester.py", line 14, in query
return set(next(self.prolog.query(query))[key])
File "/usr/local/lib/python3.7/site-packages/pyswip/prolog.py", line 129, in __call__
"Returned: '", str(term), "'."]))
pyswip.prolog.PrologError: Caused by: 'pos_covered(Xs)'. Returned: 'error(resource_error(stack), Atom('27909')(stack_overflow, 6340089, choicepoints, 6340095, depth, 6340092, environments, 49582, globalused, 990639, localused, [Functor(565645,3,6340095,:(user, target(6340092, 9)),[]), Functor(565645,3,6340094,:(user, target(6340091, 9)),[])], non_terminating, 1048576, stack_limit, 0, trailused))'.
(Perhaps this is related to #43?)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.