coin-or / Couenne

Convex Over and Under Envelopes for Nonlinear Estimation
Eclipse Public License 1.0
74 stars 8 forks source link

segmentation fault in CouenneConstraint::standardize #29

Open svigerske opened 5 years ago

svigerske commented 5 years ago

Issue created by migration from Trac.

Original creator: @svigerske

Original creation time: 2014-10-31 10:50:45

Assignee: @merraksh

Version:

With stable/0.4 at 6fa6a0cfda and additionally 0cec0bfe85 and e73d1eccb3, I get a segfault of Couenne during reformulation. This is the valgrind message:

==6141== Invalid read of size 8
==6141==    at 0x7543914: Couenne::CouenneConstraint::standardize(Couenne::CouenneProblem*) (constrStandardize.cpp:96)
==6141==    by 0x754879B: Couenne::CouenneProblem::standardize() (standardize.cpp:272)
==6141==    by 0x75347FE: Couenne::CouenneProblem::reformulate(Couenne::CouenneCutGenerator*) (reformulate.cpp:77)
==6141==    by 0x71D5437: Couenne::CouenneSetup::InitializeCouenne(char**, Couenne::CouenneProblem*, Ipopt::SmartPtr<Bonmin::TMINLP>, Couenne::CouenneInterface*, Bonmin::Bab*) (BonCouenneSetup.cpp:256)
==6141==  Address 0x61b4fa0 is 0 bytes inside a block of size 24 free'd
==6141==    at 0x4C2B6D0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6141==    by 0x75568B9: Couenne::exprDiv::~exprDiv() (CouenneExprDiv.hpp:24)
==6141==    by 0x74F0B7B: Couenne::Simplified(Couenne::expression*) (CouenneExpression.hpp:328)
==6141==    by 0x75438F5: Couenne::CouenneConstraint::standardize(Couenne::CouenneProblem*) (constrStandardize.cpp:93)
==6141==    by 0x754879B: Couenne::CouenneProblem::standardize() (standardize.cpp:272)
==6141==    by 0x75347FE: Couenne::CouenneProblem::reformulate(Couenne::CouenneCutGenerator*) (reformulate.cpp:77)
==6141==    by 0x71D5437: Couenne::CouenneSetup::InitializeCouenne(char**, Couenne::CouenneProblem*, Ipopt::SmartPtr<Bonmin::TMINLP>, Couenne::CouenneInterface*, Bonmin::Bab*) (BonCouenneSetup.cpp:256)

I also got a failure before mering 0cec0bfe85 and e73d1eccb3.

This is the problem instance as printed by Couenne:

