You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Get value (-lit=false, lit=true) of valid non-zero literal.
but it seems as though its actual behavior is flipped in the case that lit is negative, i.e. abs(lit) is returned when lit is true, and -abs(lit) is returned when lit is false. I get the impression that this behavior deviates from the above documentation (as well as from the IPASIR standard), am I mistaken?
Solver::val calls the ival function on External, which is implemented as follows:
Indeed, in case elit is negative and is also part of the assignment, then res is first set to -eidx (i.e. elit) on line 302, after which it is negated to eidx (i.e. -elit) on line 304.
The text was updated successfully, but these errors were encountered:
In general there was a misunderstanding between Tomas and me when we defined 'value' semantics in the IPASIR interface. At least I wanted to just return a ternary value (-1,0,1) as in PicoSAT, but then for some reason in IPASIR we defined value semantics to return for a literal 'lit' which is true 'lit' itself and otherwise if it is false its negation '-lit'.
but both tests fail when getting the value of '-1'.
Originally I only had the ternary version implemented and then later returned a literal, but probably, as you suggest , the wrong one in case literal is negative.
There is now a fix on the ccadical-val-issue-108 branch. We will incorporate this in the next release. For now the work-around is to not use negative literals in 'ccadical_val' or 'Solver::val'.
I'd love some guidance to understand the meaning of the return value of
ccadical_val
, particularly when the argument is a negative literal.ccadical_val
callsSolver::val
, which is documented ascadical/src/cadical.hpp
Line 289 in 2df7b7f
but it seems as though its actual behavior is flipped in the case that
lit
is negative, i.e.abs(lit)
is returned whenlit
is true, and-abs(lit)
is returned whenlit
is false. I get the impression that this behavior deviates from the above documentation (as well as from the IPASIR standard), am I mistaken?Solver::val
calls theival
function onExternal
, which is implemented as follows:cadical/src/external.hpp
Lines 294 to 306 in 2df7b7f
Indeed, in case
elit
is negative and is also part of the assignment, thenres
is first set to-eidx
(i.e.elit
) on line 302, after which it is negated toeidx
(i.e.-elit
) on line 304.The text was updated successfully, but these errors were encountered: