Skip to content

v0.7.0

Compare
Choose a tag to compare
@ocots ocots released this 20 May 16:48
· 582 commits to main since this release

Big update:

  • More checks for the user when defining an OptimalControlModel with the functional methods. However, need to improve the tests since we want minimal tests. Too defensive for the moment.

  • Remove MakeDescription. The usage now is the following:

function solve(description::Symbol...)
    method = getFullDescription(description, list_of_methods)
    ...
end
  • functions.jl: a Variable argument have been added, see the doc (which may need to be updated). You can always give the complete list of arguments when calling a function, that is you can pass an empty variable even if the problem is not variable dependent. Pass v = Real[] as the empty variable.

  • No more scalar / vectorial usage. Only autonomous / nonautonomous and variable dependent or not.

julia> ocp = Model()
julia> ocp = Model(autonomous=false)
julia> ocp = Model(autonomous=false, variable=true)
  • The fields initial_time and final_time of an OptimalControlModel are always set when the function time! is called. Either it is a Real if the associated time is fixed or an Index if it is free. If tf = Index(2) for instance, it means that tf is the second component of the variable.

  • You can check the dependences or else with:

is_min(ocp)
is_max(ocp)
is_time_independent(ocp)
is_variable_dependent(ocp)
  • Now, use dynamics! to set the dynamics.

  • Box constraints for the variable and others are available now:

julia> (ξl, ξ, ξu), (ηl, η, ηu), (ψl, ψ, ψu), (ϕl, ϕ, ϕu), (θl, θ, θu),
    (ul, uind, uu), (xl, xind, xu), (vl, vind, vu) = nlp_constraints(ocp)
  • You can define you OptimalControlModel in an abstract way, close to Mathematics!
@def o begin
    t  [ 0, 1 ], time
    x  R², state
    u  R, control
    r = x₁
    v = x₂
    w = r + 2v
    r(0) == 0,    (1)
    v(0) == 1,    (♡)
    (t) == [ v(t), w(t)^2 ]
    ( u(t)^2 + x₁(t) )  min
end
  • You can use plot! to plot a second solution over a first one. You can also pass an option to plot the norm of the control. Useful for orbital transfers for instance. The doc is not yet up to date.

  • New print of an ocp showing the abstract form if possible and showing a table summarizing what is set or not.

┌───────┬───────┬─────────┬──────────┬──────────┬───────────┬─────────────┐
│ times │ state │ control │ variable │ dynamics │ objective │ constraints │
├───────┼───────┼─────────┼──────────┼──────────┼───────────┼─────────────┤
│    ✅ │    ✅ │      ❌ │       ✅ │       ✅ │        ❌ │          ✅ │
└───────┴───────┴─────────┴──────────┴──────────┴───────────┴─────────────┘
  • A new interactive ct REPL is introduced to define pleasantly your ocp. For the moment, you need:
using CTBase
CTBase.__init_repl()
>
ct>
  • A new function to copy data from an OptimalControlProblem to an OptimalControlSolution is provided. It is useful to keep track of some data for plots for instance.