Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knot-vectors? #71

Closed
jbcaillau opened this issue Oct 19, 2023 · 4 comments
Closed

Knot-vectors? #71

jbcaillau opened this issue Oct 19, 2023 · 4 comments
Assignees

Comments

@jbcaillau
Copy link
Member

jbcaillau commented Oct 19, 2023

@PierreMartinon @gergaud Error when solving the problem

@def ocp begin
    tf  R, variable
    t  [ 0, tf ], time
    x  R², state
    u  R, control
    tf  0
    -1  u(t)  1
    q = x₁
    v = x₂
    q(0) == 1
    v(0) == 2
    q(tf) == 0
    v(tf) == 0
    0  q(t)  5
    -2  v(t)  3
    (u^2)(t)  100
    (t) == [ v(t), u(t) ]
    tf  min
end

NB. The constraint (u^2)(t) ≤ 100 is for testing purpose only

IMG_2650
IMG_2651

@PierreMartinon
Copy link
Member

If I recall correctly the knot-vector message comes sometimes from the 1D interpolation when generating the (functional) OCP solution from the discretized problem solution. I did not find the cause when looking at the time steps vector that looked fine, but the problem vanished in the CTDirect test suite when updating to Julia 1.9 or more. I'll retest this.

@PierreMartinon
Copy link
Member

PierreMartinon commented Apr 9, 2024

Ok @jbcaillau , the solution generation fails here because the optimization did not converge, and finished with a negative tf. The time steps grid is therefore nonincreasing... I added a failsafe here to prevent the error: tf = max(tf, t0+eps).

On a side note, the optimization fails because the constraint tf>=0 causes Ipopt to get stuck at tf=0. Putting a strictly positive lower bound (eg 0.1) is enough to get the convergence. We may want to warn about this as it is a very common 'mistake' (in Bocop the lower bound was set automatically to 1e-3). I could try to detect a 0 lower bound for tf ?

@jbcaillau
Copy link
Member Author

@PierreMartinon

Ok @jbcaillau , the solution generation fails here because the optimization did not converge, and finished with a negative tf. The time steps grid is therefore nonincreasing... I added a failsafe here to prevent the error: tf = max(tf, t0+eps).

PR?

On a side note, the optimization fails because the constraint tf>=0 causes Ipopt to get stuck at tf=0. Putting a strictly positive lower bound (eg 0.1) is enough to get the convergence. We may want to warn about this as it is a very common 'mistake' (in Bocop the lower bound was set automatically to 1e-3). I could try to detect a 0 lower bound for tf ?

Well done. Indeed, back to normal with $t_f \geq 0.3$:

@def ocp begin
           tf  R, variable
           t  [ 0, tf ], time
           x  R², state
           u  R, control
           tf  1e-3
           -1  u(t)  1
           q = x₁
           v = x₂
           q(0) == 1
           v(0) == 2
           q(tf) == 0
           v(tf) == 0
           0  q(t)  5
           -2  v(t)  3
           (u^2)(t)  100
           (t) == [ v(t), u(t) ]
           tf  min
       end

IMG_3036

@PierreMartinon
Copy link
Member

PierreMartinon commented Apr 10, 2024

@jbcaillau #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants