oxfordcontrol / SwitchTimeOpt.jl

SwitchTimeOpt.jl - Switching Time Optimization in Julia
Other
15 stars 8 forks source link

Switch to DifferentialEquations.jl #3

Closed ChrisRackauckas closed 7 years ago

ChrisRackauckas commented 7 years ago

ODE.jl is slowly being phased out, so for performance I would suggest switching to DifferentialEquations.jl. DifferentialEquations.jl has a low dependency mode so that way you don't need to depend on everything at once. Instead of ode45(f,u0,tspan;kwargs...), you can simply translate things to sol = solve(ODEProblem(f,u0,tspan),Tsit5();kwargs) and then use the sol type.

Doing it like this, you only need a dependency on using DiffEqBase, OrdinaryDiffEq. DiffEqBase was in ODE.jl anyways, and OrdinaryDiffEq.jl is the new solver you're using. This setup also gives you access to a whole load of other algorithms as well if you wanted the user to pass in the algorithm type. Note that here tspan must be a tuple and the types are respected, so a change to tspan = (0.0,1.0) instead of tspan = [0,1] is required.

If you're interested, I'll setup the PR.

bstellato commented 7 years ago

It definitely sounds like a good idea!

ODE.jl is currently used in the simulation.jl file to simulate the nonlinear dynamics. It should be straightforward to change it to DifferentialEquations.jl