Skip to content

Commit 26eb743

Browse files
committed
refactor(OptimizationBBO): use the BBO API for the elapsed time
1 parent d029b85 commit 26eb743

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/OptimizationBBO/src/OptimizationBBO.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
158158

159159
opt_setup = BlackBoxOptim.bbsetup(_loss; opt_args...)
160160

161-
t0 = time()
162-
163161
if isnothing(cache.u0)
164162
opt_res = BlackBoxOptim.bboptimize(opt_setup)
165163
else
@@ -171,13 +169,11 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
171169
Base.@logmsg(Base.LogLevel(-1), "", progress=1, _id=:OptimizationBBO)
172170
end
173171

174-
t1 = time()
175-
176172
# Use the improved convert function
177173
opt_ret = Optimization.deduce_retcode(opt_res.stop_reason)
178174
stats = Optimization.OptimizationStats(;
179175
iterations = opt_res.iterations,
180-
time = t1 - t0,
176+
time = opt_res.elapsed_time,
181177
fevals = opt_res.f_calls)
182178
SciMLBase.build_solution(cache, cache.opt,
183179
BlackBoxOptim.best_candidate(opt_res),

0 commit comments

Comments
 (0)