SciML / DifferentialEquations.jl

Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components. Ordinary differential equations (ODEs), stochastic differential equations (SDEs), delay differential equations (DDEs), differential-algebraic equations (DAEs), and more in Julia.
https://docs.sciml.ai/DiffEqDocs/stable/
Other
2.85k stars 226 forks source link

BoundsError: attempt to access 4-element view at index [-1] with VectorContinuousCallback #792

Closed GrantHecht closed 3 years ago

GrantHecht commented 3 years ago

I'm currently running into an issue where I receive the error BoundsError: attempt to access 4-element view(::Vector{Float64}, 1:4) with eltype Float64 at index [-1] when using a VectorContinousCallback.

To produce this error, in short, I have a Particle Swarm Optimization (PSO) algorithm which is setting the initial conditions before numerically integrating with DifferentialEquations.jl and evaluating a cost function. Occasionally, PSO sets the initial conditions just right, such that this error is produced.

I've been able to create a reproducible (relatively) MWE shown below. Note I say relatively because most of the packages used to produce this error (IndirectTrajOpt.jl, IndirectCoStateInit.jl, and Heuristics.jl) are hosted by my github account but are unfortunately not yet available on the Julia General Registry (I am currently working on getting them added to the general registry and will post an update when finished).

using IndirectTrajOpt
using IndirectCoStateInit
using Random
Random.seed!(1)

# Initialize BVP function
ps = initCR3BPIndirectParams("Low Thrust CR3BP")
tspan = (0.0, 8.6404*24*3600/ps.crp.TU)
bvpFunc(y0) = cr3bpOptIntegrate(y0, tspan, ps, copyParams = true, termCallbacks = true)

# Set initial and final conditions 
ics = [-0.0194885115, -0.0160334798, 0.0,
       8.9188819237, -4.081936888, 0.0, 1.0]
fcs = [0.8233851820, 0.0, -0.02225563,
       0.0, 0.134184103, 0.0, 0.0]

# Initialize FFS Initializer 
csInitializer = FSSCoStateInitializer(bvpFunc, ics, fcs; numParticles = 10000);

# Initialize co-states 
initialize!(csInitializer)

