<block>:3:1-19: error: unsafe variables in: head_pred(Stop,1):-[#inc_bias].
Jaraxxus-Me opened this issue · 4 comments
Hi,
Thanks for this great work!
I'm trying to use Popper in my custom domain.
Specifically, I'm trying to induce rules about the actions of some agents and their relationships.
I start by providing the bias.pl
, bk.pl
, and exs.pl
files.
The bias.pl
looks like:
%% domain ontology
head_pred(Stop,1).
body_pred(IsPedestrian,1).
body_pred(IsCar,1).
body_pred(IsAmbulance,1).
body_pred(IsBus,1).
body_pred(IsPolice,1).
body_pred(IsTiro,1).
body_pred(IsReckless,1).
body_pred(IsOld,1).
body_pred(IsYoung,1).
body_pred(IsAtInter,1).
body_pred(IsInInter,1).
body_pred(IsClose,2).
body_pred(HigherPri,2).
body_pred(CollidingClose,2).
body_pred(LeftOf,2).
body_pred(RightOf,2).
body_pred(NextTo,2).
body_pred(See,2).
When I run the popper.py
, I got the error message:
<block>:3:1-19: error: unsafe variables in:
head_pred(Stop,1):-[#inc_bias].
<block>:3:11-15: note: 'Stop' is unsafe
<block>:4:1-27: error: unsafe variables in:
body_pred(IsPedestrian,1):-[#inc_bias].
<block>:4:11-23: note: 'IsPedestrian' is unsafe
<block>:5:1-20: error: unsafe variables in:
body_pred(IsCar,1):-[#inc_bias].
<block>:5:11-16: note: 'IsCar' is unsafe
<block>:6:1-26: error: unsafe variables in:
body_pred(IsAmbulance,1):-[#inc_bias].
<block>:6:11-22: note: 'IsAmbulance' is unsafe
<block>:7:1-20: error: unsafe variables in:
body_pred(IsBus,1):-[#inc_bias].
<block>:7:11-16: note: 'IsBus' is unsafe
<block>:8:1-23: error: unsafe variables in:
body_pred(IsPolice,1):-[#inc_bias].
<block>:8:11-19: note: 'IsPolice' is unsafe
<block>:9:1-21: error: unsafe variables in:
body_pred(IsTiro,1):-[#inc_bias].
<block>:9:11-17: note: 'IsTiro' is unsafe
<block>:10:1-25: error: unsafe variables in:
body_pred(IsReckless,1):-[#inc_bias].
<block>:10:11-21: note: 'IsReckless' is unsafe
<block>:11:1-20: error: unsafe variables in:
body_pred(IsOld,1):-[#inc_bias].
<block>:11:11-16: note: 'IsOld' is unsafe
<block>:12:1-22: error: unsafe variables in:
body_pred(IsYoung,1):-[#inc_bias].
<block>:12:11-18: note: 'IsYoung' is unsafe
<block>:13:1-24: error: unsafe variables in:
body_pred(IsAtInter,1):-[#inc_bias].
<block>:13:11-20: note: 'IsAtInter' is unsafe
<block>:14:1-24: error: unsafe variables in:
body_pred(IsInInter,1):-[#inc_bias].
<block>:14:11-20: note: 'IsInInter' is unsafe
<block>:15:1-22: error: unsafe variables in:
body_pred(IsClose,2):-[#inc_bias].
<block>:15:11-18: note: 'IsClose' is unsafe
<block>:16:1-24: error: unsafe variables in:
body_pred(HigherPri,2):-[#inc_bias].
<block>:16:11-20: note: 'HigherPri' is unsafe
<block>:17:1-29: error: unsafe variables in:
body_pred(CollidingClose,2):-[#inc_bias].
<block>:17:11-25: note: 'CollidingClose' is unsafe
<block>:18:1-21: error: unsafe variables in:
body_pred(LeftOf,2):-[#inc_bias].
<block>:18:11-17: note: 'LeftOf' is unsafe
<block>:19:1-22: error: unsafe variables in:
body_pred(RightOf,2):-[#inc_bias].
<block>:19:11-18: note: 'RightOf' is unsafe
<block>:20:1-21: error: unsafe variables in:
body_pred(NextTo,2):-[#inc_bias].
<block>:20:11-17: note: 'NextTo' is unsafe
<block>:21:1-18: error: unsafe variables in:
body_pred(See,2):-[#inc_bias].
<block>:21:11-14: note: 'See' is unsafe
<block>:23:1-21: error: unsafe variables in:
type(Stop,(state,)):-[#inc_bias].
<block>:23:6-10: note: 'Stop' is unsafe
Traceback (most recent call last):
File "/home/airlabbw/ext/Popper/popper.py", line 7, in <module>
settings = Settings(cmd_line=True)
File "/home/airlabbw/ext/Popper/popper/util.py", line 307, in __init__
solver.ground([('bias', [])])
File "/home/airlabbw/anaconda3/lib/python3.9/site-packages/clingo/control.py", line 476, in ground
_handle_error(
File "/home/airlabbw/anaconda3/lib/python3.9/site-packages/clingo/_internal.py", line 75, in _handle_error
raise RuntimeError(msg)
RuntimeError: grounding stopped because of errors
I'm not sure where is wrong, could you provide some guidance on this? Thanks!
Thanks for the swift reply!
Lowercase worked!
May I also ask how Popper handles disjunction?
Say, my rule is like:
stop(V0):-(iscar(V0)^colliding(V1))v(iscar(V0)^isatinter(V0)^isininter(V1))
I tried the default parameter, but can't find a solution. Not sure if this is because I didn't enable disjunction.
Popper will learn two rules, which form a disjunction:
stop(V0):-iscar(V0),colliding(V1).
stop(V0):-iscar(V0),isatinter(V0),isininter(V1).
I see, thanks for the clarification.
I find the outputs are:
16:46:21 Generating programs of size: 2
16:46:21 Generating programs of size: 3
16:46:21 Generating programs of size: 4
16:46:23 Generating programs of size: 5
NO SOLUTION
Num. programs: 55806
Test:
Called: 55806 times Total: 16.28 Mean: 0.0003 Max: 0.053 Percentage: 58%
Constrain:
Called: 55806 times Total: 5.45 Mean: 0.0001 Max: 0.525 Percentage: 19%
Generate:
Called: 55807 times Total: 4.11 Mean: 0.0001 Max: 0.026 Percentage: 14%
Load Data:
Called: 1 times Total: 1.77 Mean: 1.7666 Max: 1.767 Percentage: 6%
Init:
Called: 2 times Total: 0.01 Mean: 0.0069 Max: 0.014 Percentage: 0% 16:52 20-Mar-24
Total operation time: 27.62s
Total execution time: 28.60s
I have changed the default arguments MAX_VARS=3, MAX_BODY=4
, in this case, what does the "program size" mean? Does it mean the number of rules that form a disjunction?