[Couenne] compExpr fix
Pietro Belotti
petr.7b6 at gmail.com
Tue Nov 24 19:41:40 EST 2015
Hi Victor,
thanks for pointing this out. I guess this can only happen to
top-level auxiliaries, i.e. those associated with objective and
constraints. Regardless of this, the missing check is that the two
sign() results are equal for the second part of the condition. I have
fixed this in stable/0.4 and 0.5 and in trunk.
Regards,
Pietro
On Tue, Nov 24, 2015 at 12:58 AM, Victor Zverovich
<victor.zverovich at gmail.com> wrote:
> Hi,
>
> compExpr::operator() is broken - it can return true both for compExpr()(e0,
> e1) and compExpr()(e1, e0) if
>
> e0 -> sign () < e1 -> sign () and
> (e0 -> Image () != NULL) && (e1 -> Image () != NULL) and
> 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
>
>
> _______________________________________________
> Couenne mailing list
> Couenne at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/couenne
More information about the Couenne
mailing list