Skip to content

Specify reset! JSOSolvers and NLPModels #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
arch: x64
allow_failure: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
Expand Down
10 changes: 5 additions & 5 deletions src/method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function SolverCore.reset!(solver::PercivalSolver, model::AbstractNLPModel)
end

function reinit!(al_nlp::AugLagModel{M, T, V}, model::M, fx::T, μ::T, x::V, y::V) where {M, T, V}
reset!(al_nlp)
NLPModels.reset!(al_nlp)
al_nlp.store_Jv .= zero(T)
al_nlp.store_Jtv .= zero(T)
al_nlp.fx = fx
Expand All @@ -283,15 +283,15 @@ counter_cost(nlp) = neval_obj(nlp) + 2 * neval_grad(nlp)
Specialize `SolverCore.reset!` function to percival's context.
"""
function reset_subproblem!(solver::PercivalSolver{T, V}, model::AbstractNLPModel{T, V}) where {T, V}
reset!(solver.sub_solver, model)
SolverCore.reset!(solver.sub_solver, model)
end

function reset_subproblem!(
solver::PercivalSolver{T, V, Op, M, ST},
model::AugLagModel{M, T, V},
) where {T, V, Op, M, ST <: TronSolver{T, V}}
solver.sub_solver.xc .= model.x
reset!(solver.sub_solver)
SolverCore.reset!(solver.sub_solver)
end

function SolverCore.solve!(
Expand Down Expand Up @@ -324,7 +324,7 @@ function SolverCore.solve!(
verbose::Integer = 0,
kwargs...,
) where {T, V}
reset!(stats)
SolverCore.reset!(stats)
@lencheck nlp.meta.nvar x
x = solver.x .= x
gx = solver.gx
Expand Down Expand Up @@ -411,7 +411,7 @@ function SolverCore.solve!(
model = subproblem_modifier(al_nlp)
reset_subproblem!(solver, model)
S = solver.sub_stats
reset!(S)
SolverCore.reset!(S)
solve!(
solver.sub_solver,
model,
Expand Down
4 changes: 2 additions & 2 deletions test/allocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ if v"1.7" <= VERSION
solver = PercivalSolver(nlp)
stats = GenericExecutionStats(nlp)
SolverCore.solve!(solver, nlp, stats)
reset!(solver)
reset!(nlp)
SolverCore.reset!(solver)
NLPModels.reset!(nlp)
al = @wrappedallocs SolverCore.solve!(solver, nlp, stats)
@test al == 0
end
Expand Down
Loading