# \[ANN\] New release of OptimalControl.jl

**URL:** <https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764>\
**Category:** Package Announcements\
**Tags:** control, ode, optimization\
**Created:** [September 30, 2025, 6:05am UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764 "2025-09-30T06:05:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![control-toolbox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/control-toolbox/32/218817_2.png) [@control-toolbox](https://discourse.julialang.org/u/control-toolbox)\
**Post date:** [September 30, 2025, 6:05am UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/1 "2025-09-30T06:05:25Z")

</div>

It is a pleasure to announce the new release of [OptimalControl.jl](https://control-toolbox.org/OptimalControl.jl) (v1.1). Intended to solve optimal control problems on ODEs, the package features:

- a [friendly DSL](https://control-toolbox.org/OptimalControl.jl/stable/manual-abstract.html)
- both [direct](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve.html) (optimisation) and [indirect](https://control-toolbox.org/OptimalControl.jl/stable/example-double-integrator-time.html#Indirect-method) (_aka._ shooting) methods
- [solving on GPU](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve-gpu.html)
- a bunch of examples: [tutorials](https://control-toolbox.org/Tutorials.jl), [applications](https://control-toolbox.org/MagneticResonanceImaging.jl/stable/saturation.html) and [collection of problems](https://control-toolbox.org/OptimalControlProblems.jl)

Give it a try, and if ever the syntax below does not look familiar enough 🙂…

```julia
ocp = @def begin
    t ∈ [0, 1], time
    x ∈ R², state
    u ∈ R, control
    x(0) == [-1, 0]
    x(1) == [0, 0]
    x₂(t) ≤ 1.2
    ẋ(t) == [x₂(t), u(t)]
    0.5∫(u(t)^2) → min
end

```

… ask your favorite AI to [translate the math](https://control-toolbox.org/OptimalControl.jl/stable/manual-ai-ded.html) for you!

We welcome contributions and will be glad to get in touch at [JuliaCon local in Paris](https://juliacon.org/local/paris2025) next week 🇫🇷

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [October 1, 2025, 5:13am UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/2 "2025-10-01T05:13:17Z")

</div>

Very nice! One comment I will make is that at a glance `@def` seems like an awfully generic macro. `@optcontrol`, `@controlproblem` or even just `@problem` would seem more appropriate to me.

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [October 1, 2025, 7:05am UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/3 "2025-10-01T07:05:01Z")

</div>

Or perhaps @ocp, as the OCP is fairly common short for optimal control problem.

---

<div class="post-metadata">

**Author:** ![jbcaillau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbcaillau/32/206767_2.png) [@jbcaillau](https://discourse.julialang.org/u/jbcaillau)\
**Post date:** [October 1, 2025, 3:53pm UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/4 "2025-10-01T15:53:36Z")

</div>

It is 🥲! Actually, we intended it to be generic, exactly as `solve` (generic name to call the solver using dispatch) of `model` (generic type name in other modellers)… or even `@problem`. This seems to be common practice in such a case, but that is of course debatable.

Thanks for the feedback

---

<div class="post-metadata">

**Author:** ![jbcaillau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbcaillau/32/206767_2.png) [@jbcaillau](https://discourse.julialang.org/u/jbcaillau)\
**Post date:** [October 1, 2025, 4:48pm UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/5 "2025-10-01T16:48:37Z")

</div>

Actually, one can always prefix the (generic) macro name by the package (module): `OptimalControl.@def`. And then, I agree that `OCP` would be shorter. (Of course an alias can be defined after importing the package, so `OCP = OptimalControl` then `OCP.@def` works.)

---

<div class="post-metadata">

**Author:** ![amontoison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amontoison/32/218741_2.png) [@amontoison](https://discourse.julialang.org/u/amontoison)\
**Post date:** [October 6, 2025, 10:55am UTC](https://discourse.julialang.org/t/ann-new-release-of-optimalcontrol-jl/132764/6 "2025-10-06T10:55:49Z")

</div>

@jbcaillau I agree with @zdenek_hurak.  
A macro `@ocp` instead of `@def` is more explicit to define an optimal control problem.  
Do you already use this macro for something else?

Otherwise I suggest to add this macro as an alias to `@def`. You keep backward compatibility (old macro `@def` still defined) but you have another macro more “explicit” for new users.
