You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using now common models from AI, it is an elementary task to have such an agent learn the syntax of OptimalControl.jl DSL, then use the agent to translate standard math into this DSL. Here is a typical prompt, pointing to the [DSL syntax](@ref manual-abstract-syntax):
4
+
5
+
```
6
+
learn the syntax of optimalcontrol.jl dsl described at the link below to translate math into this dsl (julia language):
Now, here is an extract of, *e.g.*, [claude.ai](https://claude.ai) answer (Sonnet 4 model) to the request below:
11
+
12
+
```
13
+
translate the problem below into this DSL: minimise the final time tf under the constraint q''(t) = u(t) with -1 <= u(t) <= 1, q(0) = 1, q'(0) = -2, q(tf) = 3, q'(tf) = 1, and q'(t) <= 1
14
+
```
15
+
16
+
```julia
17
+
@defbegin
18
+
tf ∈ R, variable
19
+
t ∈ [0, tf], time
20
+
x = (q, v) ∈ R², state
21
+
u ∈ R, control
22
+
23
+
# Variable constraint
24
+
tf ≥0
25
+
26
+
# Control constraint
27
+
-1≤u(t) ≤1
28
+
29
+
# Initial conditions
30
+
q(0) ==1
31
+
v(0) ==-2
32
+
33
+
# Final conditions
34
+
q(tf) ==3
35
+
v(tf) ==1
36
+
37
+
# Path constraint
38
+
v(t) ≤1
39
+
40
+
# Dynamics (q'' = u becomes first-order system)
41
+
ẋ(t) == [v(t), u(t)]
42
+
43
+
# Objective: minimize final time
44
+
tf → min
45
+
end
46
+
```
47
+
48
+
The answer is syntactically correct and can be updated, for instance according to the new request below:
0 commit comments