Skip to content

Commit 41f96f0

Browse files
authored
refactor: convert float32 options fields to float64 (#611)
1 parent 8c145c1 commit 41f96f0

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/OptionsStruct.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ struct Options{
216216
nested_constraints::Union{Vector{Tuple{Int,Int,Vector{Tuple{Int,Int,Int}}}},Nothing}
217217
complexity_mapping::CM
218218
tournament_selection_n::Int
219-
tournament_selection_p::Float32
220-
parsimony::Float32
221-
dimensional_constraint_penalty::Union{Float32,Nothing}
219+
tournament_selection_p::Float64
220+
parsimony::Float64
221+
dimensional_constraint_penalty::Union{Float64,Nothing}
222222
dimensionless_constants_only::Bool
223-
alpha::Float32
223+
alpha::Float64
224224
maxsize::Int
225225
maxdepth::Int
226226
turbo::Val{_turbo}
@@ -231,26 +231,26 @@ struct Options{
231231
should_optimize_constants::Bool
232232
output_directory::Union{String,Nothing}
233233
populations::Int
234-
perturbation_factor::Float32
234+
perturbation_factor::Float64
235235
annealing::Bool
236236
batching::Bool
237237
batch_size::Int
238238
mutation_weights::MW
239-
crossover_probability::Float32
240-
warmup_maxsize_by::Float32
239+
crossover_probability::Float64
240+
warmup_maxsize_by::Float64
241241
use_frequency::Bool
242242
use_frequency_in_tournament::Bool
243243
adaptive_parsimony_scaling::Float64
244244
population_size::Int
245245
ncycles_per_iteration::Int
246-
fraction_replaced::Float32
247-
fraction_replaced_hof::Float32
248-
fraction_replaced_guesses::Float32
246+
fraction_replaced::Float64
247+
fraction_replaced_hof::Float64
248+
fraction_replaced_guesses::Float64
249249
topn::Int
250250
verbosity::Union{Int,Nothing}
251251
v_print_precision::Val{print_precision}
252252
save_to_file::Bool
253-
probability_negate_constant::Float32
253+
probability_negate_constant::Float64
254254
nops::NOPS
255255
seed::Union{Int,Nothing}
256256
elementwise_loss::Union{SupervisedLoss,Function}
@@ -263,12 +263,12 @@ struct Options{
263263
progress::Union{Bool,Nothing}
264264
terminal_width::Union{Int,Nothing}
265265
optimizer_algorithm::Optim.AbstractOptimizer
266-
optimizer_probability::Float32
266+
optimizer_probability::Float64
267267
optimizer_nrestarts::Int
268268
optimizer_options::Optim.Options
269269
autodiff_backend::AD
270270
recorder_file::String
271-
prob_pick_first::Float32
271+
prob_pick_first::Float64
272272
early_stop_condition::Union{Function,Nothing}
273273
return_state::Val{_return_state}
274274
timeout_in_seconds::Union{Float64,Nothing}

src/Population.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ _get_cost(member::AbstractPopMember) = member.cost
175175

176176
const CACHED_WEIGHTS =
177177
let init_k = collect(0:5),
178-
init_prob_each = 0.5f0 * (1 - 0.5f0) .^ init_k,
178+
init_prob_each = 0.5 * (1 - 0.5) .^ init_k,
179179
test_weights = StatsBase.Weights(init_prob_each, sum(init_prob_each))
180180

181-
PerTaskCache{Dict{Tuple{Int,Float32},typeof(test_weights)}}()
181+
PerTaskCache{Dict{Tuple{Int,Float64},typeof(test_weights)}}()
182182
end
183183

184184
@unstable function get_tournament_selection_weights(@nospecialize(options::AbstractOptions))
185185
n = options.tournament_selection_n::Int
186-
p = options.tournament_selection_p::Float32
186+
p = options.tournament_selection_p::Float64
187187
# Computing the weights for the tournament becomes quite expensive,
188188
return get!(CACHED_WEIGHTS[], (n, p)) do
189189
k = collect(0:(n - 1))

0 commit comments

Comments
 (0)