Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
version:
- '1.10'
- '1.11'
- '1.12'
os:
- ubuntu-latest
- windows-latest
Expand Down
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"MD046": false,
"MD013": false
"MD013": false,
"MD033": false
}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OptimalControl"
uuid = "5f98b655-cc9a-415a-b60e-744165666948"
authors = ["Olivier Cots <[email protected]>"]
version = "1.1.4"
version = "1.1.5"

[deps]
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ makedocs(;
],
"Manual" => [
"Define a problem" => "manual-abstract.md",
"Use AI" => "manual-ai-ded.md",
"Use AI" => "manual-ai-llm.md",
"Problem characteristics" => "manual-model.md",
"Set an initial guess" => "manual-initial-guess.md",
"Solve a problem" => "manual-solve.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/assets/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,7 @@ uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.59.0+0"

[[deps.oneTBB_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl"]
git-tree-sha1 = "d5a767a3bb77135a99e433afe0eb14cd7f6914c3"
uuid = "1317d2d5-d96f-522e-a858-c73665f53c3e"
version = "2022.0.0+0"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/example-double-integrator-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and the limit conditions
x(0) = (1,2), \quad x(t_f) = (0,0).
```

This problem can be interpretated as a simple model for a wagon with constant mass moving along a line without fricton.
This problem can be interpreted as a simple model for a wagon with constant mass moving along a line without friction.

```@raw html
<img src="./assets/chariot.svg" style="display: block; margin: 0 auto 20px auto;" width="400px">
Expand Down
63 changes: 29 additions & 34 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,64 +75,59 @@ If you want to ask a question, feel free to start a discussion [here](https://gi

## Reproducibility

```@setup main
using Pkg
using InteractiveUtils
using Markdown

# Download links for the benchmark environment
function _downloads_toml(DIR)
link_manifest = joinpath("assets", DIR, "Manifest.toml")
link_project = joinpath("assets", DIR, "Project.toml")
return Markdown.parse("""
You can download the exact environment used to build this documentation:
- 📦 [Project.toml]($link_project) - Package dependencies
- 📋 [Manifest.toml]($link_manifest) - Complete dependency tree with versions
""")
end
```

```@example main
_downloads_toml(".") # hide
```

```@raw html
<details><summary>The documentation of this package was built using these direct dependencies,</summary>
<details style="margin-bottom: 0.5em; margin-top: 1em;"><summary>ℹ️ Version info</summary>
```

```@example
using Pkg # hide
Pkg.status() # hide
```@example main
versioninfo() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>and using this machine and Julia version.</summary>
<details style="margin-bottom: 0.5em;"><summary>📦 Package status</summary>
```

```@example
using InteractiveUtils # hide
versioninfo() # hide
```@example main
Pkg.status() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
<details style="margin-bottom: 0.5em;"><summary>📚 Complete manifest</summary>
```

```@example
using Pkg # hide
```@example main
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
```

```@raw html
</details>
```

```@eval
using TOML
using Markdown
version = TOML.parse(read("../../Project.toml", String))["version"]
name = TOML.parse(read("../../Project.toml", String))["name"]
link_manifest = "https://github.com/control-toolbox/" *
name *
".jl/tree/gh-pages/v" *
version *
"/assets/Manifest.toml"
link_project = "https://github.com/control-toolbox/" *
name *
".jl/tree/gh-pages/v" *
version *
"/assets/Project.toml"
Markdown.parse("""You can also download the
[manifest]($link_manifest)
file and the
[project]($link_project)
file.
""")
```
2 changes: 1 addition & 1 deletion docs/src/juliacon-paris-2025.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ Total wall-clock secs = 0.083

- New applications (space mechanics, biology, quantum mechanics and more) -> check David's talk
- Collection of problems: [OptimalControlProblems.jl](https://control-toolbox.org/OptimalControlProblems.jl)
- ... and open to contributions! Give it a [try](@ref manual-ai-ded), give it a star ⭐️
- ... and open to contributions! Give it a [try](@ref manual-ai-llm), give it a star ⭐️

```@raw html
<a href="https://github.com/control-toolbox/OptimalControl.jl"><img width="800" alt="OptimalControl.jl" src="./assets/star.jpg"></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/manual-abstract.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ o = @def begin
u ∈ R, control
-1 ≤ v ≤ 1
x₁(0) == -1
x₂(0) - v == 0 # OK: the boundary contraint may involve the variable
x₂(0) - v == 0 # OK: the boundary constraint may involve the variable
x(1) == [0, 0]
ẋ(t) == [x₂(t), u(t)]
∫( 0.5u(t)^2 ) → min
end
```

!!! warning
When solving with the option `:exa` to rely on the ExaModels modeller (check the [solve section](@ref manual-solve)), for instance to [solve on GPU](@ref manual-solve-gpu), it is **compulsory** that *nonlinear* constraints (not ranges) are *scalar*, whatever the type (boundary, variable, controle, state, mixed).
When solving with the option `:exa` to rely on the ExaModels modeller (check the [solve section](@ref manual-solve)), for instance to [solve on GPU](@ref manual-solve-gpu), it is **compulsory** that *nonlinear* constraints (not ranges) are *scalar*, whatever the type (boundary, variable, control, state, mixed).

## [Mayer cost](@id manual-abstract-mayer)

Expand Down
91 changes: 0 additions & 91 deletions docs/src/manual-ai-ded.md

This file was deleted.

116 changes: 116 additions & 0 deletions docs/src/manual-ai-llm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# [Use AI](@id manual-ai-llm)

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):

```text
Learn the syntax of OptimalControl.jl DSL described at the link below
to translate math into this DSL (Julia language):
https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html.
```

```@raw html
<div style="display:flex; align-items:center; gap:8px; margin:16px 0;">
<span style="font-weight:600; color:#666;">Try with:</span>
<!-- ChatGPT -->
<a href="https://chat.openai.com/?q=Learn+the+syntax+of+OptimalControl.jl+DSL+described+at+the+link+below+to+translate+math+into+this+DSL+(Julia+language):+https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html" target="_blank" rel="nofollow noreferrer noopener" style="padding:4px 10px; background-color:#10A37F; color:#fff; border-radius:20px; font-size:13px; font-weight:600; text-decoration:none; transition:opacity 0.3s;">
ChatGPT
</a>

<!-- Claude -->
<a href="https://claude.ai/new?q=Learn+the+syntax+of+OptimalControl.jl+DSL+described+at+the+link+below+to+translate+math+into+this+DSL+(Julia+language):+https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html" target="_blank" rel="nofollow noreferrer noopener" style="padding:4px 10px; background-color:#CC9B7A; color:#fff; border-radius:20px; font-size:13px; font-weight:600; text-decoration:none; transition:opacity 0.3s;">
Claude
</a>

<!-- Perplexity -->
<a href="https://www.perplexity.ai/search/new?q=Learn+the+syntax+of+OptimalControl.jl+DSL+described+at+the+link+below+to+translate+math+into+this+DSL+(Julia+language):+https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html" target="_blank" rel="nofollow noreferrer noopener" style="padding:4px 10px; background-color:#9C4DE2; color:#fff; border-radius:20px; font-size:13px; font-weight:600; text-decoration:none; transition:opacity 0.3s;">
Perplexity
</a>

<!-- Mistral AI -->
<a href="https://chat.mistral.ai/chat?q=Learn+the+syntax+of+OptimalControl.jl+DSL+described+at+the+link+below+to+translate+math+into+this+DSL+(Julia+language):+https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html" target="_blank" rel="nofollow noreferrer noopener" style="padding:4px 10px; background-color:#FF7000; color:#fff; border-radius:20px; font-size:13px; font-weight:600; text-decoration:none; transition:opacity 0.3s;">
Mistral
</a>
</div>
```

Now, here is an extract of, *e.g.*, [claude.ai](https://claude.ai) answer (Sonnet 4 model) to the request below:

```text
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.
```

```julia
@def begin
tf ∈ R, variable
t ∈ [0, tf], time
x = (q, v) ∈ R², state
u ∈ R, control

# Variable constraint
tf ≥ 0

# Control constraint
-1 ≤ u(t) ≤ 1

# Initial conditions
q(0) == 1
v(0) == -2

# Final conditions
q(tf) == 3
v(tf) == 1

# Path constraint
v(t) ≤ 1

# Dynamics (q'' = u becomes first-order system)
ẋ(t) == [v(t), u(t)]

# Objective: minimize final time
tf → min
end
```

The answer is syntactically correct and can be updated, for instance according to the new request below:

```text
Use a form compatible with examodels.
```

```julia
@def begin
tf ∈ R, variable
t ∈ [0, tf], time
x = (q, v) ∈ R², state
u ∈ R, control

# Variable constraint
tf ≥ 0

# Control constraint
-1 ≤ u(t) ≤ 1

# Initial conditions
q(0) == 1
v(0) == -2

# Final conditions
q(tf) == 3
v(tf) == 1

# Path constraint
v(t) ≤ 1

# Dynamics (coordinate-wise for ExaModels)
∂(q)(t) == v(t)
∂(v)(t) == u(t)

# Objective: minimize final time
tf → min
end
```
Loading
Loading