lanl-ansi / Alpine.jl

A Julia/JuMP-based Global Optimization Solver for Non-convex Programs
https://lanl-ansi.github.io/Alpine.jl/latest/
Other
241 stars 39 forks source link

Felipemarkson/issue221 #222

Closed felipemarkson closed 1 year ago

felipemarkson commented 1 year ago

This PR fixes #221.

The problem in #221 was an evaluation in expr_resolve_const of an empty sum expression +() that JuMP adds by default.

A new function called expr_is_emptysum is added to the Alpine to check if the expression is an invalid empty sum +() that couldn't be evaluated.

If the expression is an empty sum, the expr_resolve_const substitute this with a zero-equivalent expression :(0).

This PR also adds unit tests for the new expr_is_emptysum and a test for the example in #221.

NOTE: There could be a better strategy to identify an empty sum expression. But this PR solves the problem for now.

cc @Ibrahim-a-Ibrahim

codecov[bot] commented 1 year ago

Codecov Report

Merging #222 (7abfeff) into master (c6da8b9) will increase coverage by 0.17%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   87.24%   87.42%   +0.17%     
==========================================
  Files          16       16              
  Lines        2988     2991       +3     
==========================================
+ Hits         2607     2615       +8     
+ Misses        381      376       -5     
Impacted Files Coverage Δ
src/nlexpr.jl 91.50% <100.00%> (+0.06%) :arrow_up:
src/presolve.jl 88.19% <0.00%> (+3.10%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

odow commented 1 year ago

I have a fix for JuMP: https://github.com/jump-dev/JuMP.jl/pull/3091, but we should still implement this work-around in Alpine for now.

felipemarkson commented 1 year ago

This should take this amount of time to finished the CI?

It is taking 5 hours...

harshangrjn commented 1 year ago

Merged into #224