It is a pleasure to announce the new release of OptimalControl.jl (v1.1). Intended to solve optimal control problems on ODEs, the package features:
Give it a try, and if ever the syntax below does not look familiar enough
β¦
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 for you!
We welcome contributions and will be glad to get in touch at JuliaCon local in Paris next week 
15 Likes
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.
4 Likes
Or perhaps @ocp, as the OCP is fairly common short for optimal control problem.
3 Likes
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
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.)
@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.