I naively expect this issue to be related to the recently fixed floating point error that users were occasionally receiving when solving problems with continuous callbacks (Double callback crossing floating pointer reducer errored. Report this issue.), as I received this error many times in the past while solving nearly the same problem (see my previous, now resolved, issue #724 ) but have only recently started to see this new error.

Here is the full stack trace:

Stacktrace:
  [1] wait
    @ .\task.jl:322 [inlined]
  [2] fetch
    @ .\task.jl:337 [inlined]
  [3] take!(pool::ThreadPools.QueuePool)
    @ ThreadPools C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\qpool.jl:96
  [4] tmap(fn::Heuristics.var"#6#8"{Heuristics.Swarm{Float64}, IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}}, pool::ThreadPools.QueuePool, itr::UnitRange{Int64})
    @ ThreadPools C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\qpool.jl:202
  [5] tforeach
    @ C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\interface.jl:32 [inlined]
  [6] #5
    @ C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\macros.jl:18 [inlined]
  [7] twith
    @ C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\interface.jl:91 [inlined]
  [8] macro expansion
    @ C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\macros.jl:17 [inlined]
  [9] feval!(s::Heuristics.Swarm{Float64}, f::IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}, opts::Heuristics.Options{Float64, Vector{Float64}}; init::Bool)
    @ Heuristics C:\Users\granthec\.julia\packages\Heuristics\poWse\src\PSO\Swarm.jl:61
 [10] feval!
    @ C:\Users\granthec\.julia\packages\Heuristics\poWse\src\PSO\Swarm.jl:59 [inlined]
 [11] iterate!(pso::Heuristics.PSO{Float64, Int64, IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}}, opts::Heuristics.Options{Float64, Vector{Float64}})
    @ Heuristics C:\Users\granthec\.julia\packages\Heuristics\poWse\src\PSO\PSO.jl:160
 [12] _optimize!
    @ C:\Users\granthec\.julia\packages\Heuristics\poWse\src\PSO\PSO.jl:75 [inlined]
 [13] optimize!
    @ C:\Users\granthec\.julia\packages\Heuristics\poWse\src\Optimizers.jl:8 [inlined]
 [14] initialize!(hcsi::FSSCoStateInitializer{Heuristics.PSO{Float64, Int64, IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}}, Heuristics.Options{Float64, Vector{Float64}}})        
    @ IndirectCoStateInit c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\src\HeuristicsCoStateInitializer.jl:5
 [15] top-level scope
    @ c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\scripts\testing.jl:23

    nested task error: BoundsError: attempt to access 4-element view(::Vector{Float64}, 1:4) with eltype Float64 at index [-1]
    Stacktrace:
      [1] throw_boundserror(A::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, I::Tuple{Int64})
        @ Base .\abstractarray.jl:651
      [2] checkbounds
        @ .\abstractarray.jl:616 [inlined]
      [3] getindex
        @ .\subarray.jl:308 [inlined]
      [4] allowed_getindex
        @ C:\Users\granthec\.julia\packages\ArrayInterface\CYf5x\src\ArrayInterface.jl:201 [inlined]
      [5] find_callback_time(integrator::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.Vern9, false, StaticArrays.SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{StaticArrays.SVector{14, Float64}}, SciMLBase.ODESolution{Float64, 2, Vector{StaticArrays.SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, SciMLBase.ODEProblem{StaticArrays.SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Vern9, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{StaticArrays.SVector{14, Float64}}, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, DiffEqBase.CallbackSet{Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Float64, Tuple{}, Tuple{}, Tuple{}}, StaticArrays.SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit}, callback::DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, counter::Int64)
        @ DiffEqBase C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\callbacks.jl:789
      [6] find_first_continuous_callback
        @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\callbacks.jl:466 [inlined]
      [7] handle_callbacks!
        @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:249 [inlined]
      [8] _loopfooter!(integrator::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.Vern9, false, StaticArrays.SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{StaticArrays.SVector{14, Float64}}, SciMLBase.ODESolution{Float64, 2, Vector{StaticArrays.SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, SciMLBase.ODEProblem{StaticArrays.SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Vern9, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, 
Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{StaticArrays.SVector{14, Float64}}, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, DiffEqBase.CallbackSet{Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Float64, Tuple{}, Tuple{}, Tuple{}}, StaticArrays.SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit})
        @ OrdinaryDiffEq C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:204
      [9] loopfooter!
        @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:168 [inlined]
     [10] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.Vern9, false, StaticArrays.SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{StaticArrays.SVector{14, Float64}}, SciMLBase.ODESolution{Float64, 2, Vector{StaticArrays.SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, SciMLBase.ODEProblem{StaticArrays.SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Vern9, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{StaticArrays.SVector{14, Float64}}, Vector{Float64}, Vector{Vector{StaticArrays.SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, DiffEqBase.CallbackSet{Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Float64, Tuple{}, Tuple{}, Tuple{}}, StaticArrays.SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit})
        @ OrdinaryDiffEq C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\solve.jl:479
     [11] #__solve#471
        @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\solve.jl:5 [inlined]
     [12] #solve_call#42
        @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:61 [inlined]
     [13] solve_up(prob::SciMLBase.ODEProblem{StaticArrays.SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, SciMLBase.ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{DiffEqBase.VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::StaticArrays.SVector{14, Float64}, p::IndirectTrajOpt.CR3BPIndirectParams, args::OrdinaryDiffEq.Vern9; kwargs::Base.Iterators.Pairs{Symbol, Real, NTuple{6, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :save_start, :initialize_save, :maxiters), Tuple{Float64, Float64, Bool, Bool, Bool, Float64}}})
        @ DiffEqBase C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:87
     [14] #solve#43
        @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:73 [inlined]
     [15] cr3bpOptIntegrate(y0::StaticArrays.SVector{14, Float64}, tspan::Tuple{Float64, Float64}, ps::IndirectTrajOpt.CR3BPIndirectParams; copyParams::Bool, termCallbacks::Bool, inPlace::Bool)
        @ IndirectTrajOpt C:\Users\granthec\.julia\dev\IndirectTrajOpt.jl\src\CR3BP\cr3bpOptIntegrate.jl:10
     [16] bvpFunc(y0::StaticArrays.SVector{14, Float64})
        @ Main c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\scripts\testing.jl:11
     [17] cfFSSWSS(x::Vector{Float64}, bvpFunc::typeof(bvpFunc), ICS::Vector{Float64}, FCS::Vector{Float64})
        @ IndirectCoStateInit c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\src\FSSCoStateInitializer.jl:57
     [18] cf
        @ c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\src\FSSCoStateInitializer.jl:33 [inlined]
     [19] macro expansion
        @ C:\Users\granthec\.julia\packages\Heuristics\poWse\src\PSO\Swarm.jl:62 [inlined]
     [20] (::Heuristics.var"#6#8"{Heuristics.Swarm{Float64}, IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}})(i::Int64)
        @ Heuristics C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\macros.jl:20
     [21] #62
        @ C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\qpool.jl:195 [inlined]
     [22] (::ThreadPools.var"#58#59"{ThreadPools.var"#62#64"{Heuristics.var"#6#8"{Heuristics.Swarm{Float64}, IndirectCoStateInit.var"#cf#2"{typeof(bvpFunc), Vector{Float64}, Vector{Float64}}}}, Tuple{Int64, Int64}})()
        @ ThreadPools C:\Users\granthec\.julia\packages\ThreadPools\ROFEh\src\qpool.jl:86
in expression starting at c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\scripts\testing.jl:23
ChrisRackauckas commented 3 years ago
[ Info: Precompiling IndirectTrajOpt [99e47ffd-a99c-4d17-8b51-d4481b168213]
[ Info: Precompiling IndirectCoStateInit [21a510a3-10c0-42ba-9160-0f1f186b68a8]
WARNING: both IndirectCoStateInit and OrdinaryDiffEq export "initialize!"; uses of it in module Main must be qualified
Time Elapsed: 0.000000 sec, Iteration Number: 0, Function Evaluations: 10000
Stall Iterations: 0, Global Best: 1.300342e+02

Time Elapsed: 37.024000 sec, Iteration Number: 1, Function Evaluations: 
20000
Stall Iterations: 0, Global Best: 1.300342e+02

Time Elapsed: 59.268000 sec, Iteration Number: 2, Function Evaluations: 
30000
Stall Iterations: 1, Global Best: 1.300342e+02

Time Elapsed: 81.534000 sec, Iteration Number: 3, Function Evaluations: 
40000
Stall Iterations: 0, Global Best: 1.290039e+02

Time Elapsed: 104.061000 sec, Iteration Number: 4, Function Evaluations: 50000
Stall Iterations: 1, Global Best: 1.290039e+02

Time Elapsed: 126.737000 sec, Iteration Number: 5, Function Evaluations: 60000
Stall Iterations: 2, Global Best: 1.290039e+02

Time Elapsed: 158.570000 sec, Iteration Number: 6, Function Evaluations: 70000
Stall Iterations: 0, Global Best: 1.282855e+02

Time Elapsed: 199.710000 sec, Iteration Number: 7, Function Evaluations: 80000
Stall Iterations: 0, Global Best: 1.258484e+02

Time Elapsed: 229.285000 sec, Iteration Number: 8, Function Evaluations: 90000
Stall Iterations: 1, Global Best: 1.258484e+02

Time Elapsed: 256.472000 sec, Iteration Number: 9, Function Evaluations: 100000
Stall Iterations: 2, Global Best: 1.258484e+02

Time Elapsed: 293.694000 sec, Iteration Number: 10, Function Evaluations: 110000
Stall Iterations: 3, Global Best: 1.258484e+02

Time Elapsed: 333.829000 sec, Iteration Number: 11, Function Evaluations: 120000
Stall Iterations: 4, Global Best: 1.258484e+02

Time Elapsed: 372.434000 sec, Iteration Number: 12, Function Evaluations: 130000
Stall Iterations: 5, Global Best: 1.258484e+02

Time Elapsed: 411.689000 sec, Iteration Number: 13, Function Evaluations: 140000
Stall Iterations: 6, Global Best: 1.258484e+02

Time Elapsed: 451.849000 sec, Iteration Number: 14, Function Evaluations: 150000
Stall Iterations: 0, Global Best: 1.192627e+02

Time Elapsed: 486.747000 sec, Iteration Number: 15, Function Evaluations: 160000
Stall Iterations: 1, Global Best: 1.192627e+02

Time Elapsed: 528.777000 sec, Iteration Number: 16, Function Evaluations: 170000
Stall Iterations: 0, Global Best: 4.877351e+01

Time Elapsed: 575.738000 sec, Iteration Number: 17, Function Evaluations: 180000
Stall Iterations: 0, Global Best: 3.388988e+01

Time Elapsed: 617.366000 sec, Iteration Number: 18, Function Evaluations: 190000
Stall Iterations: 0, Global Best: 1.979387e+01

Time Elapsed: 656.731000 sec, Iteration Number: 19, Function Evaluations: 200000
Stall Iterations: 0, Global Best: 1.478827e+01

Time Elapsed: 699.928000 sec, Iteration Number: 20, Function Evaluations: 210000
Stall Iterations: 1, Global Best: 1.478827e+01

Time Elapsed: 739.750000 sec, Iteration Number: 21, Function Evaluations: 220000
Stall Iterations: 2, Global Best: 1.478827e+01

Time Elapsed: 780.543000 sec, Iteration Number: 22, Function Evaluations: 230000
Stall Iterations: 0, Global Best: 1.323883e+01

Time Elapsed: 827.471000 sec, Iteration Number: 23, Function Evaluations: 240000
Stall Iterations: 0, Global Best: 1.050705e+01

Time Elapsed: 890.682000 sec, Iteration Number: 24, Function Evaluations: 250000
Stall Iterations: 0, Global Best: 1.043661e+01

Time Elapsed: 930.517000 sec, Iteration Number: 25, Function Evaluations: 260000
Stall Iterations: 1, Global Best: 1.043661e+01

Time Elapsed: 975.539000 sec, Iteration Number: 26, Function Evaluations: 270000
Stall Iterations: 0, Global Best: 9.866150e+00

Time Elapsed: 1017.736000 sec, Iteration Number: 27, Function Evaluations: 280000
Stall Iterations: 0, Global Best: 7.168585e+00

Time Elapsed: 1062.255000 sec, Iteration Number: 28, Function Evaluations: 290000
Stall Iterations: 0, Global Best: 6.818373e+00

Time Elapsed: 1109.468000 sec, Iteration Number: 29, Function Evaluations: 300000
Stall Iterations: 0, Global Best: 6.414688e+00

Time Elapsed: 1156.538000 sec, Iteration Number: 30, Function Evaluations: 310000
Stall Iterations: 0, Global Best: 4.232060e+00

Time Elapsed: 1202.601000 sec, Iteration Number: 31, Function Evaluations: 320000
Stall Iterations: 1, Global Best: 4.232060e+00

Time Elapsed: 1247.333000 sec, Iteration Number: 32, Function Evaluations: 330000
Stall Iterations: 2, Global Best: 4.232060e+00

Time Elapsed: 1288.600000 sec, Iteration Number: 33, Function Evaluations: 340000
Stall Iterations: 3, Global Best: 4.232060e+00

Time Elapsed: 1333.244000 sec, Iteration Number: 34, Function Evaluations: 350000
Stall Iterations: 4, Global Best: 4.232060e+00

Time Elapsed: 1388.078000 sec, Iteration Number: 35, Function Evaluations: 360000
Stall Iterations: 5, Global Best: 4.232060e+00

Time Elapsed: 1440.587000 sec, Iteration Number: 36, Function Evaluations: 370000
Stall Iterations: 6, Global Best: 4.232060e+00

Time Elapsed: 1491.804000 sec, Iteration Number: 37, Function Evaluations: 380000
Stall Iterations: 7, Global Best: 4.232060e+00

Time Elapsed: 1534.678000 sec, Iteration Number: 38, Function Evaluations: 390000
Stall Iterations: 8, Global Best: 4.232060e+00

Time Elapsed: 1578.553000 sec, Iteration Number: 39, Function Evaluations: 400000
Stall Iterations: 0, Global Best: 3.860718e+00

Time Elapsed: 1621.747000 sec, Iteration Number: 40, Function Evaluations: 410000
Stall Iterations: 1, Global Best: 3.860718e+00

Time Elapsed: 1670.821000 sec, Iteration Number: 41, Function Evaluations: 420000
Stall Iterations: 2, Global Best: 3.860718e+00

Time Elapsed: 1720.931000 sec, Iteration Number: 42, Function Evaluations: 430000
Stall Iterations: 0, Global Best: 3.747401e+00

Time Elapsed: 1766.213000 sec, Iteration Number: 43, Function Evaluations: 440000
Stall Iterations: 1, Global Best: 3.747401e+00

Time Elapsed: 1811.173000 sec, Iteration Number: 44, Function Evaluations: 450000
Stall Iterations: 2, Global Best: 3.747401e+00

f(x) = 3.747401e+00
   x = [ -1.279976e+01  ]
       [ 1.567457e+01   ]
       [ 3.549525e+01   ]
       [ 6.435602e-03   ]
       [ 5.878555e-02   ]
       [ 3.761669e-03   ]
       [ 1.719935e+00   ]
Iters: 44
Time:  1.811183e+03
Maximum time reached.

Seems like it's a stochastic global optimization? Can you make the MWE run the inner function at precisely the parameters which fail?

GrantHecht commented 3 years ago

Yep. I was hoping setting the rng seed alone would reproduce the error but it won’t occur until around the 80th optimization iteration.

I’ll put together another MWE by early next week which runs just the inner function.

GrantHecht commented 3 years ago

Here is a simpler MWE to produce the same error. Note that IndirectTrajOpt.jl is now the only required dependency not available in the Julia General Registry.

using IndirectTrajOpt
using DifferentialEquations
using StaticArrays
using LinearAlgebra

# Initialize parameters and time span
ps = initCR3BPIndirectParams("Low Thrust CR3BP")
tspan = (0.0, 8.6404*24*3600/ps.crp.TU)

# Error producing initial conditions
y0 =   @SVector [-0.0194885115,
                 -0.0160334798,
                 0.0,
                 8.9188819237,
                 -4.081936888,
                 0.0,
                 1.0,
                 -18.20557373360214,
                 -16.683730836929307,
                 40.0,
                 0.04174822756326783,
                 -0.005163201648349852,
                 -0.03929039276763477,
                 0.12683528760241147]

# Set thrust type
cSc = ps.sp.isp*9.81*ps.crp.TU / (ps.crp.LU*1000.0)
λv = norm(view(y0, 11:13))
S = IndirectTrajOpt.computeS(y0, λv, cSc)
if S > ps.ϵ; ps.utype = 0 
elseif S < -ps.ϵ; ps.utype = 2
else; ps.utype = 1; end

cb = VectorContinuousCallback(
            IndirectTrajOpt.cr3bpEomsCondition,
            IndirectTrajOpt.cr3bpEomsAffect!,
            IndirectTrajOpt.cr3bpEomsAffect!, 4;
            idxs = nothing,
            rootfind = true,
            interp_points = 10,
            abstol = 1e-14,
            reltol = 0.0,
            save_positions = (true, true))
ff = ODEFunction{false}(IndirectTrajOpt.cr3bpEomIndirect)
prob = ODEProblem(ff, y0, tspan, ps; callback=cb)

solve(prob, Vern9(),reltol=1e-14,abstol=1e-14)

Stacktrace:

ERROR: LoadError: BoundsError: attempt to access 4-element view(::Vector{Float64}, 1:4) with eltype Float64 at index [-1]
Stacktrace:
  [1] throw_boundserror(A::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, I::Tuple{Int64})        
    @ Base .\abstractarray.jl:651
  [2] checkbounds
    @ .\abstractarray.jl:616 [inlined]
  [3] getindex
    @ .\subarray.jl:308 [inlined]
  [4] allowed_getindex
    @ C:\Users\granthec\.julia\packages\ArrayInterface\CYf5x\src\ArrayInterface.jl:201 [inlined]
  [5] find_callback_time(integrator::OrdinaryDiffEq.ODEIntegrator{Vern9, false, SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{SVector{14, Float64}}, ODESolution{Float64, 2, Vector{SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, ODEProblem{SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, Vern9, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{SVector{14, Float64}}, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit}, callback::VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, counter::Int64)
    @ DiffEqBase C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\callbacks.jl:789
  [6] find_first_continuous_callback
    @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\callbacks.jl:466 [inlined]
  [7] handle_callbacks!
    @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:249 [inlined]
  [8] _loopfooter!(integrator::OrdinaryDiffEq.ODEIntegrator{Vern9, false, SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{SVector{14, Float64}}, ODESolution{Float64, 2, Vector{SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, ODEProblem{SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, Vern9, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{SVector{14, Float64}}, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:204
  [9] loopfooter!
    @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\integrators\integrator_utils.jl:168 [inlined]
 [10] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{Vern9, false, SVector{14, Float64}, Nothing, Float64, IndirectTrajOpt.CR3BPIndirectParams, Float64, Float64, Float64, Float64, Vector{SVector{14, Float64}}, ODESolution{Float64, 2, Vector{SVector{14, Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, ODEProblem{SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, Vern9, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{SVector{14, Float64}}, Vector{Float64}, Vector{Vector{SVector{14, Float64}}}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Vern9ConstantCache{OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, SVector{14, Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\solve.jl:479
 [11] #__solve#471
    @ C:\Users\granthec\.julia\packages\OrdinaryDiffEq\ajk4M\src\solve.jl:5 [inlined]
 [12] #solve_call#42
    @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:61 [inlined]
 [13] solve_up(prob::ODEProblem{SVector{14, Float64}, Tuple{Float64, Float64}, false, IndirectTrajOpt.CR3BPIndirectParams, ODEFunction{false, typeof(IndirectTrajOpt.cr3bpEomIndirect), UniformScaling{Bool}, Nothing, 
Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Symbol, VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{VectorContinuousCallback{typeof(IndirectTrajOpt.cr3bpEomsCondition), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(IndirectTrajOpt.cr3bpEomsAffect!), typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Float64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::SVector{14, Float64}, p::IndirectTrajOpt.CR3BPIndirectParams, args::Vern9; kwargs::Base.Iterators.Pairs{Symbol, Float64, Tuple{Symbol, Symbol}, NamedTuple{(:reltol, :abstol), Tuple{Float64, Float64}}})
    @ DiffEqBase C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:87
 [14] #solve#43
    @ C:\Users\granthec\.julia\packages\DiffEqBase\WKucm\src\solve.jl:73 [inlined]
 [15] top-level scope
    @ c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\scripts\SimpleErrorProducer.jl:46
in expression starting at c:\Users\granthec\.julia\dev\IndirectCoStateInit.jl\scripts\SimpleErrorProducer.jl:46