-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathadaptive_regularization_with_cubics_plan.jl
More file actions
124 lines (106 loc) · 4.36 KB
/
Copy pathadaptive_regularization_with_cubics_plan.jl
File metadata and controls
124 lines (106 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
@doc """
AdaptiveRegularizationWithCubicsModelObjective
A model for the adaptive regularization with Cubics
```math
m(X) = f(p) + ⟨$(_tex(:grad)) f(p), X ⟩_p + $(_tex(:frac, "1", "2")) ⟨$(_tex(:Hess)) f(p)[X], X⟩_p
+ $(_tex(:frac, "σ", "3")) $(_tex(:norm, "X"))^3,
```
cf. Eq. (33) in [AgarwalBoumalBullinsCartis:2020](@cite)
# Fields
* `objective`: an [`AbstractManifoldHessianObjective`](@ref) proving ``f``, its gradient and Hessian
* `σ`: the current (cubic) regularization parameter
# Constructors
AdaptiveRegularizationWithCubicsModelObjective(mho, σ=1.0)
with either an [`AbstractManifoldHessianObjective`](@ref) `objective` or an decorator containing such an objective.
"""
mutable struct AdaptiveRegularizationWithCubicsModelObjective{
E <: AbstractEvaluationType,
O <: Union{ManifoldHessianObjective, AbstractDecoratedManifoldObjective},
R,
} <: AbstractManifoldSubObjective{E, O}
objective::O
σ::R
end
function AdaptiveRegularizationWithCubicsModelObjective(
mho::O, σ::R = 1.0
) where {
E, O <: Union{AbstractManifoldHessianObjective{E}, AbstractDecoratedManifoldObjective{E}}, R,
}
return AdaptiveRegularizationWithCubicsModelObjective{E, O, R}(mho, σ)
end
function set_parameter!(
f::AdaptiveRegularizationWithCubicsModelObjective,
::Union{Val{:σ}, Val{:RegularizationParameter}},
σ,
)
f.σ = σ
return f
end
get_objective(arcmo::AdaptiveRegularizationWithCubicsModelObjective) = arcmo.objective
@doc """
get_cost(TpM, trmo::AdaptiveRegularizationWithCubicsModelObjective, X)
Evaluate the tangent space [`AdaptiveRegularizationWithCubicsModelObjective`](@ref)
```math
m(X) = f(p) + ⟨$(_tex(:grad)) f(p), X ⟩_p + $(_tex(:frac, "1", "2")) ⟨$(_tex(:Hess)) f(p)[X], X⟩_p
+ $(_tex(:frac, "σ", "3")) $(_tex(:norm, "X"))^3,
```
at `X`, cf. Eq. (33) in [AgarwalBoumalBullinsCartis:2020](@cite).
"""
function get_cost(
TpM::TangentSpace, arcmo::AdaptiveRegularizationWithCubicsModelObjective, X
)
M = base_manifold(TpM)
p = TpM.point
c = get_objective_cost(M, arcmo, p)
G = get_objective_gradient(M, arcmo, p)
Y = get_objective_hessian(M, arcmo, p, X)
return c + inner(M, p, G, X) + 1 / 2 * inner(M, p, Y, X) + arcmo.σ / 3 * norm(M, p, X)^3
end
function get_cost_function(arcmo::AdaptiveRegularizationWithCubicsModelObjective)
return (TpM, X) -> get_cost(TpM, arcmo, X)
end
@doc """
get_gradient(TpM, trmo::AdaptiveRegularizationWithCubicsModelObjective, X)
Evaluate the gradient of the [`AdaptiveRegularizationWithCubicsModelObjective`](@ref)
```math
$(_tex(:grad)) m(X) = $(_tex(:grad)) f(p) + $(_tex(:Hess)) f(p)[X]
+ σ$(_tex(:norm, "X")) X,
```
at `X`, cf. Eq. (37) in [AgarwalBoumalBullinsCartis:2020](@cite).
"""
function get_gradient(
TpM::TangentSpace, arcmo::AdaptiveRegularizationWithCubicsModelObjective, X
)
M = base_manifold(TpM)
p = TpM.point
G = get_objective_gradient(M, arcmo, p)
return G + get_objective_hessian(M, arcmo, p, X) + arcmo.σ * norm(M, p, X) * X
end
function get_gradient!(
TpM::TangentSpace, Y, arcmo::AdaptiveRegularizationWithCubicsModelObjective, X
)
M = base_manifold(TpM)
p = TpM.point
get_objective_hessian!(M, Y, arcmo, p, X)
Y .= Y + get_objective_gradient(M, arcmo, p) + arcmo.σ * norm(M, p, X) * X
return Y
end
function get_gradient_function(arcmo::AdaptiveRegularizationWithCubicsModelObjective)
return (TpM, X) -> get_gradient(TpM, arcmo, X)
end
function Base.show(io::IO, arcmo::AdaptiveRegularizationWithCubicsModelObjective)
print(io, "AdaptiveRegularizationWithCubicsModelObjective(")
print(io, arcmo.objective); print(io, ", ")
print(io, arcmo.σ)
return print(io, ")")
end
function status_summary(arcmo::AdaptiveRegularizationWithCubicsModelObjective; context::Symbol = :default)
(context === :short) && return repr(arcmo)
(context === :inline) && return "The (tangent space) model for the adaptive regularization with cubics sub problem with parameter σ=$(arcmo.σ) for the objective $(status_summary(arcmo.objective; context = context))"
return """
The cubic polynomial based model for the sub problem of the Adaptive Regularization with cubics solver
## Regularization parameter
σ = $(arcmo.σ)
## Objective
$(_in_str(status_summary(arcmo.objective)))"""
end