objectives:
min ((0.5*(x_0*x_30))+(-0.5*(x_1*x_30))+(0.5*(x_0*x_31))+(-0.5*(x_2*x_31))+(0.5*(x_1*x_32))+(-0.5*(x_3*x_32))+(0.5*(x_2*x_33))+(-0.5*(x_4*x_33))+(0.5*(x_3*x_34))+(-0.5*(x_5*x_34))+
(0.5*(x_4*x_35))+(-0.5*(x_6*x_35))+(0.5*(x_5*x_36))+(-0.5*(x_7*x_36))+(0.5*(x_6*x_37))+(-0.5*(x_8*x_37))+(0.5*(x_7*x_38))+(-0.5*(x_9*x_38))+(0.5*(x_8*x_39))+(-0.5*(x_10*x_39))+
(0.5*(x_9*x_40))+(-0.5*(x_11*x_40))+(0.5*(x_10*x_41))+(-0.5*(x_12*x_41))+(0.5*(x_11*x_42))+(-0.5*(x_13*x_42))+(0.5*(x_12*x_43))+(-0.5*(x_14*x_43))+(0.5*(x_13*x_44))+(-0.5*(x_15*x_44))+
(0.5*(x_14*x_45))+(-0.5*(x_16*x_45))+(0.5*(x_15*x_46))+(-0.5*(x_17*x_46))+(0.5*(x_16*x_47))+(-0.5*(x_18*x_47))+(0.5*(x_17*x_48))+(-0.5*(x_19*x_48))+(0.5*(x_18*x_49))+(-0.5*(x_20*x_49))+
(0.5*(x_19*x_50))+(-0.5*(x_21*x_50))+(0.5*(x_20*x_51))+(-0.5*(x_22*x_51))+(0.5*(x_21*x_52))+(-0.5*(x_23*x_52))+(0.5*(x_22*x_53))+(-0.5*(x_24*x_53))+(0.5*(x_23*x_54))+(-0.5*(x_25*x_54))+
(0.5*(x_24*x_55))+(-0.5*(x_26*x_55))+(0.5*(x_25*x_56))+(-0.5*(x_27*x_56))+(0.5*(x_26*x_57))+(-0.5*(x_28*x_57))+(0.5*(x_27*x_58))+(-0.5*(x_29*x_58))+(0.5*(x_28*x_59))+(-0.5*(x_29*x_59))
)
constraints:
((-((x_0^-1)/-1))+x_30) = 0
((-((x_1^-1)/-1))+x_31) = 0
((-((x_2^-1)/-1))+x_32) = 0
((-((x_3^-1)/-1))+x_33) = 0
((-((x_4^-1)/-1))+x_34) = 0
((-((x_5^-1)/-1))+x_35) = 0
((-((x_6^-1)/-1))+x_36) = 0
((-((x_7^-1)/-1))+x_37) = 0
((-((x_8^-1)/-1))+x_38) = 0
((-((x_9^-1)/-1))+x_39) = 0
((-((x_10^-1)/-1))+x_40) = 0
((-((x_11^-1)/-1))+x_41) = 0
((-((x_12^-1)/-1))+x_42) = 0
((-((x_13^-1)/-1))+x_43) = 0
((-((x_14^-1)/-1))+x_44) = 0
((-((x_15^-1)/-1))+x_45) = 0
((-((x_16^-1)/-1))+x_46) = 0
((-((x_17^-1)/-1))+x_47) = 0
((-((x_18^-1)/-1))+x_48) = 0
((-((x_19^-1)/-1))+x_49) = 0
((-((x_20^-1)/-1))+x_50) = 0
((-((x_21^-1)/-1))+x_51) = 0
((-((x_22^-1)/-1))+x_52) = 0
((-((x_23^-1)/-1))+x_53) = 0
((-((x_24^-1)/-1))+x_54) = 0
((-((x_25^-1)/-1))+x_55) = 0
((-((x_26^-1)/-1))+x_56) = 0
((-((x_27^-1)/-1))+x_57) = 0
((-((x_28^-1)/-1))+x_58) = 0
((-((x_29^-1)/-1))+x_59) = 0
variables:
x_0 [ 5 , 5 ] integer
x_1 [ 5 , 100 ]
x_2 [ 5 , 100 ]
x_3 [ 5 , 100 ]
x_4 [ 5 , 100 ]
x_5 [ 5 , 100 ]
x_6 [ 5 , 100 ]
x_7 [ 5 , 100 ]
x_8 [ 5 , 100 ]
x_9 [ 5 , 100 ]
x_10 [ 5 , 100 ]
x_11 [ 5 , 100 ]
x_12 [ 5 , 100 ]
x_13 [ 5 , 100 ]
x_14 [ 5 , 100 ]
x_15 [ 5 , 100 ]
x_16 [ 5 , 100 ]
x_17 [ 5 , 100 ]
x_18 [ 5 , 100 ]
x_19 [ 5 , 100 ]
x_20 [ 5 , 100 ]
x_21 [ 5 , 100 ]
x_22 [ 5 , 100 ]
x_23 [ 5 , 100 ]
x_24 [ 5 , 100 ]
x_25 [ 5 , 100 ]
x_26 [ 5 , 100 ]
x_27 [ 5 , 100 ]
x_28 [ 5 , 100 ]
x_29 [ 100 , 100 ] integer
x_30 [ -1e+50 , 1e+50 ]
x_31 [ -1e+50 , 1e+50 ]
x_32 [ -1e+50 , 1e+50 ]
x_33 [ -1e+50 , 1e+50 ]
x_34 [ -1e+50 , 1e+50 ]
x_35 [ -1e+50 , 1e+50 ]
x_36 [ -1e+50 , 1e+50 ]
x_37 [ -1e+50 , 1e+50 ]
x_38 [ -1e+50 , 1e+50 ]
x_39 [ -1e+50 , 1e+50 ]
x_40 [ -1e+50 , 1e+50 ]
x_41 [ -1e+50 , 1e+50 ]
x_42 [ -1e+50 , 1e+50 ]
x_43 [ -1e+50 , 1e+50 ]
x_44 [ -1e+50 , 1e+50 ]
x_45 [ -1e+50 , 1e+50 ]
x_46 [ -1e+50 , 1e+50 ]
x_47 [ -1e+50 , 1e+50 ]
x_48 [ -1e+50 , 1e+50 ]
x_49 [ -1e+50 , 1e+50 ]
x_50 [ -1e+50 , 1e+50 ]
x_51 [ -1e+50 , 1e+50 ]
x_52 [ -1e+50 , 1e+50 ]
x_53 [ -1e+50 , 1e+50 ]
x_54 [ -1e+50 , 1e+50 ]
x_55 [ -1e+50 , 1e+50 ]
x_56 [ -1e+50 , 1e+50 ]
x_57 [ -1e+50 , 1e+50 ]
x_58 [ -1e+50 , 1e+50 ]
x_59 [ -1e+50 , 1e+50 ]
end

(cclinpts)

svigerske commented 5 years ago

Comment by @svigerske created at 2014-10-31 15:05:57

I get the same for

objectives:
min 
constraints:
((-((x_0^-1)/-1))+x_1) = 0
variables:
x_0 [ 100 , 100 ] integer
x_1 [ -1e+50 , 1e+50 ]
end

The awkward division by -1 seems to be the issue. When I have the constraint as

((1*(1/x_0))+x_30) = 0

it works fine.