Skip to content

Commit 1708d5a

Browse files
committed
Update documentation and test files for control-free example
1 parent 84deef7 commit 1708d5a

4 files changed

Lines changed: 9 additions & 18 deletions

File tree

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ cp(
153153
Draft = false
154154
```
155155
=#
156-
draft = false # Draft mode: if true, @example blocks in markdown are not executed
156+
draft = true # Draft mode: if true, @example blocks in markdown are not executed
157157

158158
# ═══════════════════════════════════════════════════════════════════════════════
159159
# Load extensions

docs/src/assets/Manifest.toml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/example-control-free.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ Control-free problems are optimal control problems without a control variable. T
77

88
This page demonstrates two simple examples with known analytical solutions.
99

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-
1410
First, we import the necessary packages:
1511

1612
```@example main
@@ -46,13 +42,11 @@ ocp1 = @def begin
4642
p ∈ R, variable # growth rate to estimate
4743
t ∈ [0, 10], time
4844
x ∈ R, state
49-
u ∈ R, control # TO REMOVE WHEN POSSIBLE
5045
5146
x(0) == 2.0
52-
5347
ẋ(t) == p * x(t)
5448
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
5650
end
5751
nothing # hide
5852
```
@@ -103,15 +97,14 @@ ocp2 = @def begin
10397
ω ∈ R, variable # pulsation to optimize
10498
t ∈ [0, 1], time
10599
x = (q, v) ∈ R², state
106-
u ∈ R, control # TO REMOVE WHEN POSSIBLE
107100
108101
q(0) == 1.0
109102
v(0) == 0.0
110103
q(1) == 0.0 # final condition
111104
112105
ẋ(t) == [v(t), -ω^2 * q(t)]
113106
114-
ω^2 + 1e-5*∫(u(t)^2) → min # minimize pulsation # TO REMOVE u(t) when possible
107+
ω^2 → min # minimize pulsation
115108
end
116109
nothing # hide
117110
```

test/problems/control_free.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ function ExponentialGrowth()
2929
p R, variable # growth rate to estimate
3030
t [0, 10], time
3131
x R, state
32-
u R, control # TO REMOVE WHEN POSSIBLE
3332

3433
x(0) == 2.0
3534

3635
(t) == p * x(t)
3736

38-
((x(t) - data(t))^2 + 1e-5*u(t)^2) min # fit to observed data # TO REMOVE u(t) when possible
37+
((x(t) - data(t))^2) min # fit to observed data
3938
end
4039

4140
return (
@@ -73,15 +72,14 @@ function HarmonicOscillator()
7372
ω R, variable # pulsation to optimize
7473
t [0, 1], time
7574
x = (q, v) R², state
76-
u R, control # TO REMOVE WHEN POSSIBLE
7775

7876
q(0) == 1.0
7977
v(0) == 0.0
8078
q(1) == 0.0 # final condition
8179

8280
(t) == [v(t), -ω^2 * q(t)]
8381

84-
ω^2 + 1e-5*(u(t)^2) min # minimize pulsation # TO REMOVE u(t) when possible
82+
ω^2 min # minimize pulsation
8583
end
8684

8785
return (

0 commit comments

Comments
 (0)