ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.

Home Page:https://dtai.cs.kuleuven.be/problog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative cycle detected.

romanilin325 opened this issue · comments

Hello all, I am new to problog. I keep getting NegativeCycle: Negative cycle detected but the error does not allow to trace to a particular statement in the problog program. Is there a way to get better debug information? What is the meaning of this error?

Can you share the full message? The NegativeCycle error (or Exception if you are using Python) should also print a line number and position.

For example, when entering the following program in our online tool:

0.5::a :- \+b.
0.5::b :- a.

query(a).
query(b).

The result is: NegativeCycle: Negative cycle detected at 1:11., which is the location where the negation is being used and a and b are a cycle through negation (and that is a paradoxical expression).

Thank you, yes there is line number in the error message! However, I cannot figure out what other statements in the program create the cycle. Is there any way to print the whole cycle?

In addition, when I use --combine option, something like

problog --combine file1.pl file2.pl
The error message does not even have the line number, it just says
NegativeCycle: Negative cycle detected.

There is no way currently to print out the exact cycle. Could you perhaps show the program that is causing the issue?