[SCIP] Buggy bools in SCIPinferBinvarProp

Alex Meiburg timeroot.alex at gmail.com
Wed Jul 6 00:06:58 CEST 2022


Hi all,

I recently ran into an issue with SCIPinferBinvarProp. Admittedly, one that
would have been caught by enabling assertions, but it took me far too long
to track the logical error down, and I didn't have them enabled...

SCIPinferBinvarProp takes a SCIP_Bool as the value to fix a binary variable
to. It then does several things that you're not really "supposed" to do in
C: it checks "if( fixedval == TRUE )" and uses "(SCIP_Real)fixedval" to
convert to a 0/1 value. This is technically correct given the assertion at
the front, "assert(fixedval == TRUE || fixedval == FALSE);", which would
complain if the value wasn't 0 or 1.

This was my mistake, I was using an FFI and my boolean true got converted
to -1, and got counted as false.

Is this a wontfix kind of situation, where SCIP just says that users really
must 0 or 1 everywhere? While that's perfectly fine if so, it would be nice
if it was explicitly stated some more obvious place(s), especially
considering that some standard C functions like islower don't use the
convention either. :)

If SCIP aims to support non-0/1 bools, then I guess this is a bug report
instead. Either way, not a big deal, just wanted to bring a bit of
awareness.

-- Alexander Meiburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20220705/7ef076d9/attachment.html>


More information about the Scip mailing list