Skip to content

Commit

Permalink
[hotfix] fix reinitialize function (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
frapac committed Oct 18, 2021
1 parent 40fc884 commit 9d66840
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/interiorpointsolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,6 @@ end

function reinitialize!(ips::AbstractInteriorPointSolver)
view(ips.x,1:get_nvar(ips.nlp)) .= get_x0(ips.nlp)
view(ips.zl,1:get_nvar(ips.nlp)) .= get_zl(ips.nlp)
view(ips.zu,1:get_nvar(ips.nlp)) .= get_zu(ips.nlp)

ips.obj_val = eval_f_wrapper(ips, ips.x)
eval_grad_f_wrapper!(ips, ips.f, ips.x)
Expand Down
15 changes: 15 additions & 0 deletions test/madnlp_dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,18 @@ end
end
end

@testset "MadNLP: restart (PR #113)" begin
n, m = 10, 5
nlp = MadNLPTests.DenseDummyQP(; n=n, m=m)
sparse_options = Dict{Symbol, Any}(
:kkt_system=>MadNLP.SPARSE_KKT_SYSTEM,
:linear_solver=>MadNLPLapackCPU,
:print_level=>MadNLP.ERROR,
)
ips = MadNLP.InteriorPointSolver(nlp, option_dict=sparse_options)
MadNLP.optimize!(ips)
# Restart (should hit MadNLP.reinitialize function)
res = MadNLP.optimize!(ips)
@test ips.status == MadNLP.SOLVE_SUCCEEDED
end

0 comments on commit 9d66840

Please sign in to comment.