Skip to content

Commit

Permalink
use built-in argmax
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanxshi committed Mar 14, 2024
1 parent ca58101 commit 13fa2c5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/single/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down

0 comments on commit 13fa2c5

Please sign in to comment.