Skip to content

Commit 60f903e

Browse files
committed
replace minpack by nonlinearsolve
1 parent 9420b0a commit 60f903e

3 files changed

Lines changed: 10 additions & 16 deletions

File tree

test/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ CTModels = "34c4fa32-2049-4079-8329-de33c2a22e2d"
33
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
44
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
55
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
6-
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
76
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
87
MadNLPMumps = "3b83494e-c0a4-4895-918b-9157a7a085a1"
98
NLPModelsIpopt = "f4238b75-b362-5c4c-b852-0801c9a21d71"
9+
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
1010
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
1111
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66"
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -16,10 +16,10 @@ CTModels = "0.6"
1616
DifferentiationInterface = "0.7"
1717
ForwardDiff = "0.10, 1.0"
1818
LinearAlgebra = "1"
19-
MINPACK = "1"
2019
MadNLP = "0.8"
2120
MadNLPMumps = "0.5"
2221
NLPModelsIpopt = "0.10"
22+
NonlinearSolve = "4"
2323
OrdinaryDiffEq = "6"
2424
SplitApplyCombine = "1"
2525
Test = "1"

test/indirect/test_goddard_indirect.jl

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,13 @@ function test_goddard_indirect()
6262
]
6363
@test s s_guess_sol atol = 1e-6
6464

65-
# solve and compare
65+
# test shooting function with solve from NonlinearSolve
6666
ξ0 = [p0; t1; t2; t3; tf]
67-
backend = AutoForwardDiff()
68-
nle! = (s, ξ) -> shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7])
69-
jnle! = (js, ξ) -> jacobian!(nle!, similar(ξ), js, backend, ξ)
70-
indirect_sol = fsolve(nle!, jnle!, ξ0; show_trace=true)
71-
72-
p0 = indirect_sol.x[1:3]
73-
t1 = indirect_sol.x[4]
74-
t2 = indirect_sol.x[5]
75-
t3 = indirect_sol.x[6]
76-
tf = indirect_sol.x[7]
77-
78-
shoot!(s, p0, t1, t2, t3, tf)
67+
shoot!(s, ξ, λ) = shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7])
68+
prob = NonlinearProblem(shoot!, ξ0)
69+
sol = solve(prob)
70+
ξ = sol.u
71+
p0, t1, t2, t3, tf = ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7]
7972
@test norm(s) < 1e-6
73+
8074
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ using MadNLP
55
using MadNLPMumps
66
using LinearAlgebra
77
using OrdinaryDiffEq
8-
using MINPACK
98
using DifferentiationInterface
109
using ForwardDiff: ForwardDiff
1110
using SplitApplyCombine # for flatten in some tests
11+
using NonlinearSolve
1212

1313
# NB some direct tests use functional definition and are `using CTModels`
1414

0 commit comments

Comments
 (0)