From 52c13fcd34539f1cb9ef909328a1060f089df4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Thu, 26 Dec 2024 23:50:10 +0100 Subject: [PATCH 1/4] fix info in DICG (#538) --- src/dicg.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dicg.jl b/src/dicg.jl index d912bb9d5..1140ca8fe 100644 --- a/src/dicg.jl +++ b/src/dicg.jl @@ -117,7 +117,7 @@ function decomposition_invariant_conditional_gradient( println("GRADIENstep_typeYPE: $grad_type LAZY: $lazy lazy_tolerance: $lazy_tolerance") println("LMO: $(typeof(lmo))") if memory_mode isa InplaceEmphasis - @info("In memory_mode memory iterates are wristep_typeen back into x0!") + @info("In memory_mode memory iterates are written back into x0!") end end @@ -352,7 +352,7 @@ function blended_decomposition_invariant_conditional_gradient( println("GRADIENstep_typeYPE: $grad_type LAZY: $lazy lazy_tolerance: $lazy_tolerance") println("LMO: $(typeof(lmo))") if memory_mode isa InplaceEmphasis - @info("In memory_mode memory iterates are wristep_typeen back into x0!") + @info("In memory_mode memory iterates are written back into x0!") end end From 699e8715cb372d790c97f997ceaf528dc36c074b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Thu, 26 Dec 2024 23:51:50 +0100 Subject: [PATCH 2/4] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 626b9f410..50fca0dff 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FrankWolfe" uuid = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30" authors = ["ZIB-IOL"] -version = "0.4.4" +version = "0.4.5" [deps] Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" From ab83a090bb6dab9e68b3d60fdd0237670f2a5954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Sat, 28 Dec 2024 09:00:41 +0100 Subject: [PATCH 3/4] Dicg callback info (#539) * DICG callback takes the inface vertices * format --- src/dicg.jl | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/dicg.jl b/src/dicg.jl index 1140ca8fe..5577b332a 100644 --- a/src/dicg.jl +++ b/src/dicg.jl @@ -86,7 +86,7 @@ function decomposition_invariant_conditional_gradient( end x = x0 - + if memory_mode isa InplaceEmphasis && !isa(x, Union{Array,SparseArrays.AbstractSparseArray}) # if integer, convert element type to most appropriate float if eltype(x) <: Integer @@ -127,12 +127,12 @@ function decomposition_invariant_conditional_gradient( gamma = one(phi) if lazy - if extra_vertex_storage === nothing - v = compute_extreme_point(lmo, gradient, lazy = lazy) - pre_computed_set = [v] - else - pre_computed_set = extra_vertex_storage - end + if extra_vertex_storage === nothing + v = compute_extreme_point(lmo, gradient, lazy=lazy) + pre_computed_set = [v] + else + pre_computed_set = extra_vertex_storage + end end if linesearch_workspace === nothing @@ -168,16 +168,8 @@ function decomposition_invariant_conditional_gradient( end if lazy - d, v, v_index, a, away_index, phi, step_type = - lazy_dicg_step( - x, - gradient, - lmo, - pre_computed_set, - phi, - epsilon, - d; - ) + d, v, v_index, a, away_index, phi, step_type = + lazy_dicg_step(x, gradient, lmo, pre_computed_set, phi, epsilon, d;) else # non-lazy, call the simple and modified v = compute_extreme_point(lmo, gradient, lazy=lazy) dual_gap = fast_dot(gradient, x) - fast_dot(gradient, v) @@ -205,7 +197,7 @@ function decomposition_invariant_conditional_gradient( push!(pre_computed_set, v) end end - + if callback !== nothing state = CallbackState( t, @@ -223,7 +215,7 @@ function decomposition_invariant_conditional_gradient( gradient, step_type, ) - if callback(state) === false + if callback(state, a, v) === false break end end @@ -259,7 +251,7 @@ function decomposition_invariant_conditional_gradient( gradient, step_type, ) - callback(state) + callback(state, nothing, v) end end return (x=x, v=v, primal=primal, dual_gap=dual_gap, traj_data=traj_data) @@ -441,7 +433,7 @@ function blended_decomposition_invariant_conditional_gradient( gradient, step_type, ) - if callback(state) === false + if callback(state, a, v) === false break end end @@ -477,7 +469,7 @@ function blended_decomposition_invariant_conditional_gradient( gradient, step_type, ) - callback(state) + callback(state, nothing, v) end end return (x=x, v=v, primal=primal, dual_gap=dual_gap, traj_data=traj_data) @@ -518,19 +510,19 @@ function lazy_dicg_step( v = compute_extreme_point(lmo, gradient) grad_dot_v = fast_dot(gradient, v) # Do lazy inface_point - if grad_dot_a_local - grad_dot_v >= phi / lazy_tolerance && - grad_dot_a_local - grad_dot_v >= epsilon + if grad_dot_a_local - grad_dot_v >= phi / lazy_tolerance && + grad_dot_a_local - grad_dot_v >= epsilon step_type = ST_LAZY a = a_local away_index = a_local_loc else a = compute_inface_extreme_point(lmo, NegatingArray(gradient), x) end - + # Real dual gap promises enough progress. grad_dot_fw_vertex = fast_dot(v, gradient) dual_gap = grad_dot_x - grad_dot_fw_vertex - + if dual_gap >= phi / lazy_tolerance d = muladd_memory_mode(memory_mode, d, a, v) #Lower our expectation for progress. From 54b30de6fe27c7666c47d7bd9cb0d52e5ec55eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Sat, 28 Dec 2024 09:01:42 +0100 Subject: [PATCH 4/4] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 50fca0dff..817bf6706 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FrankWolfe" uuid = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30" authors = ["ZIB-IOL"] -version = "0.4.5" +version = "0.4.6" [deps] Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"