[Couenne] compExpr fix

Victor Zverovich victor.zverovich at gmail.com
Mon Nov 23 19:58:28 EST 2015


Hi,

compExpr::operator() is broken - it can return true both for compExpr()(e0,
e1) and compExpr()(e1, e0) if

   1. e0 -> sign () < e1 -> sign () and
   2. (e0 -> Image () != NULL) && (e1 -> Image () != NULL) and
   3. e1 -> Image () -> compare (*(e0 -> Image ())) < 0

and in some other cases.

This is easy to check by adding an assert

struct compExpr {
    inline bool compare (exprAux* e0, exprAux* e1) const
    {
      return ((e0 -> sign  () < e1 -> sign  ()) ||
              ((e0 -> Image () != NULL) && (e1 -> Image () != NULL) &&
(e0 -> Image () -> compare (*(e1 -> Image ())) < 0)));
    }
  inline bool operator () (exprAux* e0, exprAux* e1) const
  {
    bool result = compare(e0, e1);
    assert(!result || result != compare(e1, e0));
    return result;
  }
};

and running “counne toy.nl” where toy.nl is a test NL file from
Couenne/test/data.

The attached patch fixes the issue.

Best regards,
Victor
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/couenne/attachments/20151124/2ed3a496/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-compexpr.patch
Type: text/x-patch
Size: 1278 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/couenne/attachments/20151124/2ed3a496/attachment.bin>


More information about the Couenne mailing list