Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from control-toolbox/up
Browse files Browse the repository at this point in the history
Up
  • Loading branch information
ocots authored Jun 22, 2024
2 parents fdc1f2d + 9f9aa20 commit a0863e2
Show file tree
Hide file tree
Showing 35 changed files with 198 additions and 160 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
strategy:
matrix:
version:
- '1.8'
- '1.9'
- '1.10'
os:
- ubuntu-latest
Expand All @@ -23,12 +21,12 @@ jobs:
arch:
- x64
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/add-julia-registry@v1
- uses: julia-actions/add-julia-registry@v2
with:
key: ${{ secrets.SSH_KEY }}
registry: control-toolbox/ct-registry
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
- uses: julia-actions/add-julia-registry@v1
- uses: julia-actions/add-julia-registry@v2
with:
key: ${{ secrets.SSH_KEY }}
registry: control-toolbox/ct-registry
- uses: julia-actions/julia-buildpkg@v1
with:
version: '1.8'
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
10 changes: 3 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name = "CTProblems"
uuid = "45d9ea3f-a92f-411f-833f-222dd4fb9cd8"
authors = ["Olivier Cots <[email protected]>"]
version = "0.5.9"
version = "0.7.0"

[deps]
CTBase = "54762871-cc72-4466-b8e8-f6c8b58076cd"
CTFlows = "1c39547c-7794-42f7-af83-d98194f657c2"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"

[compat]
CTBase = "0.9"
CTFlows = "0.3"
CTBase = "0.10"
CTFlows = "0.4"
DocStringExtensions = "0.9"
ForwardDiff = "0.10"
LinearAlgebra = "1.8"
OrdinaryDiffEq = "6.49"
julia = "1.8"
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[deps]
CTBase = "54762871-cc72-4466-b8e8-f6c8b58076cd"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[compat]
CTBase = "0.10"
Documenter = "0.27"
julia = "1.8"
1 change: 1 addition & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ prob.model
And you can plot the solution.

```@example main
using Plots
plot(prob.solution, size=(700, 500))
```
3 changes: 2 additions & 1 deletion docs/src/problems/double_integrator_consumption.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
1 change: 1 addition & 0 deletions docs/src/problems/double_integrator_energy.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ prob.model
You can plot the solution.

```@example main
using Plots
plot(prob.solution, size=(700, 700))
```
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/double_integrator_energy_distance.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/double_integrator_time.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
2 changes: 2 additions & 0 deletions docs/src/problems/goddard.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ $v(t) \leq v_{\max}$. The initial state is fixed while only the final mass is pr

```@example main
using CTProblems
using DifferentialEquations
using Plots
```

You can access the problem in the CTProblems package:
Expand Down
9 changes: 7 additions & 2 deletions docs/src/problems/lqr_ricatti.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ and the limit conditions
x(0) = (0,1)
```

```@example main
using CTProblems
using DifferentialEquations
using Plots
```

You can access the problem in the CTProblems package:

```@example main
using CTProblems
prob = Problem(:lqr, :x_dim_2, :u_dim_1, :lagrange)
```

Expand All @@ -34,5 +39,5 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
plot(prob.solution)
```
9 changes: 7 additions & 2 deletions docs/src/problems/orbital_transfert_consumption.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ F_{max} = 100 \\
γ_{max} = \frac{F_{max}*3600.0^2}{m_0*10^3} \\
```

```@example main
using CTProblems
using DifferentialEquations
using Plots
```

You can access the problem in the CTProblems package:

```@example main
using CTProblems
prob = Problem(:orbital_transfert, :consumption)
```

Expand All @@ -53,5 +58,5 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
plot(prob.solution)
```
9 changes: 7 additions & 2 deletions docs/src/problems/orbital_transfert_energy.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ F_{max} = 100 \\
γ_{max} = \frac{F_{max}*3600.0^2}{m_0*10^3} \\
```

```@example main
using CTProblems
using DifferentialEquations
using Plots
```

You can access the problem in the CTProblems package:

```@example main
using CTProblems
prob = Problem(:orbital_transfert, :energy)
```

Expand All @@ -53,5 +58,5 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
plot(prob.solution)
```
9 changes: 7 additions & 2 deletions docs/src/problems/orbital_transfert_time.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ F_{max} = 100 \\
γ_{max} = \frac{F_{max}*3600.0^2}{m_0*10^3} \\
```

```@example main
using CTProblems
using DifferentialEquations
using Plots
```

You can access the problem in the CTProblems package:

```@example main
using CTProblems
prob = Problem(:orbital_transfert, :time)
```

Expand All @@ -52,5 +57,5 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/simple_exponential_consumption.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/simple_exponential_energy.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/simple_exponential_time.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
1 change: 1 addition & 0 deletions docs/src/problems/simple_integrator_energy_free_tf.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ prob.model

You can plot the solution.
```@example main
using Plots
plot(prob.solution)
```
1 change: 1 addition & 0 deletions docs/src/problems/simple_integrator_lqr_free_tf.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ prob.model

You can plot the solution.
```@example main
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/simple_integrator_mixed_constraint.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 2 additions & 1 deletion docs/src/problems/simple_integrator_nonsmooth_turnpike.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ prob.model
You can plot the solution.

