Skip to content

Commit c3c5f3b

Browse files
authored
Merge pull request #743 from control-toolbox/release-v2
Update documentation for control-free problems
2 parents a4917c3 + 0846150 commit c3c5f3b

7 files changed

Lines changed: 590 additions & 72 deletions

File tree

BREAKING.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Version 2.0.0 represents a major architectural redesign of OptimalControl.jl, in
1010
- **GPU/CPU parameter system** for heterogeneous computing
1111
- **Advanced option routing** with introspection and disambiguation tools
1212
- **New solver integrations** (Uno, MadNCL)
13-
- **Control-free problems** support
13+
- **Control-free problems** support with augmented Hamiltonian approach
14+
- **CTFlows enhancements** with `augment=true` and direct OCP flow creation
1415
- **Modernized reexport system** using `@reexport import`
1516

1617
## Removed Functions
@@ -172,7 +173,7 @@ The old functional approach is no longer supported.
172173

173174
These features are new in v2.0.0 but don't break existing code:
174175

175-
### Control-Free Problems
176+
### Control-Free Problems Support
176177

177178
Support for optimal control problems without control variables:
178179

@@ -220,6 +221,45 @@ using CUDA, MadNLPGPU
220221
sol = solve(ocp, :collocation, :exa, :madnlp, :gpu)
221222
```
222223

224+
## CTFlows Features
225+
226+
### Control-Free Problems
227+
228+
v2.0.0 introduces comprehensive support for control-free problems (optimal control without control variables) with enhanced CTFlows integration:
229+
230+
**Augmented Hamiltonian approach:**
231+
232+
```julia
233+
# v1.1.6: Manual augmented Hamiltonian construction
234+
function H_aug(t, x_, p_)
235+
x, λ = x_
236+
p, _ = p_
237+
return H(t, x, p, λ)
238+
end
239+
f = Flow(Hamiltonian(H_aug))
240+
241+
# v2.0.0: Direct OCP flow creation
242+
f = Flow(ocp)
243+
```
244+
245+
**Automatic costate computation:**
246+
247+
```julia
248+
# v2.0.0: augment=true automatically computes p_λ(tf)
249+
function shoot!(s, p0, λ)
250+
_, px_tf, pλ_tf = f(t0, x0, p0, tf, λ; augment=true)
251+
s[1] = px_tf # p(tf) = 0
252+
s[2] = pλ_tf # p_λ(tf) = 0
253+
end
254+
```
255+
256+
**Mathematical framework:**
257+
258+
- Complete augmented system dynamics with proper transversality conditions
259+
- Automatic handling of Lagrange costs: $p_\lambda(t_f) = 0$
260+
- Automatic handling of Mayer costs: $p_\omega(t_f) = -2\omega$
261+
- Initial conditions: $p_\lambda(t_0) = 0$ by construction
262+
223263
## Dependency Updates
224264

225265
v2.0.0 requires updated versions of CTX packages:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5555
- Optimal control problems without control variables
5656
- Optimization of constant parameters in dynamical systems
5757
- Full integration with solve pipeline
58+
- **Augmented Hamiltonian approach**: `augment=true` feature in CTFlows for automatic costate computation
59+
- **Simplified flow creation**: `Flow(ocp)` directly creates Hamiltonian flow from control-free problems
60+
- **Mathematical framework**: Complete transversality conditions for variable parameters
61+
- **Documentation**: Comprehensive examples with exponential growth and harmonic oscillator
5862

5963
- **New solvers**:
6064
- **Uno**: CPU-only nonlinear optimization solver (methods with `:uno`)
@@ -78,6 +82,12 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7882
- Organized by source package (ctbase.jl, ctdirect.jl, ctflows.jl, ctmodels.jl, ctparser.jl, ctsolvers.jl)
7983
- Cleaner separation between imported and exported symbols
8084

85+
- **CTFlows enhancements**:
86+
- **Augmented Hamiltonian computation**: `augment=true` automatically computes costates for variable parameters
87+
- **Direct OCP flow creation**: `Flow(ocp)` creates Hamiltonian flow without manual Hamiltonian definition
88+
- **Transversality conditions**: Automatic handling of $p_\lambda(t_f) = 0$ for Lagrange costs and $p_\omega(t_f) = -2\omega$ for Mayer costs
89+
- **Mathematical rigor**: Complete augmented system dynamics with proper initial conditions
90+
8191
- **Strategy registry system**:
8292
- `StrategyRegistry` with metadata for all strategies
8393
- `StrategyMetadata` with id, options, and parameter support

docs/src/assets/Manifest.toml

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,19 @@ version = "1.0.6"
232232

233233
[[deps.CTFlows]]
234234
deps = ["CTBase", "CTModels", "DocStringExtensions", "ForwardDiff", "LinearAlgebra", "MLStyle", "MacroTools"]
235-
git-tree-sha1 = "536c34374ab27f3d4d6a51d9e92ed89f146ca989"
235+
git-tree-sha1 = "c4a9adf514aca4e006131a5e39792bcf01b449b4"
236236
uuid = "1c39547c-7794-42f7-af83-d98194f657c2"
237-
version = "0.8.20"
237+
version = "0.8.22-beta"
238238
weakdeps = ["OrdinaryDiffEq"]
239239

240240
[deps.CTFlows.extensions]
241241
CTFlowsODE = "OrdinaryDiffEq"
242242

243243
[[deps.CTModels]]
244244
deps = ["CTBase", "DocStringExtensions", "LinearAlgebra", "MLStyle", "MacroTools", "OrderedCollections", "Parameters", "RecipesBase"]
245-
git-tree-sha1 = "3e9df6b6cb96ccb05051ded9a5d4f76f649f6d0c"
245+
git-tree-sha1 = "791bcfa3cc9b39d2c1b5bc66581d1739bd8c96c0"
246246
uuid = "34c4fa32-2049-4079-8329-de33c2a22e2d"
247-
version = "0.9.12-beta"
247+
version = "0.9.13"
248248
weakdeps = ["JLD2", "JSON3", "Plots"]
249249

250250
[deps.CTModels.extensions]
@@ -254,9 +254,9 @@ weakdeps = ["JLD2", "JSON3", "Plots"]
254254

255255
[[deps.CTParser]]
256256
deps = ["CTBase", "DocStringExtensions", "MLStyle", "OrderedCollections", "Parameters", "Unicode"]
257-
git-tree-sha1 = "1a7445af1c937c291371e0f7c0a51a80f5b5d0eb"
257+
git-tree-sha1 = "0a57111b2d95d6272bb76f4f6f7c4fee1e40ce82"
258258
uuid = "32681960-a1b1-40db-9bff-a1ca817385d1"
259-
version = "0.8.12-beta"
259+
version = "0.8.13"
260260

261261
[[deps.CTSolvers]]
262262
deps = ["ADNLPModels", "CTBase", "CTModels", "CommonSolve", "DocStringExtensions", "ExaModels", "KernelAbstractions", "NLPModels", "SolverCore"]
@@ -921,9 +921,16 @@ version = "1.1.3"
921921

922922
[[deps.FunctionWrappersWrappers]]
923923
deps = ["FunctionWrappers", "PrecompileTools", "TruncatedStacktraces"]
924-
git-tree-sha1 = "6874da243fb93e34201d7d4587ffa0e920682f64"
924+
git-tree-sha1 = "5201523536a43bf8aef3914b7f60b552b098ef8e"
925925
uuid = "77dc65aa-8811-40c2-897b-53d922fa7daf"
926-
version = "1.0.0"
926+
version = "1.1.0"
927+
928+
[deps.FunctionWrappersWrappers.extensions]
929+
FunctionWrappersWrappersEnzymeExt = ["Enzyme", "EnzymeCore"]
930+
931+
[deps.FunctionWrappersWrappers.weakdeps]
932+
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
933+
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
927934

928935
[[deps.Future]]
929936
deps = ["Random"]
@@ -1696,21 +1703,21 @@ version = "0.21.12"
16961703

16971704
[[deps.NLPModelsIpopt]]
16981705
deps = ["Ipopt", "NLPModels", "NLPModelsModifiers", "SolverCore"]
1699-
git-tree-sha1 = "37a2187dc5f1291f6a6cb592acaa59cee685b5fb"
1706+
git-tree-sha1 = "260a33809f49f7ccb011fdc1d9ebcf8879bc9757"
17001707
uuid = "f4238b75-b362-5c4c-b852-0801c9a21d71"
1701-
version = "0.11.2"
1708+
version = "0.11.3"
17021709

17031710
[[deps.NLPModelsKnitro]]
17041711
deps = ["KNITRO", "NLPModels", "NLPModelsModifiers", "SolverCore"]
1705-
git-tree-sha1 = "90e9e12bf859aa3b9453a852015a552592b8ea95"
1712+
git-tree-sha1 = "763bda401fa32460dae1caa48f6ab3c195d3bf3e"
17061713
uuid = "bec4dd0d-7755-52d5-9a02-22f0ffc7efcb"
1707-
version = "0.10.2"
1714+
version = "0.10.3"
17081715

17091716
[[deps.NLPModelsModifiers]]
17101717
deps = ["FastClosures", "LinearAlgebra", "LinearOperators", "NLPModels", "Printf", "SparseArrays"]
1711-
git-tree-sha1 = "15bd5325aaa45090019f43b49cb3cb938b195f04"
1718+
git-tree-sha1 = "3a6ec5add6f5a95d598648432ac06126157ba11c"
17121719
uuid = "e01155f1-5c6f-4375-a9d8-616dd036575f"
1713-
version = "0.7.4"
1720+
version = "0.8.0"
17141721

17151722
[[deps.NLSolversBase]]
17161723
deps = ["ADTypes", "DifferentiationInterface", "FiniteDiff", "LinearAlgebra"]
@@ -1779,9 +1786,9 @@ version = "4.17.0"
17791786

17801787
[[deps.NonlinearSolveBase]]
17811788
deps = ["ADTypes", "Adapt", "ArrayInterface", "CommonSolve", "Compat", "ConcreteStructs", "DifferentiationInterface", "EnzymeCore", "FastClosures", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "LogExpFunctions", "Markdown", "MaybeInplace", "PreallocationTools", "PrecompileTools", "Preferences", "Printf", "RecursiveArrayTools", "SciMLBase", "SciMLJacobianOperators", "SciMLLogging", "SciMLOperators", "SciMLStructures", "Setfield", "StaticArraysCore", "SymbolicIndexingInterface", "TimerOutputs"]
1782-
git-tree-sha1 = "7deb924291e30ef27e8823e9d048ffb98ca6ffce"
1789+
git-tree-sha1 = "e9bad06173df78880b8c0fd51ad9cd940547a195"
17831790
uuid = "be0214bd-f91f-a760-ac4e-3421ce2b2da0"
1784-
version = "2.20.0"
1791+
version = "2.21.0"
17851792

17861793
[deps.NonlinearSolveBase.extensions]
17871794
NonlinearSolveBaseBandedMatricesExt = "BandedMatrices"
@@ -1811,25 +1818,25 @@ version = "2.20.0"
18111818

18121819
[[deps.NonlinearSolveFirstOrder]]
18131820
deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConcreteStructs", "FiniteDiff", "ForwardDiff", "LineSearch", "LinearAlgebra", "LinearSolve", "MaybeInplace", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase", "SciMLJacobianOperators", "Setfield", "StaticArraysCore"]
1814-
git-tree-sha1 = "eea7cbe389b168c77df7ff779fb7277019c685c8"
1821+
git-tree-sha1 = "ae36a13005343aed5e731f146637f61a54702444"
18151822
uuid = "5959db7a-ea39-4486-b5fe-2dd0bf03d60d"
1816-
version = "2.0.0"
1823+
version = "2.1.0"
18171824

18181825
[[deps.NonlinearSolveQuasiNewton]]
18191826
deps = ["ArrayInterface", "CommonSolve", "ConcreteStructs", "LinearAlgebra", "LinearSolve", "MaybeInplace", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase", "SciMLOperators", "StaticArraysCore"]
1820-
git-tree-sha1 = "ade27e8e9566b6cec63ee62f6a6650a11cf9a2eb"
1827+
git-tree-sha1 = "2ada8e9892fd60b3f01a4984704d66fca682bd50"
18211828
uuid = "9a2c21bd-3a47-402d-9113-8faf9a0ee114"
1822-
version = "1.12.0"
1829+
version = "1.13.0"
18231830
weakdeps = ["ForwardDiff"]
18241831

18251832
[deps.NonlinearSolveQuasiNewton.extensions]
18261833
NonlinearSolveQuasiNewtonForwardDiffExt = "ForwardDiff"
18271834

18281835
[[deps.NonlinearSolveSpectralMethods]]
18291836
deps = ["CommonSolve", "ConcreteStructs", "LineSearch", "MaybeInplace", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase"]
1830-
git-tree-sha1 = "eafd027b5cd768f19bb5de76c0e908a9065ddd36"
1837+
git-tree-sha1 = "e3e8be34968ad07be8734c3d6e42b3f14218b694"
18311838
uuid = "26075421-4e9a-44e1-8bd1-420ed7ad02b2"
1832-
version = "1.6.0"
1839+
version = "1.7.0"
18331840
weakdeps = ["ForwardDiff"]
18341841

18351842
[deps.NonlinearSolveSpectralMethods.extensions]
@@ -1931,9 +1938,9 @@ version = "1.14.0"
19311938

19321939
[[deps.OrdinaryDiffEqDifferentiation]]
19331940
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqCore", "SciMLBase", "SciMLOperators", "SparseMatrixColorings", "StaticArrays"]
1934-
git-tree-sha1 = "c7d06493d3327cc45f0d8d7e641203d28779e837"
1941+
git-tree-sha1 = "8b18ce8ab49cd04a1443fd63eb569d270a07090c"
19351942
uuid = "4302a76b-040a-498a-8c04-15b101fed76b"
1936-
version = "2.6.0"
1943+
version = "2.7.0"
19371944
weakdeps = ["SparseArrays"]
19381945

19391946
[deps.OrdinaryDiffEqDifferentiation.extensions]
@@ -2007,9 +2014,9 @@ version = "1.14.0"
20072014

20082015
[[deps.OrdinaryDiffEqNonlinearSolve]]
20092016
deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "FastClosures", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MuladdMacro", "NonlinearSolve", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "PreallocationTools", "RecursiveArrayTools", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "SparseArrays", "StaticArrays"]
2010-
git-tree-sha1 = "f6722d6a96c27263ac3ea6159a3174914567a807"
2017+
git-tree-sha1 = "7eabb9877144d3cfc894fee899a76439ee2070de"
20112018
uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8"
2012-
version = "1.25.0"
2019+
version = "1.26.0"
20132020

20142021
[[deps.OrdinaryDiffEqNordsieck]]
20152022
deps = ["DiffEqBase", "FastBroadcast", "LinearAlgebra", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqTsit5", "Polyester", "RecursiveArrayTools", "Reexport", "SciMLBase", "Static"]
@@ -2043,9 +2050,9 @@ version = "1.12.0"
20432050

20442051
[[deps.OrdinaryDiffEqRosenbrock]]
20452052
deps = ["ADTypes", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Static"]
2046-
git-tree-sha1 = "88f722a74df3dadaf5f31c454a280f1201a1b368"
2053+
git-tree-sha1 = "25e5043968c80e0addead2d7533d30a608478842"
20472054
uuid = "43230ef6-c299-4910-a778-202eb28ce4ce"
2048-
version = "1.28.0"
2055+
version = "1.29.0"
20492056

20502057
[[deps.OrdinaryDiffEqSDIRK]]
20512058
deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "LinearAlgebra", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "TruncatedStacktraces"]
@@ -2289,12 +2296,13 @@ version = "0.6.12"
22892296

22902297
[[deps.RecursiveArrayTools]]
22912298
deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "LinearAlgebra", "PrecompileTools", "RecipesBase", "StaticArraysCore", "SymbolicIndexingInterface"]
2292-
git-tree-sha1 = "e4fd3369c78666a65ccec25dba28a0b181434ab2"
2299+
git-tree-sha1 = "d0282d612f22dcad7b81cf487b746e63aa2a6709"
22932300
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
2294-
version = "3.52.0"
2301+
version = "3.54.0"
22952302

22962303
[deps.RecursiveArrayTools.extensions]
22972304
RecursiveArrayToolsFastBroadcastExt = "FastBroadcast"
2305+
RecursiveArrayToolsFastBroadcastPolyesterExt = ["FastBroadcast", "Polyester"]
22982306
RecursiveArrayToolsForwardDiffExt = "ForwardDiff"
22992307
RecursiveArrayToolsKernelAbstractionsExt = "KernelAbstractions"
23002308
RecursiveArrayToolsMeasurementsExt = "Measurements"
@@ -2313,6 +2321,7 @@ version = "3.52.0"
23132321
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
23142322
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
23152323
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
2324+
Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588"
23162325
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
23172326
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
23182327
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -2434,9 +2443,9 @@ weakdeps = ["Tracy"]
24342443

24352444
[[deps.SciMLOperators]]
24362445
deps = ["Accessors", "ArrayInterface", "DocStringExtensions", "LinearAlgebra"]
2437-
git-tree-sha1 = "794c760e6aafe9f40dcd7dd30526ea33f0adc8b7"
2446+
git-tree-sha1 = "234869cf9fee9258a95464b7a7065cc7be84db00"
24382447
uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
2439-
version = "1.15.1"
2448+
version = "1.16.0"
24402449
weakdeps = ["SparseArrays", "StaticArraysCore"]
24412450

24422451
[deps.SciMLOperators.extensions]

0 commit comments

Comments
 (0)