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
Copy file name to clipboardExpand all lines: docs/src/example-control-free.md
+2-9Lines changed: 2 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,6 @@ Control-free problems are optimal control problems without a control variable. T
7
7
8
8
This page demonstrates two simple examples with known analytical solutions.
9
9
10
-
!!! compat "Upcoming feature"
11
-
12
-
The syntax shown here uses a workaround with a dummy control variable (`u ∈ R, control`) and a small penalty term (`1e-5*u(t)^2`) in the cost to force `u ≈ 0`, because the parser does not yet support omitting the control declaration. These workaround lines are marked with `# TO REMOVE WHEN POSSIBLE` and will be removed once native control-free syntax is implemented.
13
-
14
10
First, we import the necessary packages:
15
11
16
12
```@example main
@@ -46,13 +42,11 @@ ocp1 = @def begin
46
42
p ∈ R, variable # growth rate to estimate
47
43
t ∈ [0, 10], time
48
44
x ∈ R, state
49
-
u ∈ R, control # TO REMOVE WHEN POSSIBLE
50
45
51
46
x(0) == 2.0
52
-
53
47
ẋ(t) == p * x(t)
54
48
55
-
∫((x(t) - data(t))^2 + 1e-5*u(t)^2) → min # fit to observed data # TO REMOVE u(t) when possible
49
+
∫((x(t) - data(t))^2) → min # fit to observed data
56
50
end
57
51
nothing # hide
58
52
```
@@ -103,15 +97,14 @@ ocp2 = @def begin
103
97
ω ∈ R, variable # pulsation to optimize
104
98
t ∈ [0, 1], time
105
99
x = (q, v) ∈ R², state
106
-
u ∈ R, control # TO REMOVE WHEN POSSIBLE
107
100
108
101
q(0) == 1.0
109
102
v(0) == 0.0
110
103
q(1) == 0.0 # final condition
111
104
112
105
ẋ(t) == [v(t), -ω^2 * q(t)]
113
106
114
-
ω^2 + 1e-5*∫(u(t)^2) → min # minimize pulsation # TO REMOVE u(t) when possible
0 commit comments