```@example main
plot(prob.solution, size=(700, 400))
using Plots
plot(prob.solution)
```
3 changes: 0 additions & 3 deletions src/CTProblems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import Base
using CTBase
using CTFlows
using DocStringExtensions
using OrdinaryDiffEq
using ForwardDiff
using LinearAlgebra
#

Expand Down Expand Up @@ -54,6 +52,5 @@ include("list_of_problems.jl")

#
export ProblemsDescriptions, Problem, Problems, @ProblemsDescriptions, @Problems
export plot

end # module CTProblems
8 changes: 4 additions & 4 deletions src/problems/double_integrator_consumption.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ EXAMPLE=(:integrator, :consumption, :x_dim_2, :u_dim_1, :lagrange, :u_cons, :non
h(α,β) = x_arc_3(tf,α,β)[2]

# solve
function shoot!(s,α,β)
s[1] = g(α,β) - xf[1]
s[2] = h(α,β) - xf[2]
end
# function shoot!(s,α,β)
# s[1] = g(α,β) - xf[1]
# s[2] = h(α,β) - xf[2]
# end

#=
#using MINPACK
Expand Down
8 changes: 4 additions & 4 deletions src/problems/double_integrator_energy_control_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ EXAMPLE=(:integrator, :energy, :x_dim_2, :u_dim_1, :lagrange, :u_cons)
h(α,β) = x_arc_3(tf,α,β)[2]

# solve
function shoot!(s,α,β)
s[1] = g(α,β) - xf[1]
s[2] = h(α,β) - xf[2]
end
# function shoot!(s,α,β)
# s[1] = g(α,β) - xf[1]
# s[2] = h(α,β) - xf[2]
# end

#=
#using MINPACK
Expand Down
36 changes: 18 additions & 18 deletions src/problems/orbital_transfert_consumption.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,28 @@ EXAMPLE=(:orbital_transfert, :consumption, :x_dim_4, :u_dim_2, :lagrange, :u_con
f1 = Flow(Hamiltonian(H1));

# shoot function
function shoot(p0, t1, t2, t3, t4)
# function shoot(p0, t1, t2, t3, t4)

s = zeros(eltype(p0),9)
# s = zeros(eltype(p0),9)

x1, p1 = f1(t0, x0, p0, t1)
x2, p2 = f0(t1, x1, p1, t2)
x3, p3 = f1(t2, x2, p2, t3)
x4, p4 = f0(t3, x3, p3, t4)
xf, pf = f1(t4, x4, p4, tf)
# x1, p1 = f1(t0, x0, p0, t1)
# x2, p2 = f0(t1, x1, p1, t2)
# x3, p3 = f1(t2, x2, p2, t3)
# x4, p4 = f0(t3, x3, p3, t4)
# xf, pf = f1(t4, x4, p4, tf)

s[1] = norm(xf[1:2]) - rf
s[2] = xf[3] + α*xf[2]
s[3] = xf[4] - α*xf[1]
s[4] = xf[2]*(pf[1] + α*pf[4]) - xf[1]*(pf[2] - α*pf[3])
s[5] = γ_max*(p1[3]^2 + p1[4]^2) - 1
s[6] = γ_max*(p2[3]^2 + p2[4]^2) - 1
s[7] = γ_max*(p3[3]^2 + p3[4]^2) - 1
s[8] = γ_max*(p4[3]^2 + p4[4]^2) - 1
s[9] = pf[5]
return s
# s[1] = norm(xf[1:2]) - rf
# s[2] = xf[3] + α*xf[2]
# s[3] = xf[4] - α*xf[1]
# s[4] = xf[2]*(pf[1] + α*pf[4]) - xf[1]*(pf[2] - α*pf[3])
# s[5] = γ_max*(p1[3]^2 + p1[4]^2) - 1
# s[6] = γ_max*(p2[3]^2 + p2[4]^2) - 1
# s[7] = γ_max*(p3[3]^2 + p3[4]^2) - 1
# s[8] = γ_max*(p4[3]^2 + p4[4]^2) - 1
# s[9] = pf[5]
# return s

end;
# end;

# Solve
# S(ξ) = shoot(ξ[1:5], ξ[6],ξ[7],ξ[8],ξ[9])
Expand Down
Loading

0 comments on commit a0863e2

Please sign in to comment.