control-toolbox / spin

Spin
GNU General Public License v3.0
0 stars 0 forks source link

Doc + CI #5

Closed jbcaillau closed 1 week ago

jbcaillau commented 1 month ago

@ocots besoin d'un coup de main (rapide, je pense) pour positionner clé SSH + secrets (SSH_KEY et DOCUMENTER_KEY) pour les GitHub actions associées à la doc pour ce repo. Voir ces infos de Documenter.

ocots commented 1 month ago

Ok je te fais ça. Faut utiliser DocumenterTools.

ocots commented 1 month ago

En fait, il faut un package pour que cela se fasse il semblerait. Voir Step 14 de Julia Package Setup Tutorial.

jbcaillau commented 1 month ago

@ibtissammim doc en ligne

La CI est OK, merci @ocots pour le coup de main. Le code est restructuré :

Todo :

idem for F1

F0(q₁, q₂) = [ F0(q₁); F0(q₂) ] F1(q₁, q₂, ε) = [ F1(q₁); (1 - ε) * F1(q₂) ] # check!

function ocp1(q₀) @def o begin tf ∈ R, variable t ∈ [0, tf], time q = (y, z) ∈ R², state u ∈ R, control -1 ≤ u(t) ≤ 1 q(0) == q₀ q(tf) == [0, 0] ẋ(t) == F0(q(t)) + u(t) * F1(q(t)) end return o end

function ocp2(q₁₀, q₂₀, ε) @def o begin tf ∈ R, variable t ∈ [0, tf], time x = (y₁, z₁, y₂, z₂) ∈ R⁴, state u ∈ R, control -1 ≤ u(t) ≤ 1 q₁ = [y₁, z₁] q₂ = [y₂, z₂] q₁(0) == q₁₀ q₂(0) == q₂₀ q₁(tf) == [0, 0] q₂(tf) == [0, 0] ẋ(t) == F0(q₁(t), q₂(t)) + u(t) * F1(q₁(t), q₂(t), ε) end return o end


- [ ] raffiner systématiquement les résultats (`grid_size=500`...) avant les plots
- [ ] sur les plots, tracer aussi le cercle unité et utiliser `aspect_ratio=:equal` (voir [ici](https://docs.juliaplots.org/latest/generated/unitfulext_examples/#Aspect-ratio))
jbcaillau commented 4 weeks ago

@ibtissammim j'ai passé le code sous la nouvelle version OptimalControl v0.9 :

using OptimalControl
using NLPModelsIpopt # To solve
using Plots.                    # To plot

Γ = 9.855e-2
γ = 3.65e-3
ϵ = 0.1

@def ocp begin
    tf ∈ R, variable
    t ∈ [ 0, tf ], time
    x ∈ R⁴, state
    u ∈ R, control
    tf ≥ 0
    -1 ≤ u(t) ≤ 1
    x(0) == [0, 1, 0, 1 ]
    x(tf) == [0, 0, 0, 0]
    ẋ(t) == [ (-Γ*x₁(t) -u(t)*x₂(t)), (γ*(1-x₂(t)) +u(t)*x₁(t)), (-Γ*x₃(t) -(1-ϵ)* u(t)*x₄(t)), (γ*(1-x₄(t)) +(1-ϵ)*u(t)*x₃(t))]
    tf → min
end