Skip to content

Commit 5fdf82a

Browse files
committed
Add a subsolver for TRON
1 parent 242c8be commit 5fdf82a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/tron.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ stats = solve!(solver, nlp)
119119
mutable struct TronSolver{
120120
T,
121121
V <: AbstractVector{T},
122+
Sub <: KrylovWorkspace{T, T, V},
122123
Op <: AbstractLinearOperator{T},
123124
Aop <: AbstractLinearOperator{T},
124125
} <: AbstractOptimizationSolver
@@ -136,7 +137,7 @@ mutable struct TronSolver{
136137

137138
ifix::BitVector
138139

139-
cg_solver::CgWorkspace{T, T, V}
140+
cg_solver::Sub
140141
cg_rhs::V
141142
cg_op_diag::V
142143
cg_op::LinearOperator{T}
@@ -151,6 +152,7 @@ function TronSolver(
151152
μ₁::T = get(TRON_μ₁, nlp),
152153
σ::T = get(TRON_σ, nlp),
153154
max_radius::T = min(one(T) / sqrt(2 * eps(T)), T(100)),
155+
subsolver::Symbol = :cg,
154156
kwargs...,
155157
) where {T, V <: AbstractVector{T}}
156158
params = TRONParameterSet(nlp; μ₀ = μ₀, μ₁ = μ₁, σ = σ)
@@ -175,8 +177,8 @@ function TronSolver(
175177
cg_op = opDiagonal(cg_op_diag)
176178

177179
ZHZ = cg_op' * H * cg_op
178-
workspace = CgWorkspace(ZHZ, Hs)
179-
return TronSolver{T, V, Op, typeof(ZHZ)}(
180+
workspace = krylov_workspace(Val(subsolver), ZHZ, Hs)
181+
return TronSolver{T, V, typeof(workspace), Op, typeof(ZHZ)}(
180182
x,
181183
xc,
182184
temp,

0 commit comments

Comments
 (0)