PSORLab / McCormick.jl

A forward McCormick operator library
MIT License
16 stars 7 forks source link

exp(x::MC) contains NaNs when x is degenerate #60

Closed StevenChui88 closed 1 year ago

StevenChui88 commented 1 year ago

I am a summer undergraduate research assistant working with Dr. Kamil Khan. We found that the concave relaxation of exp(x::MC) seems to be computed as NaN when x is degenerate. Presumably this is because of division by 0 in the secant formula in the concave relaxation of exp.

Example (using Julia v1.9.2 and McCormick.jl v0.13.4):

julia> using McCormick

julia> x = MC{1,NS}(2.0)
MC{1, NS}(2.0, 2.0, [2, 2], [0.0], [0.0], true)

julia> exp(x)
MC{1, NS}(7.38905609893065, NaN, [7.38905, 7.38906], [0.0], [NaN], true)

julia> exp(x).cc
NaN
DimitriAlston commented 1 year ago

Hey @StevenChui88. Apologies for the delayed response.

Thank you for pointing this out. We have made a change to the master branch that should address this issue. Previously, McCormick checked the difference between the exp of the interval rather than the difference between the interval itself and this led to additional floating-point operations which essentially ignored the degeneracy. We plan to look into the use of outward-rounded intervals in the future as a more extensive change.

There are a few other changes we have planned before we tag another release, so keep an eye out.