Replies: 2 comments 4 replies
-
For the moment, we can write something like that: using OptimalControl
using NLPModelsIpopt
using Plots
c0(N) = repeat([-1, 0], N)
cf(N) = repeat([ 0, 0], N)
f(x, u) = [x[2], u]
f(x, u, N) = reduce(vcat, [f(x[2i-1:2i], u) for i ∈ 1:N])
N = 3
ocp = @def begin
t ∈ [0, 1], time
x ∈ R^(2N), state
u ∈ R, control
x(0) == c0(N)
x(1) == cf(N)
ẋ(t) == f(x(t), u(t), N)
∫( 0.5u(t)^2 ) → min
end
sol = solve(ocp) |
Beta Was this translation helpful? Give feedback.
2 replies
-
Thank you @ocots I would like a slightly more general dynamic: In other words, the dynamics of a single state can be affected by other states. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Consider a parameterized dynamics$f(x, u, \theta)$ , with $x\in\mathbb{R}$ and an optimal control problem where we have the dynamics:
and some constraints of the form:
It would be nice to have the possibility to write something like:
Beta Was this translation helpful? Give feedback.
All reactions