From 13fa2c53671ac20c632eabdc18dbda81ce7f645d Mon Sep 17 00:00:00 2001 From: Rowan Date: Thu, 14 Mar 2024 12:53:28 -0400 Subject: [PATCH] use built-in argmax --- src/single/solvers.jl | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/single/solvers.jl b/src/single/solvers.jl index 64262a2..54582a7 100644 --- a/src/single/solvers.jl +++ b/src/single/solvers.jl @@ -27,17 +27,9 @@ function solve!(Vs; scdca::Bool, obj, D_j_obj = D_j(obj), containers = _containe converge_branches!((working, converged); D_j_obj, scdca) # among results in converged, choose best - i_argmax = 0; max_prof = -Inf - for (i, option) in enumerate(converged) - prof = obj(first(option)) - if prof > max_prof - max_prof = prof - i_argmax = i - end - end - argmax = first(converged[i_argmax]) - sub = copyto!(sub, argmax) - sup = copyto!(sup, argmax) + solution = argmax(obj ∘ first, converged) |> first + sub = copyto!(sub, solution) + sup = copyto!(sup, solution) end """