Skip to content

Commit

Permalink
Merge branch 'JuliaSmoothOptimizers:master' into R2N-JSO
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxenceGollier authored Jan 16, 2025
2 parents bf6c92f + 7302327 commit 00d6f72
Show file tree
Hide file tree
Showing 5 changed files with 447 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
NLPModelsModifiers = "e01155f1-5c6f-4375-a9d8-616dd036575f"
Percival = "01435c0c-c90d-11e9-3788-63660f8fbccc"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProximalOperators = "a725b495-10eb-56fe-b38b-717eba820537"
RegularizedProblems = "ea076b23-609f-44d2-bb12-a4ae45328278"
Expand All @@ -20,6 +21,7 @@ TSVD = "9449cd9e-2762-5aa3-a617-5413e99d722e"
LinearOperators = "2.7"
NLPModels = "0.19, 0.20"
NLPModelsModifiers = "0.7"
Percival = "0.7.2"
ProximalOperators = "0.15"
RegularizedProblems = "0.1.1"
ShiftedProximalOperators = "0.2"
Expand Down
46 changes: 46 additions & 0 deletions examples/demo-cutest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using NLPModels, CUTEst
using ProximalOperators
using RegularizedOptimization

problem_name = "HS8"
nlp = CUTEstModel(problem_name)
@assert !has_bounds(nlp)
@assert equality_constrained(nlp)

h = NormL1(1.0)

stats = AL(nlp, h, atol = 1e-6, verbose = 1)
print(stats)

using RegularizedProblems

regnlp = RegularizedNLPModel(nlp, h)
stats = AL(regnlp, atol = 1e-6, verbose = 1)
print(stats)

solver = ALSolver(regnlp)
stats = solve!(solver, regnlp, atol = 1e-6, verbose = 1)
print(stats)

using SolverCore

stats = GenericExecutionStats(nlp)
solver = ALSolver(regnlp)
stats = solve!(solver, regnlp, stats, atol = 1e-6, verbose = 1)
print(stats)

callback =
(regnlp, solver, stats) -> begin
@info "iter $(stats.iter), obj $(stats.objective), status $(stats.status)"
end
stats = AL(nlp, h, atol = 1e-6, verbose = 1, callback = callback)
print(stats)

callback =
(regnlp, solver, stats) -> begin
@info "iter $(stats.iter), f $(stats.solver_specific[:smooth_obj]), h $(stats.solver_specific[:nonsmooth_obj])"
end
stats = AL(nlp, h, atol = 1e-6, verbose = 1, callback = callback)
print(stats)

finalize(nlp)
Loading

0 comments on commit 00d6f72

Please sign in to comment.