Skip to content

Commit a1d04a6

Browse files
committed
v0.8.0
1 parent 6e52c4b commit a1d04a6

7 files changed

+24
-19
lines changed

Project.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "OptimalControl"
22
uuid = "5f98b655-cc9a-415a-b60e-744165666948"
33
authors = ["Olivier Cots <[email protected]>"]
4-
version = "0.7.8"
4+
version = "0.8.0"
55

66
[deps]
77
CTBase = "54762871-cc72-4466-b8e8-f6c8b58076cd"
@@ -11,8 +11,8 @@ CTProblems = "45d9ea3f-a92f-411f-833f-222dd4fb9cd8"
1111
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1212

1313
[compat]
14-
CTBase = "0.8"
15-
CTDirect = "0.5"
14+
CTBase = "0.9"
15+
CTDirect = "0.6"
1616
CTFlows = "0.3"
1717
CTProblems = "0.5"
1818
julia = "1.8"

test/Project.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[deps]
22
CTProblems = "45d9ea3f-a92f-411f-833f-222dd4fb9cd8"
33
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4-
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
4+
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
5+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
56
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
67

78
[compat]

test/runtests.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using OptimalControl
22
using Test
33
using LinearAlgebra
4-
using MINPACK
54
using CTProblems
5+
using SciMLBase
6+
using NonlinearSolve
67

78
#
89
@testset verbose = true showtiming = true "Optimal control tests" begin

test/test_basic.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function test_basic()
1010
( 0.5u(t)^2 ) min
1111
end
1212

13-
sol = solve(ocp)
13+
sol = OptimalControl.solve(ocp)
1414
@test sol.objective 6 atol=1e-2
1515

1616
end

test/test_goddard_direct.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ocp = prob.model
88
init = (state=[1.01, 0.05, 0.8], control=0.1, variable=0.2)
99

1010
# solve
11-
sol = solve(ocp, grid_size=10, print_level=5, init=init)
11+
sol = OptimalControl.solve(ocp, grid_size=10, print_level=5, init=init)
1212

1313
# test
1414
@test sol.objective prob.solution.objective atol=5e-3

test/test_goddard_indirect.jl

+11-8
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,21 @@ s_guess_sol = [-0.02456074767656735,
9595
ξ0 = [ p0 ; t1 ; t2 ; t3 ; tf ]
9696

9797
#
98-
foo!(s, ξ) = shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7])
99-
sol = fsolve(foo!, ξ0, show_trace=true); println(sol)
98+
foo!(s, ξ, λ) = shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7])
99+
#sol = fsolve(foo!, ξ0, show_trace=true); println(sol)
100+
prob = NonlinearProblem(foo!, ξ0)
101+
sol = NonlinearSolve.solve(prob)
100102

101-
p0 = sol.x[1:3]
102-
t1 = sol.x[4]
103-
t2 = sol.x[5]
104-
t3 = sol.x[6]
105-
tf = sol.x[7];
103+
p0 = sol.u[1:3]
104+
t1 = sol.u[4]
105+
t2 = sol.u[5]
106+
t3 = sol.u[6]
107+
tf = sol.u[7];
106108

107109
shoot!(s, p0, t1, t2, t3, tf)
108110

109-
@test sol.converged
111+
#@test sol.converged
112+
@test SciMLBase.successful_retcode(sol)
110113
@test norm(s) < 1e-6
111114

112115
end

test/test_init.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ function test_init()
1010

1111
# initial guess (constant state and control)
1212
init = (state=[-0.5, 0.2], control=0.5)
13-
sol = solve(ocp, grid_size=N, init=init)
13+
sol = OptimalControl.solve(ocp, grid_size=N, init=init)
1414
@test sol.objective prob.solution.objective atol=tol
1515

1616
# initial guess (constant state and functional control)
1717
init = (state=[-0.5, 0.2], control=t->6-12*t)
18-
sol = solve(ocp, grid_size=N, init=init)
18+
sol = OptimalControl.solve(ocp, grid_size=N, init=init)
1919
@test sol.objective prob.solution.objective atol=tol
2020

2121
# initial guess (functional state and constant control)
2222
init = (state=t->[-1+t, t*(t-1)], control=0.5)
23-
sol = solve(ocp, grid_size=N, init=init)
23+
sol = OptimalControl.solve(ocp, grid_size=N, init=init)
2424
@test sol.objective prob.solution.objective atol=tol
2525

2626
# initial guess (functional state and functional control)
2727
init = (state=t->[-1+t, t*(t-1)], control=t->6-12*t)
28-
sol = solve(ocp, grid_size=N, init=init)
28+
sol = OptimalControl.solve(ocp, grid_size=N, init=init)
2929
@test sol.objective prob.solution.objective atol=tol
3030

3131
end

0 commit comments

Comments
 (0)