-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix InexactError on conversion for HiGHS solver #26
Conversation
thanks |
Bump :) |
Also a gentle bump on this: would be nice to be able to experiment with other solvers. |
Unfortunately julia> round(Bool, 0.9)
ERROR: MethodError: no method matching trunc(::Type{Bool}, ::Float64)
Closest candidates are:
trunc(::Type{Signed}, ::Float64) at /Applications/Julia-1.7.3.app/Contents/Resources/julia/share/julia/base/float.jl:358
trunc(::Type{T}, ::Missing) where T at /Applications/Julia-1.7.3.app/Contents/Resources/julia/share/julia/base/missing.jl:154
trunc(::Type{T}, ::Rational) where T at /Applications/Julia-1.7.3.app/Contents/Resources/julia/share/julia/base/rational.jl:455
...
Stacktrace:
[1] round(#unused#::Type{Bool}, x::Float64)
@ Base ./float.jl:369
[2] top-level scope
@ REPL[2]:1
julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, westmere) |
Also it's not supported in |
I guess it could be conditionally added to LayeredLayouts by copying over its definition from Base: if VERSION < v"1.8"
round(::Type{Bool}, x::AbstractFloat) = (-0.5 <= x < 1.5) ? 0.5 < x : throw(InexactError(:round, Bool, x))
end Alternatively, we could change |
@mtfishman please open new errors rather than commenting on PRs merged months ago. |
Fixes to work on pre-julia 1.7 As pointed out by @mtfishman in #26 (comment)
Sorry @oxinabox! It annoys me when people do that as well... Just wanted to comment before I forgot, I was planning on raising an issue/making a PR. |
I was trying out the HiGHS solver as an alternative to Cbc via
For certain problems, this threw the following error:
I imagine that the assumption that
value(isbefore[n1][n2])
is an integer is not necessarily true for all solvers. This is a suggested fix for those cases.