Skip to content

Commit 53bf52b

Browse files
committed
abstract tuto update
1 parent dbd7c55 commit 53bf52b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/src/tutorial-abstract.md

+39
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ As before, there are automatic aliases (`u₁` and `u1` for `u[1]`, *etc.*) and
137137
end
138138
```
139139

140+
!!! note
141+
One dimensional variable, state or control are treated as scalars (`Real`), not vectors (`Vector`). In Julia, for `x::Real`, it is possible to write `x[1]` (and `x[1][1]`...) so it is OK (though useless) to write `x₁`, `x1` or `x[1]` instead of simply `x` to access the corresponding value. Conversely it is *not* OK to use such an `x` as a vector, for instance as in `...f(x)...` where `f(x::Vector{T}) where {T <: Real}`.
142+
140143
## [Dynamics](@id tutorial-abstract-dynamics)
141144

142145
```julia
@@ -299,6 +302,38 @@ using OptimalControl
299302
end
300303
```
301304

305+
!!! caveat
306+
Constraint bounds must be *effective*, that is must not depend on a variable. For instance, instead of
307+
```julia
308+
o = @def begin
309+
v R, variable
310+
t [0, 1], time
311+
x R², state
312+
u R, control
313+
-1 v 1
314+
x₁(0) == -1
315+
x₂(0) == v # wrong: the bound is not effective (as it depends on the variable)
316+
x(1) == [0, 0]
317+
(t) == [x₂(t), u(t)]
318+
( 0.5u(t)^2 ) min
319+
end
320+
```
321+
write
322+
```julia
323+
o = @def begin
324+
v R, variable
325+
t [0, 1], time
326+
x R², state
327+
u R, control
328+
-1 v 1
329+
x₁(0) == -1
330+
x₂(0) - v == 0 # OK: the boundary contraint may involve the variable
331+
x(1) == [0, 0]
332+
(t) == [x₂(t), u(t)]
333+
( 0.5u(t)^2 ) min
334+
end
335+
```
336+
302337
## [Mayer cost](@id tutorial-abstract-mayer)
303338

304339
```julia
@@ -506,3 +541,7 @@ end
506541

507542
- Parsing errors should be explicit enough (with line number in the `@def` `begin ... end` block indicated) 🤞🏾
508543
- Check tutorials and applications in the documentation for further use.
544+
545+
## Known issues
546+
547+
- [Constants and (reverse over forward) AD](https://github.com/JuliaSmoothOptimizers/ADNLPModels.jl/issues/346)

0 commit comments

Comments
 (0)