Applications #46
Replies: 18 comments 50 replies
-
Application ravageurs
using OptimalControl
tf = 15 # and other params
@def ocp begin
t ∈ [ 0, tf ], time
x ∈ R³, state
u ∈ R, control
S = x₁
I = x₂
N = x₃
ẋ(t) == [ λ-β*(1-u(t))*S(t)*N(t)-μ*S(t), 0, 0 ] # please update!
S(0) == 10
I(0) == 2
N(0) == 15
0 ≤ u(t) ≤ 1
∫( u(t) - b*S(t) ) → min
end
sol = solve(ocp)
plot(sol)
|
Beta Was this translation helpful? Give feedback.
-
Bonjour Jean Baptiste Caillau et Pierre Martinon Ci joint mon code julia qui marche parfaitement jusqu’à tf = 70 mais des lors que je passe a tf = 80 je rencontre des problèmes de non convergence pourtant je dois arriver jusqu’à tf = 300. Ma question est donc la suivante: comme sur le v2 comment redémarrer d'une solution initiale en utilisant par exemple #init=OptimalControlInit() dans la fonction solve. using OptimalControl
using Plots
tf = 80 # and other params
λ = 300
β =1e-07
μ = 0.05
d = 0.0002
a = 60
r = 0.15
rho = 400
K = 1000
nu = 0.045
b1 = 2500
b2 = 2
b3 = 5
@def ocp begin
t ∈ [ 0, tf ], time
x ∈ R³, state
u ∈ R, control
S = x₁
I = x₂
N = x₃
ẋ(t) == [ λ-β*(1-u(t))*S(t)*N(t)-μ*S(t),
β*(1-u(t))*S(t)*N(t)-μ*I(t)-d*N(t)*I(t)/(a+I(t)),
(r+rho*d*I(t)/(a+I(t)))*N(t)*(1-N(t)/(K*I(t)))-nu*N(t) ]
S(0) == 100
I(0) == 100
N(0) == 1000
0 ≤ u(t) ≤ 1
b3*I(tf) + ∫(b1*u(t) - b2*S(t) ) → min
end
sol = solve(ocp, grid_size = 100, max_iter = 2000, tol = 10e-20, print_level=5, mu_strategy="adaptive")
plot(sol) |
Beta Was this translation helpful? Give feedback.
-
Bonjour Frank,
devrait marcher avec la version actuelle de CTDirect. edit: release 0.4.6 faite, tu peux mettre a jour le package avec la commande 'up' dans le package REPL (accessible avec ]) |
Beta Was this translation helpful? Give feedback.
-
Bonjour @Jbcaillau et @PierreMartinon. Ci-joint un le lien vers un papier décrivant mon problème Aussi, je n'arrive pas toujours a faire le warm start. J'obtiens toujours cette erreur
|
Beta Was this translation helpful? Give feedback.
-
Dans ce papier, j'ai ajoute un exemple de simul que j'obtiens. Bref je cherche toujours a faire le warm start afin de voir comment ca marche. Si vous pouver m'aider avec un peu plus d'indications ou un exemple concret, cela me conviendrait. Merci |
Beta Was this translation helpful? Give feedback.
-
C'est ca le lien |
Beta Was this translation helpful? Give feedback.
-
@PierreMartinon peux-tu stp renvoyer à @fkemayou un exemple simple de warm start ? |
Beta Was this translation helpful? Give feedback.
-
@ocots check this example |
Beta Was this translation helpful? Give feedback.
-
@rand-asswad n'hésite pas à utiliser cette discussion pour échanger avec @PierreMartinon et les autres personnes impliquées dans control-toolbox. On est bien sûr intéressés par ton retour d'expérience, si tu as un exemple pour alimenter les exemples / tutos déjà présents ici, parfait 🤞🏾 |
Beta Was this translation helpful? Give feedback.
-
@fkemayou tu peux merger cette PR fkemayou/example#1 (cliquer sur le bouton |
Beta Was this translation helpful? Give feedback.
-
@fkemayou @agustinyabo Bonjour ! Si vous souhaitez ajouter une application à la liste des applications que l'on trouve sur la documentation de OptimalControl.jl, vous êtes les bienvenus. Pour cela, il vous suffit de suivre le tutoriel ici. |
Beta Was this translation helpful? Give feedback.
-
Très bien @ocots, je le regarde ça |
Beta Was this translation helpful? Give feedback.
-
@ocots quantum stuff |
Beta Was this translation helpful? Give feedback.
-
@jbcaillau |
Beta Was this translation helpful? Give feedback.
-
My plaisir non dissimulated :D
|
Beta Was this translation helpful? Give feedback.
-
@ocots rings a bell 🙂? |
Beta Was this translation helpful? Give feedback.
-
@Weng-W0 code below for your example (this one converges) using OptimalControl
using NLPModelsIpopt
using Plots
const T = 10.0
const x0 = [1.0, 0.0]
const α = [0.5, 0.35]
ocp = @def begin
t ∈ [0, T], time
x ∈ R², state
u ∈ R, control
x(0) == x0
ẋ(t) == [x₂(t), u(t)]
∫( 0.5u(t)^2 + F(x(t), α) ) → min
end
function F(x, α)
r = 0.
for i ∈ 1:length(α)
r = r + abs(x[i])^(1 + α[i]) / (1 + α[i]) # non-smooth!
end
return r
end
sol = solve(ocp)
plot(sol) plus a link towards a shooting example: |
Beta Was this translation helpful? Give feedback.
-
@jbcaillau Do we close? Where are we with this discussion? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bactery growth
@agustinyabo Try this. The length three bracket$H_{101}$ not being zero at this particular point, it is not identically zero (while it is zero on ${H_1=H_{01}=0}$ as your previous computation shows). So the singular is of local order two.
Beta Was this translation helpful? Give feedback.
All reactions