Skip to content

[Bug] Reverse over forward AD issues with ADNLP #481

@jbcaillau

Description

@jbcaillau

@ocots @PierreMartinon Same kind of error with AD as in #384 tough here the problem seems to be directly related to using a constant in the computation: this fails (Cannot determine ordering of Dual tags ForwardDiff.Tag)

using OptimalControl
using NLPModelsIpopt

o = @def begin
           v  R, variable
           t  [0, 1], time
           x  R², state
           u  R, control
           -1  v  1
           x(0) - [-1, v] == [0, 0] # OK: the boundary contraint may involve the variable
           x(1) == [0, 0]
           ẋ(t) == [x₂(t), u(t)]
           ∫( 0.5u(t)^2 )  min
       end

s = solve(o)

this also fails (same error)

o = @def begin
           v  R, variable
           t  [0, 1], time
           x  R², state
           u  R, control
           -1  v  1
           x(0) - [-one(v), v] == [0, 0] # OK: the boundary contraint may involve the variable
           x(1) == [0, 0]
           ẋ(t) == [x₂(t), u(t)]
           ∫( 0.5u(t)^2 )  min
       end

while this is OK

o = @def begin
           v  R, variable
           t  [0, 1], time
           x  R², state
           u  R, control
           -1  v  1
           x(0) - [-1 + 0v, v] == [0, 0] # OK: the boundary contraint may involve the variable
           x(1) == [0, 0]
           ẋ(t) == [x₂(t), u(t)]
           ∫( 0.5u(t)^2 )  min
       end

@PierreMartinon I thought that using one as above (second version; see also zero) solved the problem, but this is not the case. any clue?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions