Skip to content

Commit b8831fb

Browse files
committed
update demos
1 parent 8b43407 commit b8831fb

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

examples/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RegularizedProblems = "ea076b23-609f-44d2-bb12-a4ae45328278"
1212
ADNLPModels = "0.7"
1313
DifferentialEquations = "7"
1414
NLPModels = "0.19, 0.20"
15-
NLPModelsModifiers = "0.6"
15+
NLPModelsModifiers = "0.7"
1616
PGFPlots = "^3.4"
1717
ProximalOperators = "0.15"
1818
RegularizedOptimization = "0.1"

examples/demo-bpdn-constr.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ function demo_solver(f, nls, sol, h, χ, suffix = "l0-linf")
1515
ϵa = 1e-6,
1616
ϵr = 1e-6,
1717
verbose = 10,
18-
spectral = false,
19-
psb = true,
2018
)
2119

2220
@info " using TR to solve with" h χ
23-
reset!(f)
24-
TR_out = TR(f, h, χ, options, x0 = f.meta.x0)
21+
TR_out = TR(LSR1Model(f), h, χ, options, x0 = f.meta.x0)
2522
@info "TR relative error" norm(TR_out.solution - sol) / norm(sol)
2623
plot_bpdn(TR_out, sol, "constr-tr-r2-$(suffix)")
2724

@@ -32,8 +29,7 @@ function demo_solver(f, nls, sol, h, χ, suffix = "l0-linf")
3229
plot_bpdn(R2_out, sol, "constr-r2-$(suffix)")
3330

3431
@info " using TRDH to solve with" h χ
35-
reset!(f)
36-
TRDH_out = TRDH(f, h, χ, options, x0 = f.meta.x0)
32+
TRDH_out = TRDH(DiagonalPSBModel(f), h, χ, options, x0 = f.meta.x0)
3733
@info "TRDH relative error" norm(TRDH_out.solution - sol) / norm(sol)
3834
# plot_bpdn(TRDH_out, sol, "constr-trdh-$(suffix)")
3935

@@ -52,11 +48,10 @@ end
5248

5349
function demo_bpdn_constr(compound = 1)
5450
model, nls_model, sol = bpdn_model(compound, bounds = true)
55-
f = LSR1Model(model)
5651
λ = norm(grad(model, zeros(model.meta.nvar)), Inf) / 10
57-
demo_solver(f, nls_model, sol, NormL0(λ), NormLinf(1.0))
52+
demo_solver(model, nls_model, sol, NormL0(λ), NormLinf(1.0))
5853
λ = norm(grad(model, zeros(model.meta.nvar)), Inf) / 3
59-
demo_solver(f, nls_model, sol, NormL1(λ), NormLinf(1.0), "l1-linf")
54+
demo_solver(model, nls_model, sol, NormL1(λ), NormLinf(1.0), "l1-linf")
6055
end
6156

6257
demo_bpdn_constr()

examples/demo-nnmf-constr.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@ function demo_solver(f, h, χ, selected, Avec, m, n, k, suffix = "l0-linf")
1616
ϵr = 1e-6,
1717
verbose = 10,
1818
maxIter = 500,
19-
spectral = true,
2019
)
2120
@info " using TR to solve with" h χ
22-
reset!(f)
23-
TR_out = TR(f, h, χ, options, selected = selected)
21+
TR_out = TR(LSR1Model(f), h, χ, options, selected = selected)
2422
plot_nnmf(TR_out, Avec, m, n, k, "tr-r2-$suffix")
2523

2624
@info " using R2 to solve with" h
2725
reset!(f)
2826
R2_out = R2(f, h, options, selected = selected)
2927
plot_nnmf(R2_out, Avec, m, n, k, "r2-$suffix")
3028

31-
subsolver_options = ROSolverOptions(spectral = false, psb = true, ϵa = options.ϵa)
29+
subsolver_options = ROSolverOptions(ϵa = options.ϵa)
3230
@info " using TR with TRDH as subproblem to solve with" h χ
3331
reset!(f)
3432
TR2_out = TR(
35-
f,
33+
LSR1Model(f),
3634
h,
3735
χ,
3836
options,
@@ -43,19 +41,17 @@ function demo_solver(f, h, χ, selected, Avec, m, n, k, suffix = "l0-linf")
4341
plot_nnmf(TR2_out, Avec, m, n, k, "tr-trdh-$suffix")
4442

4543
@info " using TRDH to solve with" h χ
46-
reset!(f)
47-
TRDH_out = TRDH(f, h, χ, options, selected = selected)
44+
TRDH_out = TRDH(DiagonalPSBModel(f), h, χ, options, selected = selected)
4845
plot_nnmf(TRDH_out, Avec, m, n, k, "trdh-$suffix")
4946
end
5047

5148
function demo_nnmf()
5249
m, n, k = 100, 50, 5
5350
model, nls_model, A, selected = nnmf_model(m, n, k)
54-
f = LSR1Model(model)
5551
λ = norm(grad(model, rand(model.meta.nvar)), Inf) / 200
56-
demo_solver(f, NormL0(λ), NormLinf(1.0), selected, A, m, n, k, "l0-linf")
52+
demo_solver(model, NormL0(λ), NormLinf(1.0), selected, A, m, n, k, "l0-linf")
5753
λ = norm(grad(model, rand(model.meta.nvar)), Inf) / 100000
58-
demo_solver(f, NormL1(λ), NormLinf(1.0), selected, A, m, n, k, "l1-linf")
54+
demo_solver(model, NormL1(λ), NormLinf(1.0), selected, A, m, n, k, "l1-linf")
5955
end
6056

6157
demo_nnmf()

0 commit comments

Comments
 (0)