Skip to content
Closed
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dbbce49
LMModel → LLSModels: Successfully replaced custom LMModel with standa…
arnavk23 Oct 3, 2025
3774c3d
R2N
arnavk23 Oct 9, 2025
685dabb
allocations_56240
arnavk23 Oct 9, 2025
d984a62
Update src/R2N.jl
arnavk23 Oct 10, 2025
8473946
Update src/R2N.jl
arnavk23 Oct 10, 2025
9f9322f
Update src/LM_alg.jl
arnavk23 Oct 10, 2025
4a0d87c
Update src/LMTR_alg.jl
arnavk23 Oct 10, 2025
8ed914e
Update src/LMTR_alg.jl
arnavk23 Oct 10, 2025
b7d2979
Update src/R2N.jl
arnavk23 Oct 10, 2025
b06e017
Update src/R2N.jl
arnavk23 Oct 10, 2025
dd6fc3b
Update src/LM_alg.jl
arnavk23 Oct 10, 2025
37e9beb
changes
arnavk23 Oct 11, 2025
8357983
Update src/utils.jl
arnavk23 Oct 11, 2025
589f75b
Update src/R2N.jl
arnavk23 Oct 11, 2025
0f9f29e
Update src/R2N.jl
arnavk23 Oct 11, 2025
13ce83c
Update src/R2N.jl
arnavk23 Oct 11, 2025
3cef1e2
Update src/R2N.jl
arnavk23 Oct 11, 2025
4e1e1f9
Update src/LM_alg.jl
arnavk23 Oct 11, 2025
7c7aeaf
Update src/LMTR_alg.jl
arnavk23 Oct 11, 2025
f2f89ed
changeset 1a2b3c4d5e6f7g8h9i0jklmnopqrstuv
arnavk23 Oct 11, 2025
a434d5a
More Changes
arnavk23 Oct 12, 2025
2ea55a4
g @warn "LM: subsolver iter count high" iter=solver.substats.iter f…
arnavk23 Oct 12, 2025
e3bd03b
LM_alg
arnavk23 Oct 15, 2025
48811bd
Changes proposed
arnavk23 Oct 17, 2025
92c7efb
Merge branch 'master' into master
arnavk23 Oct 17, 2025
109c004
Update the in-loop status update to recompute the stationarity measur…
arnavk23 Oct 17, 2025
b5e1c58
Update src/R2N.jl
arnavk23 Oct 17, 2025
deef93e
Update src/LMTR_alg.jl
arnavk23 Oct 17, 2025
fb0fbb3
Update src/R2N.jl
arnavk23 Oct 17, 2025
2d08604
Update src/LM_alg.jl
arnavk23 Oct 17, 2025
8dd1b2a
Copilot remarks
arnavk23 Oct 17, 2025
f5d105e
solver error
arnavk23 Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,125 changes: 1,125 additions & 0 deletions Manifest.toml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ author = ["Robert Baraldi <[email protected]> and Dominique Orban <dominique.orban
version = "0.1.0"

[deps]
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
LLSModels = "39f5bc3e-5160-4bf8-ac48-504fd2534d24"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
ManualNLPModels = "30dfa513-9b2f-4fb3-9796-781eabac1617"
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
NLPModelsModifiers = "e01155f1-5c6f-4375-a9d8-616dd036575f"
OptimizationProblems = "5049e819-d29b-5fba-b941-0eee7e64c1c6"
Percival = "01435c0c-c90d-11e9-3788-63660f8fbccc"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProximalOperators = "a725b495-10eb-56fe-b38b-717eba820537"
QuadraticModels = "f468eda6-eac5-11e8-05a5-ff9e497bcd19"
RegularizedProblems = "ea076b23-609f-44d2-bb12-a4ae45328278"
ShiftedProximalOperators = "d4fd37fa-580c-4e43-9b30-361c21aae263"
SolverCore = "ff4d7338-4cf1-434d-91df-b86cb86fb843"
Expand Down
60 changes: 0 additions & 60 deletions src/LMModel.jl

This file was deleted.

41 changes: 36 additions & 5 deletions src/LMTR_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ function LMTRSolver(
xk = similar(x0)
∇fk = similar(x0)
mν∇fk = similar(x0)
Fk = similar(x0, reg_nls.model.nls_meta.nequ)
Fkn = similar(Fk)
# residuals will be allocated after creating Jacobian operator
Fk = similar(x0, 0)
Fkn = similar(x0, 0)
xkn = similar(x0)
s = similar(x0)
has_bnds = any(l_bound .!= T(-Inf)) || any(u_bound .!= T(Inf)) || subsolver == TRDHSolver
Expand All @@ -67,7 +68,18 @@ function LMTRSolver(
) : shifted(reg_nls.h, xk, one(T), χ)

Jk = jac_op_residual(reg_nls.model, xk)
sub_nlp = LMModel(Jk, Fk, T(0), xk)
# Compute initial residual
residual!(reg_nls.model, xk, Fk)
# Create LM-TR subproblem: min 1/2 ||J(x)s + F(x)||^2 (no regularization σ=0)
# = min 1/2 (J*s + F)^T(J*s + F)
# = min s^T J^T F + 1/2 s^T J^T J s + const
# So c = J^T F, H = J^T J
JtF = similar(xk)
mul!(JtF, Jk', Fk)
JtJ = Jk' * Jk
# Don't include the constant term to avoid numerical overflow in obj evaluation
# The constant doesn't affect the optimization anyway
sub_nlp = QuadraticModel(JtF, JtJ, c0 = zero(T), x0 = zeros(T, length(xk)), name = "LMTR-subproblem")
subpb = RegularizedNLPModel(sub_nlp, ψ)
substats = RegularizedExecutionStats(subpb)
subsolver = subsolver(subpb)
Expand Down Expand Up @@ -273,8 +285,20 @@ function SolverCore.solve!(
jtprod_residual!(nls, xk, Fk, ∇fk)
fk = dot(Fk, Fk) / 2

σmax, found_σ = opnorm(solver.subpb.model.J)
# Get Jacobian operator from original NLS model since QuadraticModel doesn't store it
Jk = jac_op_residual(nls, xk)
σmax, found_σ = opnorm(Jk)
found_σ || error("operator norm computation failed")

# Update the QuadraticModel with current Jacobian and gradient
JtF = Jk' * Fk
JtJ = Jk' * Jk
# In-place update of QuadraticModel fields to avoid allocation
solver.subpb.model.g = JtF
solver.subpb.model.H = JtJ
solver.subpb.model.c0 = zero(T)
solver.subpb.model.x0 .= 0
solver.subpb.model.name = "LMTR-subproblem"
ν = α * Δk / (1 + σmax^2 * (α * Δk + 1))
@. mν∇fk = -∇fk * ν
sqrt_ξ1_νInv = one(T)
Expand Down Expand Up @@ -416,8 +440,15 @@ function SolverCore.solve!(
shift!(ψ, xk)
jtprod_residual!(nls, xk, Fk, ∇fk)

σmax, found_σ = opnorm(solver.subpb.model.J)
# Get Jacobian operator from original NLS model
Jk_update = jac_op_residual(nls, xk)
σmax, found_σ = opnorm(Jk_update)
found_σ || error("operator norm computation failed")

# Update the QuadraticModel with new Jacobian and gradient
JtF = Jk_update' * Fk
JtJ = Jk_update' * Jk_update
update_quadratic_model!(solver.subpb.model, JtF, JtJ)
end

if η2 ≤ ρk < Inf
Expand Down
Loading