Skip to content

Commit

Permalink
skip the RNG-related parameters; seed has to be set manually by the u…
Browse files Browse the repository at this point in the history
…ser if needed
  • Loading branch information
robertfeldt committed Dec 21, 2023
1 parent bf1d644 commit f3b8a2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/default_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ const DefaultParameters = ParamsDict(
:CallbackFunction => x -> x, # Function to callback to, here just the identity function.
:CallbackInterval => -1.0, # Minimum number of seconds between consecutive callbacks. If <0.0 we never callback (which is the default).

:RandomizeRngSeed => true, # Randomize the RngSeed value before using any random numbers.
:RngSeed => 1234, # The specific random seed to set before any random numbers are generated. The seed is randomly selected if RandomizeRngSeed is true, and this parameter is updated with its actual value.

:PopulationSize => 50
)

Expand Down
7 changes: 4 additions & 3 deletions src/opt_controller.jl
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,11 @@ function update_parameters!(oc::OptController, parameters::Parameters = EMPTY_DI
end

function init_rng!(parameters::Parameters)
if parameters[:RandomizeRngSeed]
parameters[:RngSeed] = rand(1:1_000_000)
if haskey(parameters, :RandomizeRngSeed)
warn("Parameter RandomizeRngSeed is obsolete and no longer have an effect; you need to set the seed yourself before calling into BlackBoxOptim.")
elseif haskey(parameters, :RngSeed)
warn("Parameter RngSeed is obsolete and no longer have an effect; you need to set the seed yourself before calling into BlackBoxOptim.")
end
Random.seed!(parameters[:RngSeed])
end

"""
Expand Down

0 comments on commit f3b8a2b

Please sign in to comment.