Skip to content

Commit

Permalink
flip order for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
matbesancon committed Oct 19, 2023
1 parent 9e5fdbe commit 42a6bb2
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/fw_algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ function frank_wolfe(
@warn("Momentum-averaged gradients should usually be used with agnostic stepsize rules.",)
end

# instanciating container for gradient
if gradient === nothing
gradient = collect(x)
end


if verbose
println("\nVanilla Frank-Wolfe Algorithm.")
NumType = eltype(x0)
Expand All @@ -95,18 +89,21 @@ function frank_wolfe(
x = copyto!(similar(x), x)
end
end

# instanciating container for gradient
if gradient === nothing
gradient = collect(x)
end

first_iter = true
if linesearch_workspace === nothing
linesearch_workspace = build_linesearch_workspace(line_search, x, gradient)
end

# container for direction
d = similar(x)
gtemp = if momentum === nothing
d
else
similar(x)
end
gtemp = momentum === nothing ? d : similar(x)

while t <= max_iteration && dual_gap >= max(epsilon, eps(float(typeof(dual_gap))))

#####################
Expand Down

0 comments on commit 42a6bb2

Please sign in to comment.