# \[ANN\] OptimalControl.jl v2.0.0

**URL:** <https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599>\
**Category:** Package Announcements\
**Tags:** package, control, gpu, optimization\
**Created:** [April 7, 2026, 9:37am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599 "2026-04-07T09:37:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ocots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ocots/32/218820_2.png) [@ocots](https://discourse.julialang.org/u/ocots)\
**Post date:** [April 7, 2026, 9:37am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/1 "2026-04-07T09:37:41Z")

</div>

It is a pleasure to announce the new major release of [OptimalControl.jl](https://control-toolbox.org/OptimalControl.jl) (v2.0.0). Designed 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-energy.html#Indirect-method) (_aka._ shooting) methods
- [solving on GPU](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve-gpu.html) — now as simple as `solve(ocp, :gpu)`
- a bunch of examples: [tutorials](https://control-toolbox.org/Tutorials.jl), [applications](https://control-toolbox.org/MagneticResonanceImaging.jl/stable/) and [collection of problems](https://control-toolbox.org/OptimalControlProblems.jl)

## What’s new in v2.0

### More solvers, more flexibility

OptimalControl.jl now supports **5 nonlinear optimization solvers** ([Ipopt](https://jso.dev/NLPModelsIpopt.jl/stable/), [MadNLP](https://madsuite.org/MadNLP.jl/stable/), [Uno](https://github.com/cvanaret/Uno), [MadNCL](https://github.com/MadNLP/MadNCL.jl), [Knitro](https://github.com/jump-dev/KNITRO.jl)) with **12 total solving methods** combining different discretization schemes, modelers, and execution backends (CPU/GPU). See the [solve manual](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve.html) for the complete list.

GPU solving is now streamlined — just specify `:gpu`:

```julia
sol = solve(ocp, :gpu) # Automatically uses ExaModels + MadNLP on GPU (with cuDSS)

```

Learn more in the [GPU solving guide](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve-gpu.html).

### Control-free problems

A new feature allows solving **optimal control problems without control variables** — useful for parameter estimation and optimization of constant parameters in dynamical systems. For instance, finding the minimal pulsation \omega for a harmonic oscillator:

```julia
ocp = @def begin
    ω ∈ R, variable # pulsation to optimize
    t ∈ [0, 1], time
    x = (q, v) ∈ R², state
    
    q(0) == 1.0
    v(0) == 0.0
    q(1) == 0.0 # final condition
    
    ẋ(t) == [v(t), -ω^2 * q(t)]
    
    ω^2 → min # minimize pulsation
end

sol = solve(ocp)

```

See the [control-free problems example](https://control-toolbox.org/OptimalControl.jl/stable/example-control-free.html) for parameter estimation and optimization applications.

### Initial guess with `@init` macro

Initial guesses can now be constructed with the new `@init` macro, providing a cleaner and more intuitive syntax:

```julia
init = @init ocp begin
    x(t) := [1-t, 0]
    u(t) := 0
end

sol = solve(ocp; init=init)

```

Check out the [initial guess manual](https://control-toolbox.org/OptimalControl.jl/stable/manual-initial-guess.html) for details.

### Differential geometry tools documentation

OptimalControl.jl includes differential geometry operators for analyzing Hamiltonian systems and computing singular controls. These tools are now **fully documented** in v2.0. The `@Lie` macro provides convenient syntax for Poisson and Lie brackets:

```julia
# Define Hamiltonian functions directly
H0(x, p) = p[1] * x[2] + p[2] * x[1]
H1(x, p) = x[1]^2 + p[2]^2

# Compute Poisson brackets with @Lie macro
H01 = @Lie {H0, H1}

# Evaluate at a point
H01([1, 2], [3, 4])

```

See the [differential geometry tools manual](https://control-toolbox.org/OptimalControl.jl/stable/manual-differential-geometry.html) and the [singular control example](https://control-toolbox.org/OptimalControl.jl/stable/example-singular-control.html).

### Direct and indirect methods throughout

All examples in the documentation now systematically feature **both direct and indirect approaches** , demonstrating the versatility of the package. See for instance the [double integrator energy](https://control-toolbox.org/OptimalControl.jl/stable/example-double-integrator-energy.html) and [time minimisation](https://control-toolbox.org/OptimalControl.jl/stable/example-double-integrator-time.html) examples.

### Comprehensive documentation rewrite

The documentation has been completely rewritten with new manuals covering:

- [Solve options and advanced routing](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve-advanced.html)
- [GPU solving](https://control-toolbox.org/OptimalControl.jl/stable/manual-solve-gpu.html)
- [Initial guess construction](https://control-toolbox.org/OptimalControl.jl/stable/manual-initial-guess.html)
- [Differential geometry tools](https://control-toolbox.org/OptimalControl.jl/stable/manual-differential-geometry.html)
- [Control-free problems](https://control-toolbox.org/OptimalControl.jl/stable/example-control-free.html)

## The friendly DSL you know

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
    ẋ(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-llm.html) for you!

## About control-toolbox

OptimalControl.jl is part of the [control-toolbox ecosystem](https://github.com/control-toolbox), which brings together Julia packages for mathematical control and its applications:

- [OptimalControl.jl](https://control-toolbox.org/OptimalControl.jl) - Tools to model and solve optimal control problems with a friendly DSL
- [OptimalControlProblems.jl](https://control-toolbox.org/OptimalControlProblems.jl) - Curated collection of benchmark problems
- [CTBenchmarks.jl](https://control-toolbox.org/CTBenchmarks.jl) - Benchmarking suite (under construction)

## Acknowledgments

We would like to thank all [contributors](https://control-toolbox.org/contributors/) for their work on this package!

## Contributing

Contributions are welcome! Whether you want to report bugs, suggest features, or contribute code, feel free to open an issue or start a discussion on [GitHub](https://github.com/control-toolbox/OptimalControl.jl).

**Tags** : #optimization #control #optimalcontrol #nlp #gpu #julia

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [April 7, 2026, 10:18am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/2 "2026-04-07T10:18:34Z")

</div>

Very interesting! Thanks for sharing! Would you be interested in giving a talk at an upcoming [JuliaDynamics](https://discourse.julialang.org/t/juliadynamics-monthly-meetings-round-2/132357) meeting about this?

p.s.: There is the long existing ControlSystems.jl package. Do you mind writing some sort of comparison? I understand the different scope, as the latter is primarily for linear systems, but it is useful to have such comparisons in discourse for the broader community!

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [April 7, 2026, 10:26am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/3 "2026-04-07T10:26:10Z")

</div>

> [@Datseris](#):
>
> Would you be interested in giving a talk at an upcoming [JuliaDynamics](https://discourse.julialang.org/t/juliadynamics-monthly-meetings-round-2/132357) meeting about this?

I would be interested in hearing such a talk. So, if something like that will be scheduled, could you put the date and time for that in this thread?

---

<div class="post-metadata">

**Author:** ![drandran12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drandran12/32/220647_2.png) [@drandran12](https://discourse.julialang.org/u/drandran12)\
**Post date:** [April 7, 2026, 12:08pm UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/4 "2026-04-07T12:08:42Z")

</div>

@Datseris check the minimal action path tutorial [Minimal action · Tutorials](https://control-toolbox.org/Tutorials.jl/stable/tutorial-mam.html) 🙂

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [April 7, 2026, 7:15pm UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/5 "2026-04-07T19:15:09Z")

</div>

> [@Relationship between OptimalControl.jl and ControlSystems.jl](https://discourse.julialang.org/t/relationship-between-optimalcontrol-jl-and-controlsystems-jl/116959/6):
>
> Dear @ufechner7, dear all, seizing the opportunity of OptimalControl.jl latest release to provide some more details: As pointed by @baggepinnen the package is indeed devoted to trajectory (= solution to ODEs) optimisation, either by direct methods (transcription into nonlinear programs) or indirect methods (multiple shooting on Hamiltonian flows). There are already very nice tools, in particular for direct solving, in other languages (such as Casadi, GPOPS…) or in Julia ([InfiniteOpt.jl](https://infiniteopt.github.io/InfiniteOpt.jl)…) We t…

---

<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:** [April 7, 2026, 9:36pm UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/6 "2026-04-07T21:36:56Z")

</div>

@baggepinnen exactly 🙂

---

<div class="post-metadata">

**Author:** ![ocots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ocots/32/218820_2.png) [@ocots](https://discourse.julialang.org/u/ocots)\
**Post date:** [April 8, 2026, 8:37am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/7 "2026-04-08T08:37:36Z")

</div>

Thanks @Datseris for the invitation! I’d be happy to give a talk.

Regarding comparisons, we first plan to benchmark the different components (modelers, solvers, AD backends) as well as our own algorithms. We will then compare with existing tools to better understand complementarities and relative strengths. Comparing with ControlSystems.jl is a great idea — any help would be very welcome! 😄

---

<div class="post-metadata">

**Author:** ![ocots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ocots/32/218820_2.png) [@ocots](https://discourse.julialang.org/u/ocots)\
**Post date:** [April 8, 2026, 8:48am UTC](https://discourse.julialang.org/t/ann-optimalcontrol-jl-v2-0-0/136599/8 "2026-04-08T08:48:32Z")

</div>

It looks like you have two accounts (@drandran12 and @oameye). Thanks for the [Minimal action · Tutorials](https://control-toolbox.org/Tutorials.jl/stable/tutorial-mam.html) you wrote — we really appreciate it! We make an effort to acknowledge contributors; you can check this [page](https://control-toolbox.org/contributors/).

I still need to update this tutorial for version 2 of OptimalControl.jl. I expect it to work essentially the same, but I have a few other updates to take care of as well.

If anyone wants to showcase any work with OptimalControl.jl, like this one by @agustinyabo on [gene regulatory dynamics](https://agustinyabo.github.io/PWLdynamics.jl), don’t hesitate! Simply follow this [guide](https://github.com/orgs/control-toolbox/discussions/65) and you will appear in the top menu of [control-toolbox.org](http://control-toolbox.org).
