potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
599 stars 79 forks source link

unexpected warning message "info: operation undefined" #428

Closed maliabd-al-majid closed 1 year ago

maliabd-al-majid commented 1 year ago

I have tried this simple program: #const l=2. neg(G,V):- neg(G),val(G,X),V=l-1-X. 1{val( a,0..(l-1))}1. 1{val( b,0..(l-1))}1. neg(b). val(min1, R):- R = #min { Y : val(a, Y);X:neg(b, X)}.

I keep getting a warning:

-:3:34-35: info: operation undefined: (-1*X+1)

this warning appears only whenever I use the 'neg rule', due to the calculation there.

is there a way to hide this warning, or to reformulate the program to avoid getting it?

thanks in advance.

rkaminsk commented 1 year ago

You can use option -Wno-operation-undefined to suppress the warning.

Since your min aggregate has at least one element, you can safely add R !=#sup to the body of the last rule:

val(min1, R):- R = #min { Y : val(a, Y);X:neg(b, X)}, R !=#sup.
maliabd-al-majid commented 1 year ago

thanks alot for your reply.