Skip to content
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

Getting Inexact Errors from NOMAD.jl when tuning Integer and Boolean variables #48

Open
MonssafToukal opened this issue Nov 3, 2021 · 5 comments
Assignees

Comments

@MonssafToukal
Copy link

I sometimes obtain the following error when using integer and boolean inputs. From my perspective, it seems to happen randomly, but I am not sure. I will sometimes rerun NOMAD.jl and I won't get an error. Here is a recent stacktrace:

ERROR: LoadError: InexactError: Bool(1.00000000000003)                                                         [29/1822]Stacktrace:                                                                                                               [1] Bool                                                                                                                  @ ./float.jl:106 [inlined]                                                                                            [2] convert                                                                                                               @ ./number.jl:7 [inlined]                                                                                             [3] set_default!(parameter::AlgorithmicParameter{Bool, BinaryRange{Bool}}, new_value::Float64)
    @ Main ~/ParameterTuningInterface/src/parameters.jl:38
  [4] (::var"#14#17")(::Tuple{AlgorithmicParameter{Bool, BinaryRange{Bool}}, Float64})
    @ Main ./none:0
  [5] iterate
    @ ./generator.jl:47 [inlined]
  [6] collect_to!(dest::Vector{Real}, itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{AlgorithmicParameter}, Vector{Float64}}}, var"#14#17"}, offs::Int64, st::Tuple{Int64, Int64})
    @ Base ./array.jl:724
  [7] collect_to!(dest::Vector{Int64}, itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{AlgorithmicParameter}, Vector{Float64}}}, var"#14#17"}, offs::Int64, st::Tuple{Int64, Int64})
    @ Base ./array.jl:732
  [8] collect_to_with_first!(dest::Vector{Int64}, v1::Int64, itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{AlgorithmicParameter}, Vector{Float64}}}, var"#14#17"}, st::Tuple{Int64, Int64})
    @ Base ./array.jl:702
  [9] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{AlgorithmicParameter}, Vector{Float64}}}, var"#14#17"})
    @ Base ./array.jl:683
 [10] obj
    @ ~/ParameterTuningInterface/src/parameters.jl:103 [inlined]
 [11] obj
    @ ~/ParameterTuningInterface/src/parameters.jl:103 [inlined]

To fix the issue, I had to do a convert(Bool, round(Int64, value)).

Any ideas? I am curious why it seems to happen arbitrarily.

@MonssafToukal MonssafToukal changed the title Getting Inexact Errors from NOMAD.jl when tunin Integer and Boolean variables Getting Inexact Errors from NOMAD.jl when tuning Integer and Boolean variables Nov 3, 2021
@salomonl
Copy link
Collaborator

salomonl commented Nov 3, 2021

@MonssafToukal Could you provide a simple blackbox example ?

@amontoison
Copy link
Collaborator

@MonssafToukal Is it the output of the blackbox 1.00000000000003 ?
Did you specify that it's a Boolean variable in NOMAD.jl ?

@tmigot
Copy link
Contributor

tmigot commented Nov 6, 2021

Hey @salomonl and @amontoison
I don't think there is something about specifying integer or boolean in the documentation that would be really a great add-on if that's possible with Nomad.jl!

@salomonl
Copy link
Collaborator

salomonl commented Nov 6, 2021

https://bbopt.github.io/NOMAD.jl/dev/nomadProblem/ : see input_types.

But yes, we should precise that all inputs of a blackbox for Nomad will be considered as Float64 ( for example, x1 = true => x1 = 1). It is a convention of the C++ interface, which makes it easy to implement different types.

@MonssafToukal
Copy link
Author

MonssafToukal commented Nov 6, 2021

Hi @salomonl ! Sorry for the late reply. Indeed, the input_types for my boolean and my integer variables are respectively "B"and "I" as mentioned in the documentation. I will try to reproduce the error with a simple program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants