Replies: 5 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Consider the problem: The pseudo-Hamiltonian (normal case The costate is constant since Hence, p = costate(sol)
using LinearAlgebra
norm(p(t0)) Besides, Now so or At the end, any |
Beta Was this translation helpful? Give feedback.
-
Another possibility is to restrict to (parameterized) paths with constant speed: ocp = @def begin
t ∈ [ t0, tf ], time
q = (x₁, x₂, λ) ∈ R³, state
u ∈ R², control
[x₁, x₂](t0) == [x0, y0]
[x₁, x₂](tf) == [xf, yf]
λ(t) - (u1(t)^2 + u2(t)^2) == 0
q̇(t) == [
u1(t),
u2(t),
0*λ(t) # sould be 0 but it bugs because of AD
]
∫( √(u1(t)^2 + u2(t)^2) ) → min
end this is equivalent to replace |
Beta Was this translation helpful? Give feedback.
-
Thank you. Actually, a simple solution is to change the objective to ∫( 1 + u1(t)^2 + u2(t)^2 ) → min i.e., we consider that the curve lies in a plane in |
Beta Was this translation helpful? Give feedback.
-
@dpo Another point of view (maybe the best) is to consider the minimum time problem, but we need to impose some constraints on the control. t0 = 0
A = [0, 0]
B = [1, 1]
ocp = @def begin
tf ∈ R, variable
t ∈ [ t0, tf ], time
x ∈ R², state
u ∈ R², control
tf ≥ 0.1 # to help convergence
x(t0) == A
x(tf) == B
u1(t)^2 + u2(t)^2 ≤ 1
ẋ(t) == u(t)
tf → min
end The final time |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. In my class, one of the simplest examples of a control problem that I use is to find the shortest curve$(x(t), y(t))$ in the plane between two fixed points. Of course, the solution should be a line segment. Here is my model:
I solve the model with IPOPT:
The final objective value makes sense. But when I plot the solution,
plot(sol)
I get
So ... not exactly a straight line. Did I do something wrong?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions