Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running Code in documentation #286

Closed
MaAl13 opened this issue Jun 13, 2022 · 9 comments · Fixed by SciML/SciMLSensitivity.jl#619
Closed

Error when running Code in documentation #286

MaAl13 opened this issue Jun 13, 2022 · 9 comments · Fixed by SciML/SciMLSensitivity.jl#619

Comments

@MaAl13
Copy link

MaAl13 commented Jun 13, 2022

Hello, i am trying to run the example in https://sensitivity.sciml.ai/dev/ode_fitting/optimization_ode/, the code is the following:

using DifferentialEquations, Optimization, OptimizationPolyalgorithms, OptimizationOptimJL, Plots

function lotka_volterra!(du, u, p, t)
  x, y = u
  α, β, δ, γ = p
  du[1] = dx = α*x - β*x*y
  du[2] = dy = -δ*y + γ*x*y
end

## Initial condition
u0 = [1.0, 1.0]

## Simulation interval and intermediary points
tspan = (0.0, 10.0)
tsteps = 0.0:0.1:10.0

# LV equation parameter. p = [α, β, δ, γ]
p = [1.5, 1.0, 3.0, 1.0]

# Setup the ODE problem, then solve
prob = ODEProblem(lotka_volterra!, u0, tspan, p)
sol = solve(prob, Tsit5())

# Plot the solution
using Plots
plot(sol)
savefig("LV_ode.png")

function loss(p)
  sol = solve(prob, Tsit5(), p=p, saveat = tsteps)
  loss = sum(abs2, sol.-1)
  return loss, sol
end

callback = function (p, l, pred)
  display(l)
  plt = plot(pred, ylim = (0, 6))
  display(plt)
  ## Tell Optimization.solve to not halt the optimization. If return true, then
  ## optimization stops.
  return false
end

adtype = Optimization.AutoZygote()
optf = Optimization.OptimizationFunction((x,p)->loss(x), adtype)
optprob = Optimization.OptimizationProblem(optf, p)

result_ode = Optimization.solve(optprob, PolyOpt(),
                                    cb = callback,
                                    maxiters = 100)
## result_ode = Optimization.solve(optprob, ADAM(0.1), cb = callback)

This produces the error:

ERROR: LoadError: UndefVarError: AutoZygote not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:35
[2] top-level scope
@ ~/Documents/julia_GPU_solver/Optimization_Test.jl:44
in expression starting at /Users/malmansto/Documents/julia_GPU_solver/Optimization_Test.jl:44

Changing AutoZygoye() to AutoForwardDiff() results in

ERROR: LoadError: MethodError: no method matching Optim.Options(; extended_trace=true, cb=var"#1#2"(), callback=OptimizationOptimJL.var"#_cb#11"{OptimizationOptimJL.var"#10#18", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}(OptimizationOptimJL.var"#10#18"(), BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}(LineSearches.InitialStatic{Float64}
alpha: Float64 1.0
scaled: Bool false
, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}
delta: Float64 0.1
sigma: Float64 0.9
alphamax: Float64 Inf
rho: Float64 5.0
epsilon: Float64 1.0e-6
gamma: Float64 0.66
linesearchmax: Int64 50
psi3: Float64 0.1
display: Int64 0
mayterminate: Base.RefValue{Bool}
, nothing, 0.01, Flat()), Base.Iterators.Cycle{Tuple{Optimization.NullData}}((Optimization.NullData(),)), Core.Box(#undef), Core.Box(Optimization.NullData()), Core.Box(2)), iterations=100)
Closest candidates are:
Optim.Options(; x_tol, f_tol, g_tol, x_abstol, x_reltol, f_abstol, f_reltol, g_abstol, g_reltol, outer_x_tol, outer_f_tol, outer_g_tol, outer_x_abstol, outer_x_reltol, outer_f_abstol, outer_f_reltol, outer_g_abstol, outer_g_reltol, f_calls_limit, g_calls_limit, h_calls_limit, allow_f_increases, allow_outer_f_increases, successive_f_tol, iterations, outer_iterations, store_trace, trace_simplex, show_trace, extended_trace, show_every, callback, time_limit) at ~/.julia/packages/Optim/6Lpjy/src/types.jl:73 got unsupported keyword argument "cb"
Optim.Options(::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::TCallback, ::Float64) where {T, TCallback} at ~/.julia/packages/Optim/6Lpjy/src/types.jl:44 got unsupported keyword arguments "extended_trace", "cb", "callback", "iterations"
Stacktrace:
[1] kwerr(kw::NamedTuple{(:extended_trace, :cb, :callback, :iterations), Tuple{Bool, var"#1#2", OptimizationOptimJL.var"#_cb#11"{OptimizationOptimJL.var"#10#18", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}, Int64}}, args::Type)
@ Base ./error.jl:163
[2] __map_optimizer_args(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}; callback::Function, maxiters::Int64, maxtime::Nothing, abstol::Nothing, reltol::Nothing, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:37
[3] ___solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; callback::Function, maxiters::Int64, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:140
[4] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:maxiters, :cb), Tuple{Int64, var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:56
[5] solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:maxiters, :cb), Tuple{Int64, var"#1#2"}}})
@ SciMLBase ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56
[6] __solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Int64, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/5gDHf/src/OptimizationPolyalgorithms.jl:29
[7] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[8] top-level scope
@ ~/Documents/julia_GPU_solver/Optimization_Test.jl:48
in expression starting at /Users/malmansto/Documents/julia_GPU_solver/Optimization_Test.jl:48

@ChrisRackauckas
Copy link
Member

Missing a using Zygote. Should be fixed by SciML/SciMLSensitivity.jl#619, and I'm actively working to ensure doctests make this kind of issue not pop up again.

@MaAl13
Copy link
Author

MaAl13 commented Jun 13, 2022

Thanks for the fast response!
I added Zygote and DiffEqSensitivity, however, the error now changed to:

ERROR: LoadError: MethodError: no method matching Optim.Options(; extended_trace=true, cb=var"#1#2"(), callback=OptimizationOptimJL.var"#_cb#11"{OptimizationOptimJL.var"#10#18", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}(OptimizationOptimJL.var"#10#18"(), BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}(LineSearches.InitialStatic{Float64}
alpha: Float64 1.0
scaled: Bool false
, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}
delta: Float64 0.1
sigma: Float64 0.9
alphamax: Float64 Inf
rho: Float64 5.0
epsilon: Float64 1.0e-6
gamma: Float64 0.66
linesearchmax: Int64 50
psi3: Float64 0.1
display: Int64 0
mayterminate: Base.RefValue{Bool}
, nothing, 0.01, Flat()), Base.Iterators.Cycle{Tuple{Optimization.NullData}}((Optimization.NullData(),)), Core.Box(#undef), Core.Box(Optimization.NullData()), Core.Box(2)), iterations=100)
Closest candidates are:
Optim.Options(; x_tol, f_tol, g_tol, x_abstol, x_reltol, f_abstol, f_reltol, g_abstol, g_reltol, outer_x_tol, outer_f_tol, outer_g_tol, outer_x_abstol, outer_x_reltol, outer_f_abstol, outer_f_reltol, outer_g_abstol, outer_g_reltol, f_calls_limit, g_calls_limit, h_calls_limit, allow_f_increases, allow_outer_f_increases, successive_f_tol, iterations, outer_iterations, store_trace, trace_simplex, show_trace, extended_trace, show_every, callback, time_limit) at ~/.julia/packages/Optim/6Lpjy/src/types.jl:73 got unsupported keyword argument "cb"
Optim.Options(::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::TCallback, ::Float64) where {T, TCallback} at ~/.julia/packages/Optim/6Lpjy/src/types.jl:44 got unsupported keyword arguments "extended_trace", "cb", "callback", "iterations"
Stacktrace:
[1] kwerr(kw::NamedTuple{(:extended_trace, :cb, :callback, :iterations), Tuple{Bool, var"#1#2", OptimizationOptimJL.var"#_cb#11"{OptimizationOptimJL.var"#10#18", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}, Int64}}, args::Type)
@ Base ./error.jl:163
[2] __map_optimizer_args(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}; callback::Function, maxiters::Int64, maxtime::Nothing, abstol::Nothing, reltol::Nothing, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:37
[3] ___solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; callback::Function, maxiters::Int64, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:140
[4] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:maxiters, :cb), Tuple{Int64, var"#1#2"}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:56
[5] solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:maxiters, :cb), Tuple{Int64, var"#1#2"}}})
@ SciMLBase ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56
[6] __solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#3#4", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Int64, kwargs::Base.Pairs{Symbol, var"#1#2", Tuple{Symbol}, NamedTuple{(:cb,), Tuple{var"#1#2"}}})
@ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/5gDHf/src/OptimizationPolyalgorithms.jl:29
[7] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[8] top-level scope
@ ~/Documents/julia_GPU_solver/Optimization_Test.jl:49
in expression starting at /Users/malmansto/Documents/julia_GPU_solver/Optimization_Test.jl:49

@FabiJa
Copy link

FabiJa commented Jun 13, 2022

I have the same problem.

@ChrisRackauckas
Copy link
Member

Sorry about that. I needed to enable strict mode so it would properly throw errors when it's out of date. I have a PR open to do this which should be merged later today: SciML/SciMLSensitivity.jl#622

@ChrisRackauckas
Copy link
Member

Let me know if there's anything else. Should be all good now.

@MaAl13
Copy link
Author

MaAl13 commented Jun 26, 2022

Hi, i tried to run the Optimizer now for the Yeast Glysolisis model. Without the PositiveDomain callback i run into a domain error. With the PositiveDomain callback i get the following error for the jvp. Can you tell me how to fix this?

using DifferentialEquations, Optimization, OptimizationPolyalgorithms, OptimizationOptimJL,
      DiffEqSensitivity, Zygote, Plots
using Distributions
using DiffEqCallbacks

u0 = [0.501, 1.955, 0.198, 0.148, 0.161, 0.161, 0.064]
parameters_real = [2.5, 100.0, 6.0, 16.0, 100.0, 1.28, 12.0, 1.8, 13.0, 4.0, 0.52, 0.1, 1.0, 4.0]

function Glycolisis_Yeast(du,u,p,t)
    du[1] = p[1] - p[2] * u[1] * u[6] / (1 + (u[6] / p[11])^p[10])
    du[2] = 2 * p[2] * u[1] * u[6] / (1 + (u[6] / p[11])^p[10]) - p[3]*u[2]*(p[13]-u[5]) - p[7]*u[2]*u[5]
    du[3] = p[3]*u[2]*(p[13]-u[5]) - p[4]*u[3]*(p[14] - u[6])
    du[4] = p[4]*u[3]*(p[14] - u[6]) - p[5]*u[4]*u[5] - p[9]*(u[4]-u[7])
    du[5] = p[3]*u[2]*(p[13]-u[5]) - p[5]*u[4]*u[5] - p[7] * u[2] * u[5]
    du[6] = -2 * p[2] * u[1] * u[6] / (1 + (u[6] / p[11])^p[10]) + 2 * p[4]*u[3]*(p[14] - u[6]) - p[6] * u[6]
    du[7] = p[12]*p[9] * (u[4] - u[7]) - p[9] * u[7]

  #This is recommended when using PositiveDomain()
  for i=1:7
     if u[i]<0.0 && du[i]<0.0
       du[i]=0.0
     end
  end
  return nothing
end

time_points = [[0.25, 0.75, 1.15, 1.5, 1.75, 2.5, 3.25, 3.75, 4.95, 6.0, 7.0, 7.5, 8.5, 8.75, 9.9, 10.0],
[0.25, 0.75, 1.15, 1.5, 1.75, 2.5, 3.25, 3.75, 4.95, 6.0, 7.2, 7.5, 8.5, 8.75, 9.9],
[0.25, 0.75, 1.15, 1.5, 1.75, 2.5, 3.25, 3.75, 4.95, 6.0, 7.0, 7.5, 8.5, 8.75, 9.9, 10.0],
[0.25, 0.75, 1.15, 1.5, 1.75, 2.5, 3.25, 3.75, 4.95, 6.0, 7.0, 7.5, 8.5, 8.75, 9.9, 10.0],
[0.25, 0.75, 1.15, 1.65, 1.75, 2.5, 3.25, 3.75, 4.95, 6.0, 7.25, 7.55, 7.75, 7.9, 8.5, 8.75, 9.9, 10.0],
[0.25, 0.75, 1.15, 0.75, 1.75, 2.5, 3.25, 3.75, 5.0, 6.0, 7.0, 7.5, 8.6, 8.85, 9.9, 10.0],
[0.25, 0.75, 1.15, 1.45, 1.75, 2.5, 3.25, 3.5, 5.1, 6.0, 7.0, 7.5, 8.5, 8.75, 9.75, 10.0]]

tstart = 0
tend = 10


function t_points_creator(time_points)
    no_of_measurements = length(time_points)#length(string_measurements)
    union_dataset_t = []
    dataset_t_indices = []
    total_no_measurements = 0
    indices_in_stacked_form = []

    for i in 1:no_of_measurements
        tmp =  [total_no_measurements+1]
        total_no_measurements += length(time_points[i])
        tmp = push!(tmp, total_no_measurements)
        indices_in_stacked_form = push!(indices_in_stacked_form, tmp)
        union_dataset_t = union(union_dataset_t, time_points[i])
    end


    union_dataset_t = sort!(union_dataset_t)


    for i in 1:no_of_measurements
        tmp = []
        for j in 1:length(time_points[i])
            push!(tmp, findall(x->x==time_points[i][j], union_dataset_t)[1])
        end
        push!(dataset_t_indices, tmp)
    end
    return union_dataset_t, dataset_t_indices, total_no_measurements, indices_in_stacked_form
end

function sol_ODE(model, u0, tspan, model_params, saves_t)
  prob=ODEProblem(model,u0,tspan, model_params)
  return Array(solve(prob,Tsit5(),
              saveat=saves_t,abstol=1e-8,reltol=1e-6))
end





function data_creator(solution, noise_data, time_indices)
  solution_combined = [solution[1,:], solution[2,:], solution[3,:], solution[4,:], solution[5,:], solution[6,:], solution[7,:]]

  sol_noise = zeros((length(solution_combined), length(solution_combined[1])))
  for i in 1:length(solution_combined)
        tmp_sol = solution_combined[i][time_indices[i]]
        dim = length(tmp_sol)
        noise = zeros(dim)
        for j in 1:dim
            d = Normal(tmp_sol[j], maximum([noise_data*tmp_sol[j],1e-8]))
            
            # Lower limit must be >0 in order that the neuron still size_filters
            # and that they can be distinguished by  0 values, which come from padding or missing values
            # THIS MEANS THAT IF THE REAL DATA HAS 0 VALUES THEY MUST BE SHIFTED UPWARDS BY 1E-8
            td = truncated(d, 1e-8, Inf)
            noise[j] = rand(td, 1)[1]
        end
        sol_noise[i, time_indices[i]] = noise
  end
  return sol_noise
end

function loss(model, p, u0, tspan, saves)
  
  sol = solve(ODEProblem(model, u0, tspan, p), Tsit5(), p=p, saveat = saves)
  loss_Model = sum(abs2, sol.-1)
  
  return loss_Model, sol
end

function loss_ODE(model, u0, tspan, model_params::Vector, indices_components, saves_t, data)

    # Using PositiveDomain callback in DiffEqCallbacks.jl, which is inspired by Shampine's et al. paper
    # about non-negative ODE solutions. 
    prediction_raw = solve(ODEProblem(model,u0,tspan,model_params), Tsit5(), saveat=saves_t,
    		   callback=PositiveDomain(ones(7)),verbose=false) 
    prediction = Array(prediction_raw)
    prediction_components = [prediction[1,:],prediction[2,:], prediction[3,:], 
    prediction[4,:], prediction[5,:], prediction[6,:], prediction[7,:]]
    loss = 0.0
    for i in 1:length(indices_components)
        prediction_component=prediction_components[i][indices_components[i]]
        data_component = data[i,:][indices_components[i]]
        if all(>=(0), prediction_component)
            loss += sum(abs2,log.(prediction_component.+1e-8) .- log.(data_component.+1e-8))
        else
            loss = Inf
        end
    end
    return loss, prediction
end

callback = function (p, l, pred)
  println(p)
  #plt = plot(pred, ylim = (0, 6))
  #display(plt)
  # Tell Optimization.solve to not halt the optimization. If return true, then
  # optimization stops.
  return false
end


function train(model, u0, tspan, indices_components, saves_t, data, p_guess)
  #tmp_func = (x) ->loss(x, u0, tspan)
  dummy = zeros(20)
  adtype = Optimization.AutoZygote()
  optf = Optimization.OptimizationFunction((x,dummy)->loss_ODE(model, u0, tspan, x, indices_components, saves_t, data), adtype)
  #optf = Optimization.OptimizationFunction((x,dummy)->loss(model, x, u0, tspan, saves), adtype)
  optprob = Optimization.OptimizationProblem(optf, p_guess)

  result_ode = Optimization.solve(optprob, PolyOpt(),
                                  callback = callback,
                                  maxiters = 100)
end

saves_t, time_indices, total_no_measurements, indices_components = t_points_creator(time_points)
tspan = (tstart, tend)

#println(saves_t)
#println(time_indices)
#println(total_no_measurements)
#println(indices_components)



data = sol_ODE(Glucose_Yeast2, u0, tspan, parameters_real, saves_t)
data_noise = data_creator(data, 0.1, time_indices)
# Simulation interval and intermediary points

#println(data_noise)




p_guess = ones(14)
println(loss_ODE(Glycolisis_Yeast, u0, tspan, p_guess, time_indices, saves_t, data_noise))

train(Glycolisis_Yeast, u0, tspan, time_indices, saves_t, data_noise, p_guess)

ERROR: LoadError: TypeError: in typeassert, expected Float64, got a value of type ForwardDiff.Dual{Nothing, Float64, 7}
Stacktrace:
[1] setindex!(A::Vector{Float64}, x::ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, i1::Int64)
@ Base ./array.jl:903
[2] macro expansion
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/dense/interpolants.jl:298 [inlined]
[3] macro expansion
@ ./simdloop.jl:77 [inlined]
[4] ode_interpolant!(out::Vector{Float64}, Θ::Float64, dt::Float64, y₀::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, y₁::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, k::Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, cache::OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, idxs::Nothing, T::Type{Val{0}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/dense/interpolants.jl:297
[5] ode_interpolant!
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/dense/generic_dense.jl:459 [inlined]
[6] ode_interpolant!
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/dense/generic_dense.jl:93 [inlined]
[7] current_interpolant!
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/dense/generic_dense.jl:126 [inlined]
[8] #
#351
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/integrators/integrator_utils.jl:414 [inlined]
[9] ODEIntegrator (repeats 2 times)
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/integrators/integrator_utils.jl:414 [inlined]
[10] affect!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Nothing, Float64, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Float64, Float64, Float64, Float64, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, ODESolution{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, 2, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, 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{}, Vector{Float64}, Tuple{}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Nothing, OrdinaryDiffEq.DefaultInit}, f::DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}})
@ DiffEqCallbacks ~/.julia/packages/DiffEqCallbacks/ci89q/src/domain.jl:78
[11] PositiveDomainAffect
@ ~/.julia/packages/DiffEqCallbacks/ci89q/src/domain.jl:28 [inlined]
[12] apply_discrete_callback!
@ ~/.julia/packages/DiffEqBase/hZncn/src/callbacks.jl:546 [inlined]
[13] handle_callbacks!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Nothing, Float64, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Float64, Float64, Float64, Float64, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, ODESolution{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, 2, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, 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{}, Vector{Float64}, Tuple{}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Nothing, OrdinaryDiffEq.DefaultInit})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/integrators/integrator_utils.jl:268
[14] _loopfooter!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Nothing, Float64, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Float64, Float64, Float64, Float64, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, ODESolution{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, 2, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, 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{}, Vector{Float64}, Tuple{}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Nothing, OrdinaryDiffEq.DefaultInit})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/integrators/integrator_utils.jl:208
[15] loopfooter!
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/integrators/integrator_utils.jl:170 [inlined]
[16] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Nothing, Float64, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Float64, Float64, Float64, Float64, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, ODESolution{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, 2, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}, Vector{Float64}, Vector{Vector{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}}}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, 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{}, Vector{Float64}, Tuple{}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}, Nothing, OrdinaryDiffEq.DefaultInit})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/solve.jl:478
[17] __solve(::ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:saveat, :callback, :verbose), Tuple{Vector{Float64}, DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}, Bool}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/solve.jl:5
[18] #solve_call#28
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:428 [inlined]
[19] solve_up(prob::ODEProblem{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, Tuple{Float64, Float64}, true, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, p::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64}, Float64, 7}}, args::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:saveat, :callback, :verbose), Tuple{Vector{Float64}, DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}, Bool}}})
@ DiffEqBase ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:726
[20] #solve#29
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:710 [inlined]
[21] (::DiffEqSensitivity.var"#255#261"{0, Matrix{Float64}, Vector{Any}, Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:callback, :verbose), Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}, Bool}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ForwardDiffSensitivity{0, nothing}, Vector{Float64}, Vector{Float64}, Tuple{}})()
@ DiffEqSensitivity ~/.julia/packages/DiffEqSensitivity/60SaR/src/concrete_solve.jl:539
[22] unthunk
@ ~/.julia/packages/ChainRulesCore/GUvJT/src/tangent_types/thunks.jl:195 [inlined]
[23] wrap_chainrules_output
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:104 [inlined]
[24] map
@ ./tuple.jl:223 [inlined]
[25] map (repeats 3 times)
@ ./tuple.jl:224 [inlined]
[26] wrap_chainrules_output
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:105 [inlined]
[27] ZBack
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:205 [inlined]
[28] kw_zpullback
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:231 [inlined]
[29] #208
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined]
[30] (::Zygote.var"#1750#back#210"{Zygote.var"#208#209"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, Zygote.var"#kw_zpullback#37"{DiffEqSensitivity.var"#forward_sensitivity_backpass#258"{0, Vector{Any}, Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:callback, :verbose), Tuple{DiscreteCallback{DiffEqCallbacks.var"#21#22", DiffEqCallbacks.PositiveDomainAffect{Nothing, Nothing, Vector{Float64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}, Bool}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ForwardDiffSensitivity{0, nothing}, Vector{Float64}, Vector{Float64}, Tuple{}}}}})(Δ::Matrix{Float64})
@ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67
[31] Pullback
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:710 [inlined]
[32] (::typeof(∂(#solve#29)))(Δ::Matrix{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[33] (::Zygote.var"#208#209"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, typeof(∂(#solve#29))})(Δ::Matrix{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207
[34] (::Zygote.var"#1750#back#210"{Zygote.var"#208#209"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, typeof(∂(#solve#29))}})(Δ::Matrix{Float64})
@ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67
[35] Pullback
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:705 [inlined]
[36] (::typeof(∂(solve##kw)))(Δ::Matrix{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[37] Pullback
@ ~/Documents/julia_GPU_solver/Test4.jl:112 [inlined]
[38] (::typeof(∂(loss_ODE)))(Δ::Tuple{Float64, Nothing})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[39] Pullback
@ ~/Documents/julia_GPU_solver/Test4.jl:144 [inlined]
[40] (::typeof(∂(λ)))(Δ::Tuple{Float64, Nothing})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[41] #208
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined]
[42] #1750#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[43] Pullback
@ ~/.julia/packages/SciMLBase/UEAKN/src/scimlfunctions.jl:2697 [inlined]
[44] (::typeof(∂(λ)))(Δ::Tuple{Float64, Nothing})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[45] #208
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined]
[46] #1750#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[47] Pullback
@ ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:30 [inlined]
[48] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[49] #208
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined]
[50] #1750#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[51] Pullback
@ ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:32 [inlined]
[52] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[53] (::Zygote.var"#52#53"{typeof(∂(λ))})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:41
[54] gradient(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:76
[55] (::Optimization.var"#129#139"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}})(::Vector{Float64}, ::Vector{Float64})
@ Optimization ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:32
[56] macro expansion
@ ~/.julia/packages/OptimizationOptimisers/XLPqT/src/OptimizationOptimisers.jl:35 [inlined]
[57] macro expansion
@ ~/.julia/packages/Optimization/RUgSr/src/utils.jl:35 [inlined]
[58] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::Optimisers.Adam{Float64}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; maxiters::Int64, callback::Function, progress::Bool, save_best::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OptimizationOptimisers ~/.julia/packages/OptimizationOptimisers/XLPqT/src/OptimizationOptimisers.jl:33
[59] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[60] __solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Int64, kwargs::Base.Pairs{Symbol, var"#3#4", Tuple{Symbol}, NamedTuple{(:callback,), Tuple{var"#3#4"}}})
@ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/5gDHf/src/OptimizationPolyalgorithms.jl:25
[61] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[62] train(model::Function, u0::Vector{Float64}, tspan::Tuple{Int64, Int64}, indices_components::Vector{Any}, saves_t::Vector{Any}, data::Matrix{Float64}, p_guess::Vector{Float64})
@ Main ~/Documents/julia_GPU_solver/Test4.jl:148
in expression starting at /Users/malmansto/Documents/julia_GPU_solver/Test4.jl:175

@ChrisRackauckas
Copy link
Member

This seems very unrelated. Can you open a new issue on SciMLSensitivity.jl, and narrow this down to just an issue on the derivative calculation? I don't think you need Optimization.jl at all. If I had to guess at the issue, it might be that PositiveDomain might need caches that can go dual, but narrowing down the issue is what would help solve it.

BTW, with the PositiveDomain(), are you sure this is a good use of it? I have you double checked that the parameters should give a stable solution for the outer sides of the optimization? At what parameters is it necessary?

@MaAl13
Copy link
Author

MaAl13 commented Jun 26, 2022

The PositiveDomain() was just a try to catch the following error. If i don't use the PositiveDomain() call and comment out the forced positvity of the ODE i get:

ERROR: LoadError: DomainError with -0.028633453239182774:
Exponentiation yielding a complex result requires a complex argument.
Replace x^y with (x+0im)^y, Complex(x)^y, or similar.
Stacktrace:
[1] throw_exp_domainerror(x::Float64)
@ Base.Math ./math.jl:37
[2] ^
@ ./math.jl:909 [inlined]
[3] Glycolisis_Yeast(du::Vector{Float64}, u::Vector{Float64}, p::Vector{Float64}, t::Float64)
@ Main ~/Documents/julia_GPU_solver/Test4.jl:10
[4] ODEFunction
@ ~/.julia/packages/SciMLBase/UEAKN/src/scimlfunctions.jl:1613 [inlined]
[5] perform_step!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, 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{}, Vector{Any}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, repeat_step::Bool)
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/perform_step/low_order_rk_perform_step.jl:694
[6] perform_step!
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/perform_step/low_order_rk_perform_step.jl:675 [inlined]
[7] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, 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{}, Vector{Any}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/solve.jl:477
[8] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/ZgJ9s/src/solve.jl:5 [inlined]
[9] #solve_call#28
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:428 [inlined]
[10] solve_up(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::Vector{Float64}, p::Vector{Float64}, args::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:saveat, :verbose), Tuple{Vector{Any}, Bool}}})
@ DiffEqBase ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:726
[11] #solve#29
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:710 [inlined]
[12] _concrete_solve_adjoint(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::ForwardDiffSensitivity{0, nothing}, ::Vector{Float64}, ::Vector{Float64}; saveat::Vector{Any}, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}})
@ DiffEqSensitivity ~/.julia/packages/DiffEqSensitivity/60SaR/src/concrete_solve.jl:362
[13] _concrete_solve_adjoint(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::Nothing, ::Vector{Float64}, ::Vector{Float64}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:saveat, :verbose), Tuple{Vector{Any}, Bool}}})
@ DiffEqSensitivity ~/.julia/packages/DiffEqSensitivity/60SaR/src/concrete_solve.jl:63
[14] _solve_adjoint(prob::ODEProblem{Vector{Float64}, Tuple{Int64, Int64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::Vector{Float64}, p::Vector{Float64}, args::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; merge_callbacks::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:saveat, :verbose), Tuple{Vector{Any}, Bool}}})
@ DiffEqBase ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:1069
[15] #rrule#50
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:1032 [inlined]
[16] chain_rrule_kw
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:229 [inlined]
[17] macro expansion
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [inlined]
[18] _pullback
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:9 [inlined]
[19] _apply
@ ./boot.jl:814 [inlined]
[20] adjoint
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:204 [inlined]
[21] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
[22] _pullback
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:710 [inlined]
[23] _pullback(::Zygote.Context, ::DiffEqBase.var"##solve#29", ::Nothing, ::Nothing, ::Nothing, ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:saveat, :verbose), Tuple{Vector{Any}, Bool}}}, ::typeof(solve), ::ODEProblem{Vector{Float64}, Tuple{Int64, Int64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[24] _apply(::Function, ::Vararg{Any})
@ Core ./boot.jl:814
[25] adjoint
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:204 [inlined]
[26] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
[27] _pullback
@ ~/.julia/packages/DiffEqBase/hZncn/src/solve.jl:705 [inlined]
[28] _pullback(::Zygote.Context, ::CommonSolve.var"#solve##kw", ::NamedTuple{(:saveat, :verbose), Tuple{Vector{Any}, Bool}}, ::typeof(solve), ::ODEProblem{Vector{Float64}, Tuple{Int64, Int64}, true, Vector{Float64}, ODEFunction{true, typeof(Glycolisis_Yeast), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[29] _pullback
@ ~/Documents/julia_GPU_solver/Test4.jl:106 [inlined]
[30] _pullback(::Zygote.Context, ::typeof(loss_ODE), ::typeof(Glycolisis_Yeast), ::Vector{Float64}, ::Tuple{Int64, Int64}, ::Vector{Float64}, ::Vector{Any}, ::Vector{Any}, ::Matrix{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[31] _pullback
@ ~/Documents/julia_GPU_solver/Test4.jl:138 [inlined]
[32] _pullback(::Zygote.Context, ::var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, ::Vector{Float64}, ::SciMLBase.NullParameters)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[33] _apply(::Function, ::Vararg{Any})
@ Core ./boot.jl:814
[34] adjoint
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:204 [inlined]
[35] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
[36] _pullback
@ ~/.julia/packages/SciMLBase/UEAKN/src/scimlfunctions.jl:2697 [inlined]
[37] _pullback(::Zygote.Context, ::OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, ::Vector{Float64}, ::SciMLBase.NullParameters)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[38] _apply(::Function, ::Vararg{Any})
@ Core ./boot.jl:814
[39] adjoint
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:204 [inlined]
[40] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
[41] _pullback
@ ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:30 [inlined]
[42] _pullback(ctx::Zygote.Context, f::Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[43] _apply(::Function, ::Vararg{Any})
@ Core ./boot.jl:814
[44] adjoint
@ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:204 [inlined]
[45] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
[46] _pullback
@ ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:32 [inlined]
[47] _pullback(ctx::Zygote.Context, f::Optimization.var"#131#141"{Tuple{}, Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0
[48] _pullback(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:34
[49] pullback(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:40
[50] gradient(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:75
[51] (::Optimization.var"#129#139"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}})(::Vector{Float64}, ::Vector{Float64})
@ Optimization ~/.julia/packages/Optimization/RUgSr/src/function/zygote.jl:32
[52] (::OptimizationOptimJL.var"#5#13"{OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, OptimizationOptimJL.var"#4#12"{OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, OptimizationFunction{false, Optimization.AutoZygote, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.var"#129#139"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, Optimization.var"#132#142"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, Optimization.var"#137#147", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}}, OptimizationFunction{false, Optimization.AutoZygote, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.var"#129#139"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, Optimization.var"#132#142"{Optimization.var"#128#138"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, Optimization.var"#137#147", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}})(G::Vector{Float64}, θ::Vector{Float64})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:106
[53] value_gradient!!(obj::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64})
@ NLSolversBase ~/.julia/packages/NLSolversBase/cfJrN/src/interface.jl:82
[54] value_gradient!(obj::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64})
@ NLSolversBase ~/.julia/packages/NLSolversBase/cfJrN/src/interface.jl:69
[55] value_gradient!(obj::Optim.ManifoldObjective{TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, x::Vector{Float64})
@ Optim ~/.julia/packages/Optim/6Lpjy/src/Manifolds.jl:50
[56] (::LineSearches.var"#ϕdϕ#6"{Optim.ManifoldObjective{TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}})(α::Float64)
@ LineSearches ~/.julia/packages/LineSearches/Ki4c5/src/LineSearches.jl:84
[57] (::LineSearches.HagerZhang{Float64, Base.RefValue{Bool}})(ϕ::Function, ϕdϕ::LineSearches.var"#ϕdϕ#6"{Optim.ManifoldObjective{TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}}, c::Float64, phi_0::Float64, dphi_0::Float64)
@ LineSearches ~/.julia/packages/LineSearches/Ki4c5/src/hagerzhang.jl:226
[58] HagerZhang
@ ~/.julia/packages/LineSearches/Ki4c5/src/hagerzhang.jl:101 [inlined]
[59] perform_linesearch!(state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}}, method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, d::Optim.ManifoldObjective{TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}})
@ Optim ~/.julia/packages/Optim/6Lpjy/src/utilities/perform_linesearch.jl:59
[60] update_state!(d::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}}, method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat})
@ Optim ~/.julia/packages/Optim/6Lpjy/src/multivariate/solvers/first_order/bfgs.jl:139
[61] optimize(d::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64}, method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, options::Optim.Options{Float64, OptimizationOptimJL.var"#_cb#11"{var"#3#4", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}}, state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}})
@ Optim ~/.julia/packages/Optim/6Lpjy/src/multivariate/optimize/optimize.jl:54
[62] optimize(d::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64}, method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, options::Optim.Options{Float64, OptimizationOptimJL.var"#_cb#11"{var"#3#4", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, Base.Iterators.Cycle{Tuple{Optimization.NullData}}}})
@ Optim ~/.julia/packages/Optim/6Lpjy/src/multivariate/optimize/optimize.jl:36
[63] ___solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Float64, Flat}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; callback::Function, maxiters::Int64, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:143
[64] #__solve#2
@ ~/.julia/packages/OptimizationOptimJL/fdrJg/src/OptimizationOptimJL.jl:56 [inlined]
[65] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[66] __solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6"{typeof(Glycolisis_Yeast), Vector{Float64}, Tuple{Int64, Int64}, Vector{Any}, Vector{Any}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Int64, kwargs::Base.Pairs{Symbol, var"#3#4", Tuple{Symbol}, NamedTuple{(:callback,), Tuple{var"#3#4"}}})
@ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/5gDHf/src/OptimizationPolyalgorithms.jl:29
[67] #solve#492
@ ~/.julia/packages/SciMLBase/UEAKN/src/solve.jl:56 [inlined]
[68] train(model::Function, u0::Vector{Float64}, tspan::Tuple{Int64, Int64}, indices_components::Vector{Any}, saves_t::Vector{Any}, data::Matrix{Float64}, p_guess::Vector{Float64})
@ Main ~/Documents/julia_GPU_solver/Test4.jl:142
in expression starting at /Users/malmansto/Documents/julia_GPU_solver/Test4.jl:169

The Optimization takes a few steps before this error comes. Essentially the gradient is computed correctly for some parameters, until a parameter vector comes that produces a complex solution trajectory. Can the Optimization package somehow handle this by punishing complex trajectories and ignoring the error message of the ODE solver?

@ChrisRackauckas
Copy link
Member

Please open an issue in SciMLSensitivity and I'll get to it, but putting it into here will only make it get lost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants