Skip to content

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

Closed

Description

@MonssafToukal

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.

Activity

  1. 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[/+] on Nov 3, 2021
  2. salomonl commented on Nov 3, 2021

    @salomonl
    Collaborator

    @MonssafToukal Could you provide a simple blackbox example ?

  3. amontoison commented on Nov 4, 2021

    @amontoison
    Collaborator

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

  4. tmigot commented on Nov 6, 2021

    @tmigot
    Contributor

    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!

  5. salomonl commented on Nov 6, 2021

    @salomonl
    Collaborator

    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.

  6. MonssafToukal commented on Nov 6, 2021

    @MonssafToukal
    Author

    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.

  7. salomonl commented on Oct 22, 2026

    @salomonl
    Collaborator

    Closed :no feedback since 2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions