lanl-ansi / Alpine.jl

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

fix assumption that deep copied 0-field mutable structs compare equal #132

Closed KristofferC closed 5 years ago

KristofferC commented 5 years ago

When running the tests for this package on the upcoming 1.3 release I got the error:

solverstring = "Alpine.UnsetSolver()"
Partitioning variable selection tests :: nlp3: Error During Test at /root/.julia/packages/Alpine/yThaY/test/solver.jl:18
  Got exception outside of a @test
  Unsupported MINLP local solver Alpine.UnsetSolver(); use a Alpine-supported MINLP local solver

I tracked it down to the following issue https://github.com/JuliaLang/julia/issues/33359.

This PR works around the problem.

codecov[bot] commented 5 years ago

Codecov Report

Merging #132 into master will increase coverage by <.01%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #132      +/-   ##
==========================================
+ Coverage   77.08%   77.09%   +<.01%     
==========================================
  Files          15       15              
  Lines        3155     3152       -3     
==========================================
- Hits         2432     2430       -2     
+ Misses        723      722       -1
Impacted Files Coverage Δ
src/solver.jl 97.83% <ø> (+0.39%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4078aaf...6412ae0. Read the comment docs.

KristofferC commented 5 years ago

On more careful examination, this is the result of a bugfix in deepcopy with mutable structs being considered non-singleton (https://github.com/JuliaLang/julia/pull/31825).

The lines at:

https://github.com/lanl-ansi/Alpine.jl/blob/4078aafa4b1debe947355b9c6e38faef8a5acd1c/src/solver.jl#L485-L487

makes the check for == with empty_solver be false. I believe this is a correct bugfix for the problem shown by the test failure.

harshangrjn commented 5 years ago

Thanks @KristofferC for catching this.