EAGO.jl icon indicating copy to clipboard operation
EAGO.jl copied to clipboard

Handling nonlinear expressions near domain violations

Open mewilhel opened this issue 4 years ago • 1 comments

Right now, we're using a fancy overloading approach to build relaxations of nonlinear terms. Expansiveness of the interval calculations can lead to intermediate terms containing an interval bound on which some functions aren't defined (e.g. sqrt on [-0.001, 10]). Two potential approaches to dealing with this:

  • Option 1: We move the user-defined function handling to contextual dispatch (Cassette.jl), move domain violation checks to wrapper functions in McCormick.jl around the computational kernel, have the contextual dispatch check the domain violation condition call the kernel on execution, if a domain violation occurs then set a flag in the contexts metadata and dispatch to trivial operations from there on out (unless there is a clearer way to return directly in Cassette). Update EAGO's logic to include branching when this flag is set to domain violation. As w(X) -> 0, the degree of overestimation should go to zero and eventually the routine should converge unless the model formulation itself has domain violations.
  • Option 2: Parse the expression graph of user-defined functions to introduce an equality constraint z = f(x) for sqrt(f(x)) (or a similar function), substituting in z for f(x) in the expression graph, and branch on z whenever a domain violation such that one resulting interval contains the domain violation Zbad (and the other one or two contain valid domains). You'd then need to use a domain reduction technique to fathom the interval containing the violation for all (Zbad,X). Possibly faster than Option 1.

mewilhel avatar Apr 09 '20 14:04 mewilhel

We've added a default safeguard to the McCormick.jl operators to address this.

Basically, z = y/x becomes MC{N,T}(union(y/Interval(x.Intv.lo,-MC_DOMAIN_TOL), y/Interval(MC_DOMAIN_TOL, x.Intv.hi))) this can be disable by setting const MC_DOMAIN_CATCH = false in line 81 of McCormick.jl. This is in place for /, inv, and pow functions. We'll need to look at hyperbolic functions and trig functions shortly.

mewilhel avatar Apr 09 '20 17:04 mewilhel