SciMLSensitivity.jl icon indicating copy to clipboard operation
SciMLSensitivity.jl copied to clipboard

The `Partial Differential Equation (PDE) Constrained Optimization` example

Open YichengDWu opened this issue 1 year ago • 10 comments

I rewrote the example with MethodOfLines. I believe it should be a more desired approach.

using Plots
using DifferentialEquations, Optimization, OptimizationPolyalgorithms, Zygote, OptimizationOptimJL
using DomainSets, MethodOfLines, ModelingToolkit, SciMLSensitivity

# Problem setup parameters:
Lx = 10.0
x_grid  = 0.0:0.01:Lx
dx = 0.01
#Nx = size(x)

#u0 = exp.(-(x.-3.0).^2) # I.C

## Problem Parameters
p        = [1.0,1.0]    # True solution parameters
#xtrs     = [dx,Nx]      # Extra parameters
dt       = 0.40*dx^2    # CFL condition
t0, tMax = 0.0 ,1000*dt
tspan    = (t0,tMax)
t_grid = t0:dt:tMax
#t        = t0:dt:tMax;

##
@parameters t, x, a0, a1
@variables u(..)
Dt = Differential(t)
Dxx = Differential(x)^2

heateq = [Dt(u(t,x)) ~ 2.0 * a0 * u(t,x) + a1 * Dxx(u(t,x))]

bcs = [u(t,0) ~ 0.0, u(t,Lx) ~ 0.0, u(0,x) ~ exp(-(x-3.0)^2)]
domains = [t ∈ Interval(t0,tMax), x ∈ Interval(0.0,Lx)]

@named pdesys = PDESystem(heateq, bcs, domains,[t,x],[u(t,x)], [a0=>0.1, a1=>0.2])
discretization = MOLFiniteDifference([x => dx], t)
prob = discretize(pdesys, discretization)

# Testing Solver on linear PDE
sol = solve(prob,Tsit5(), p =p, dt = dt, saveat = t_grid);

plot(x_grid, [0; sol.u[1]; 0], lw=3, label="t0", size=(800,500))
plot!(x_grid, [0; sol.u[end]; 0],lw=3, ls=:dash, label="tMax")

ps  = [0.1, 0.2];   # Initial guess for model parameters
function predict(θ)
    Array(solve(prob,Tsit5(),p=θ,dt=dt,saveat=t_grid))
end

## Defining Loss function
function loss(θ)
    pred = predict(θ)
    l = predict(θ)  - sol
    return sum(abs2, l), pred # Mean squared error
end

l,pred   = loss(ps)
size(pred), size(sol), size(t) # Checking sizes

LOSS  = []                              # Loss accumulator
PRED  = []                              # prediction accumulator
PARS  = []                              # parameters accumulator

callback = function (θ,l,pred) #callback function to observe training
  display(l)
  append!(PRED, [pred])
  append!(LOSS, l)
  append!(PARS, [θ])
  false
end

callback(ps,loss(ps)...) # Testing callback function

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

optprob = Optimization.OptimizationProblem(optf, ps)
res = Optimization.solve(optprob, PolyOpt(), callback = callback)
@show res.u

# Let see prediction vs. Truth
plot(sol[:,end],  lw=3, label="Truth", size=(800,500))
plot!(PRED[end][:,end], lw=3, ls=:dash, label="Prediction")
 # returns [1.0000000000000162, 1.0000000000000044]

YichengDWu avatar Jul 07 '22 20:07 YichengDWu

download

YichengDWu avatar Jul 07 '22 20:07 YichengDWu

Nice! @xtalax do you think it's ready for "prime time"? I am a bit reticent to start using it everywhere, mostly because we haven't already started using it everywhere, but it's at least close to ready enough if it isn't already. We should probably chat in the next call what we'd consider on the interface side before declaring 1.0.

@MilkshakeForReal can you double check which vjp it's using here? I assume it should be Enzyme compatible and grab EnzymeVJP and be much faster than the current example code (which is out of place non-mutating to do ZygoteVJP), but I'd want to double check all of that works out before starting to use MOL everywhere.

ChrisRackauckas avatar Jul 07 '22 21:07 ChrisRackauckas

I think you are right.

OptimizationProblem. In-place: true
u0: 2-element Vector{Float64}:
 0.1
 0.2

┌ Warning: Recursive type
│   T = ODESystem
└ @ Enzyme C:\Users\Luffy\.julia\packages\Enzyme\raAyg\src\typetree.jl:148

The warning suggests so.

YichengDWu avatar Jul 07 '22 22:07 YichengDWu

I have been experimenting with method of lines and optimization, and have seen a few examples elsewhere. I have not seen anything that suggests that MOL isn't compatible with any case, though I have not yet discovered any best practices, especially in relation to which auto diff method works best.

I have noticed a few situations that don't work anymore with a newer version of MTK so I need to do a bit more digging there.

As for 1.0, that probably comes after the stencil version that reproduces current functionality, maybe also including WENO methods

xtalax avatar Jul 08 '22 14:07 xtalax

Let's hold off a bit on this as we finalize the MOL package, but that is where this example should be heading. A few things to point out:

  1. Looks like it is using Enzyme effectively, though we should figure out what that warning is.
  2. The remake works out here, but it's technically not correct to assume the parameter ordering like that.

ChrisRackauckas avatar Jul 08 '22 22:07 ChrisRackauckas

@MilkshakeForReal Thanks for putting this together! I'm trying to get MOL and optimization to work together nicely, so this is helpful. I'm trying to run this example do you have an order of magnitude indication on how long to expect the Optimization.solve to take on a laptop? It's been sitting for 10s of minutes struggling even after bounding the search space.

Edit: took a little over an hour to find the [0.9999999999961883, 1.0000000000142688] solution. That seems pretty long!

thompsonmj avatar Jul 25 '22 01:07 thompsonmj

My laptop is quite powerful. It takes 4 mins for Optimization.solve to find the result. An hour sounds ridiculous to me.

YichengDWu avatar Jul 25 '22 21:07 YichengDWu

@YichengDWu Thanks for this example! I tried to get it running with SciMLSensitivity v7.50.0 and MethodOfLines v0.10.4, but got the following error:

ERROR: AssertionError: Not enough arguments for the number of independent variables  
including time where appropriate, got 1 expected 2.

Here is how I updated your code, maybe you or @xtalax have an idea of how to get this to work

using OrdinaryDiffEq, Optimization, OptimizationPolyalgorithms, Zygote, OptimizationOptimJL, DomainSets, MethodOfLines, ModelingToolkit, SciMLSensitivity

# Problem setup parameters:
Lx = 10.0
x_grid  = 0.0:0.01:Lx
dx = 0.1
#Nx = size(x)

#u0 = exp.(-(x.-3.0).^2) # I.C

## Problem Parameters
p        = [1.0,1.0]    # True solution parameters
#xtrs     = [dx,Nx]      # Extra parameters
dt       = 0.40*dx^2    # CFL condition
t0, tMax = 0.0 ,1000*dt
tspan    = (t0,tMax)
t_grid = t0:dt:tMax
#t        = t0:dt:tMax;

##
@parameters t, x, a0, a1
@variables u(..)
Dt = Differential(t)
Dxx = Differential(x)^2

heateq = [Dt(u(t,x)) ~ 2.0 * a0 * u(t,x) + a1 * Dxx(u(t,x))]

bcs = [u(t,0) ~ 0.0, u(t,Lx) ~ 0.0, u(0,x) ~ exp(-(x-3.0)^2)]
domains = [t ∈ Interval(t0,tMax), x ∈ Interval(0.0,Lx)]

@named pdesys = PDESystem(heateq, bcs, domains,[t,x],[u(t,x)], [a0=>0.1, a1=>0.2])
discretization = MOLFiniteDifference([x => dx], t)
prob = discretize(pdesys, discretization)

# Testing Solver on linear PDE
sol = solve(prob,Tsit5(), p =p, dt = dt, saveat = t_grid);


ps  = [0.1, 0.2];   # Initial guess for model parameters
function predict(θ)
    sol = solve(prob,Tsit5(),p=θ,dt=dt,saveat=t_grid)
    return sol[u(t,x)]
end

sol = predict(ps) # Testing predict function

## Defining Loss function
function loss(θ)
    pred = predict(θ)
    l = predict(θ) - sol
    return sum(abs2, l), pred #, pred # Mean squared error
end

l, pred   = loss(ps)
size(pred), size(Array(sol)), size(t) # Checking sizes

LOSS  = []                              # Loss accumulator
PRED  = []                              # prediction accumulator
PARS  = []                              # parameters accumulator

callback = function (θ,l,pred) #callback function to observe training
  display(l)
  append!(PRED, [pred])
  append!(LOSS, l)
  append!(PARS, [θ])
  false
end

callback(ps,loss(ps)...) # Testing callback function

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

optprob = Optimization.OptimizationProblem(optf, ps)
res = Optimization.solve(optprob, PolyOpt()) # ERROR: AssertionError: Not enough arguments for the number of independent variables  including time where appropriate, got 1 expected 2.
Stacktrace
Stacktrace:
  [1] (::SciMLBase.PDETimeSeriesSolution{Float64, 1, Dict{Num, Matrix{Float64}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}, 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, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats, Nothing}, Nothing, Vector{Float64}, Tuple{Vector{Float64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Vector{SymbolicUtils.BasicSymbolic{Real}}, Vector{Num}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Dict{Num, Interpolations.GriddedInterpolation{Float64, 2, Matrix{Float64}, Interpolations.Gridded{Interpolations.Linear{Interpolations.Throw{Interpolations.OnGrid}}}, Tuple{Vector{Float64}, Vector{Float64}}}}, DiffEqBase.DEStats})(args::Vector{Float64}; dv::Nothing)
    @ MethodOfLines ~/.julia/packages/MethodOfLines/zCdWV/src/interface/solution/common.jl:14
  [2] (::SciMLBase.PDETimeSeriesSolution{Float64, 1, Dict{Num, Matrix{Float64}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}, 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, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats, Nothing}, Nothing, Vector{Float64}, Tuple{Vector{Float64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Vector{SymbolicUtils.BasicSymbolic{Real}}, Vector{Num}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Dict{Num, Interpolations.GriddedInterpolation{Float64, 2, Matrix{Float64}, Interpolations.Gridded{Interpolations.Linear{Interpolations.Throw{Interpolations.OnGrid}}}, Tuple{Vector{Float64}, Vector{Float64}}}}, DiffEqBase.DEStats})(args::Vector{Float64})
    @ MethodOfLines ~/.julia/packages/MethodOfLines/zCdWV/src/interface/solution/common.jl:2
  [3] _concrete_solve_adjoint(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::InterpolatingAdjoint{0, true, Val{:central}, EnzymeVJP}, ::Vector{Float64}, ::Vector{Float64}, ::SciMLBase.ChainRulesOriginator; save_start::Bool, save_end::Bool, saveat::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, save_idxs::Nothing, kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:verbose, :dt), Tuple{Bool, Float64}}})
    @ SciMLSensitivity ~/.julia/packages/SciMLSensitivity/6YVpi/src/concrete_solve.jl:332
  [4] _concrete_solve_adjoint(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Float64}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Vector{Float64}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}}}, false}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::Nothing, ::Vector{Float64}, ::Vector{Float64}, ::SciMLBase.ChainRulesOriginator; verbose::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:dt, :saveat), Tuple{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}}})
    @ SciMLSensitivity ~/.julia/packages/SciMLSensitivity/6YVpi/src/concrete_solve.jl:163
  [5] _concrete_solve_adjoint
    @ ~/.julia/packages/SciMLSensitivity/6YVpi/src/concrete_solve.jl:148 [inlined]
  [6] #_solve_adjoint#53
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:1335 [inlined]
  [7] _solve_adjoint
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:1304 [inlined]
  [8] #rrule#51
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:1288 [inlined]
  [9] rrule
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:1284 [inlined]
 [10] rrule
    @ ~/.julia/packages/ChainRulesCore/7MWx2/src/rules.jl:140 [inlined]
 [11] chain_rrule_kw
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/chainrules.jl:235 [inlined]
 [12] macro expansion
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:101 [inlined]
 [13] _pullback
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:101 [inlined]
 [14] _apply
    @ ./boot.jl:838 [inlined]
 [15] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [16] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [17] _pullback
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:829 [inlined]
 [18] _pullback(::Zygote.Context{false}, ::DiffEqBase.var"##solve#27", ::Nothing, ::Nothing, ::Vector{Float64}, ::Val{true}, ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:dt, :saveat), Tuple{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}}}, ::typeof(solve), ::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x3bc47462, 0x0ea31f1f, 0xcf75e0e0, 0xa7bb0225, 0x521d004a), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x74d44cb6, 0x914b421d, 0x753c47db, 0x24d3c8ea, 0xbc2aaa0d), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [19] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [20] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [21] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [22] _pullback
    @ ~/.julia/packages/DiffEqBase/wtukj/src/solve.jl:819 [inlined]
 [23] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:p, :dt, :saveat), Tuple{Vector{Float64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}}, ::typeof(solve), ::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x3bc47462, 0x0ea31f1f, 0xcf75e0e0, 0xa7bb0225, 0x521d004a), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x74d44cb6, 0x914b421d, 0x753c47db, 0x24d3c8ea, 0xbc2aaa0d), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#630#generated_observed#555"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, MethodOfLines.ScalarizedDiscretization}}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [24] _pullback
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:43 [inlined]
 [25] _pullback(ctx::Zygote.Context{false}, f::typeof(predict), args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [26] _pullback
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:51 [inlined]
 [27] _pullback(ctx::Zygote.Context{false}, f::typeof(loss), args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [28] _pullback
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:74 [inlined]
 [29] _pullback(::Zygote.Context{false}, ::var"#5#6", ::Vector{Float64}, ::SciMLBase.NullParameters)
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [30] _apply
    @ ./boot.jl:838 [inlined]
 [31] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [32] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [33] _pullback
    @ ~/.julia/packages/SciMLBase/l4PVV/src/scimlfunctions.jl:3772 [inlined]
 [34] _pullback(::Zygote.Context{false}, ::OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, ::Vector{Float64}, ::SciMLBase.NullParameters)
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [35] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [36] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [37] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [38] _pullback
    @ ~/.julia/packages/Optimization/vFala/src/function/zygote.jl:31 [inlined]
 [39] _pullback(ctx::Zygote.Context{false}, f::Optimization.var"#209#218"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [40] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [41] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [42] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [43] _pullback
    @ ~/.julia/packages/Optimization/vFala/src/function/zygote.jl:35 [inlined]
 [44] _pullback(ctx::Zygote.Context{false}, f::Optimization.var"#211#220"{Tuple{}, Optimization.var"#209#218"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [45] pullback(f::Function, cx::Zygote.Context{false}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:44
 [46] pullback
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:42 [inlined]
 [47] gradient(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:96
 [48] (::Optimization.var"#210#219"{Optimization.var"#209#218"{OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}})(::Vector{Float64}, ::Vector{Float64})
    @ Optimization ~/.julia/packages/Optimization/vFala/src/function/zygote.jl:33
 [49] macro expansion
    @ ~/.julia/packages/OptimizationOptimisers/FWIuf/src/OptimizationOptimisers.jl:31 [inlined]
 [50] macro expansion
    @ ~/.julia/packages/Optimization/vFala/src/utils.jl:37 [inlined]
 [51] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, 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/FWIuf/src/OptimizationOptimisers.jl:30
 [52] __solve (repeats 2 times)
    @ ~/.julia/packages/OptimizationOptimisers/FWIuf/src/OptimizationOptimisers.jl:7 [inlined]
 [53] #solve#595
    @ ~/.julia/packages/SciMLBase/l4PVV/src/solve.jl:86 [inlined]
 [54] solve
    @ ~/.julia/packages/SciMLBase/l4PVV/src/solve.jl:80 [inlined]
 [55] __solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/hCJel/src/OptimizationPolyalgorithms.jl:24
 [56] __solve
    @ ~/.julia/packages/OptimizationPolyalgorithms/hCJel/src/OptimizationPolyalgorithms.jl:9 [inlined]
 [57] #solve#595
    @ ~/.julia/packages/SciMLBase/l4PVV/src/solve.jl:86 [inlined]
 [58] solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#5#6", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt)
    @ SciMLBase ~/.julia/packages/SciMLBase/l4PVV/src/solve.jl:80

BernhardAhrens avatar Dec 20 '23 15:12 BernhardAhrens

you want to use symbolic remake to solve the problem with new params, try using newprob = remake(prob, p = [a1 => myfloat1, a2 => myfloat2]) then solve(newprob, ... ) etc in the loss

xtalax avatar Dec 21 '23 03:12 xtalax

I updated the example with remake. The optimization is still not working when I use adtype = Optimization.AutoZygote() and errors with MethodError: no method matching getindex(::IRTools.Inner.Undefined, ::Vector{Int64}). With adtype = Optimization.AutoForwardDiff() it works. Curiously, the original example worked with Optimization.AutoZygote() - maybe this could give hints on how to get MethodOfLines working with Zygote again. @xtalax, we have reported this elsewhere before (https://github.com/SciML/MethodOfLines.jl/issues/309) but are a bit stuck to get MethodOfLines to play nice with Zygote. Any hints or help would be highly appreciated 🙏

Updated Code
using OrdinaryDiffEq, Optimization, OptimizationPolyalgorithms, Zygote, OptimizationOptimJL, DomainSets, MethodOfLines, ModelingToolkit, SciMLSensitivity

# Problem setup parameters:
Lx = 10.0
x_grid  = 0.0:0.01:Lx
dx = 0.1
#Nx = size(x)

#u0 = exp.(-(x.-3.0).^2) # I.C

## Problem Parameters
p        = [1.0,1.0]    # True solution parameters
#xtrs     = [dx,Nx]      # Extra parameters
dt       = 0.40*dx^2    # CFL condition
t0, tMax = 0.0 ,1000*dt
tspan    = (t0,tMax)
t_grid = t0:dt:tMax
#t        = t0:dt:tMax;

##
@parameters t, x, a0, a1
@variables u(..)
Dt = Differential(t)
Dxx = Differential(x)^2

heateq = [Dt(u(t,x)) ~ 2.0 * a0 * u(t,x) + a1 * Dxx(u(t,x))]

bcs = [u(t,0) ~ 0.0, u(t,Lx) ~ 0.0, u(0,x) ~ exp(-(x-3.0)^2)]
domains = [t ∈ Interval(t0,tMax), x ∈ Interval(0.0,Lx)]

@named pdesys = PDESystem(heateq, bcs, domains,[t,x],[u(t,x)], [a0=>0.1, a1=>0.2])

discretization = MOLFiniteDifference([x => dx], t)
prob = discretize(pdesys, discretization)

# Convert the PDE problem into an ODE problem
#using PDEBase: add_metadata!
#using ModelingToolkit: get_metadata
#sys,tspan = symbolic_discretize(pdesys,discretization)
#simpsys = structural_simplify(sys)
#add_metadata!(get_metadata(simpsys), sys)
#prob= ODEProblem{true, SciMLBase.FullSpecialize}(simpsys, Pair[], tspan)

# Testing Solver on linear PDE
sol = solve(prob,Tsit5(), p =p, dt = dt, saveat = t_grid);


ps  = [0.1, 0.2];   # Initial guess for model parameters
function predict(θ)
    newprob = remake(prob, p = [a0 => θ[1], a1 => θ[2]])
    sol = solve(newprob,Tsit5(),p=θ,dt=dt,saveat=t_grid)
    sol[u(t,x)]
end

sol = predict(p) # Testing predict function

## Defining Loss function
function loss(θ)
    pred = predict(θ)
    l = predict(θ) - sol
    return sum(abs2, l), pred #, pred # Mean squared error
end

l, pred   = loss(ps)
size(pred), size(Array(sol)), size(t) # Checking sizes

LOSS  = []                              # Loss accumulator
PRED  = []                              # prediction accumulator
PARS  = []                              # parameters accumulator

callback = function (θ,l,pred) #callback function to observe training
  display(l)
  append!(PRED, [pred])
  append!(LOSS, l)
  append!(PARS, [θ])
  false
end

callback(ps,loss(ps)...) # Testing callback function

# with Zygote - does not work
adtype = Optimization.AutoZygote()
optf = Optimization.OptimizationFunction((x,p)->loss(x), adtype)

optprob = Optimization.OptimizationProblem(optf, ps)
res = Optimization.solve(optprob, PolyOpt()) # MethodError: no method matching getindex(::IRTools.Inner.Undefined, ::Vector{Int64})

# with ForwardDiff - does work
adtype = Optimization.AutoForwardDiff()
optf = Optimization.OptimizationFunction((x,p)->loss(x), adtype)

optprob = Optimization.OptimizationProblem(optf, ps)
res = Optimization.solve(optprob, PolyOpt())
Stacktrace
ERROR: MethodError: no method matching getindex(::IRTools.Inner.Undefined, ::Vector{Int64})                                                                                                                                                                                                                                                                                                                   
Stacktrace:                                                                                                                                                                                                                                                                                                                                                                                                   
  [1] macro expansion                                                                                                                                                                                                                                                                                                                                                                                         
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:101 [inlined]                                                                                                                                                                                                                                                                                                                                 
  [2] _pullback(::Zygote.Context{false}, ::typeof(getindex), ::IRTools.Inner.Undefined, ::Vector{Int64})                                                                                                                                                                                                                                                                                                      
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:101                                                                                                                                                                                                                                                                                                                                    
  [3] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/.julia/packages/ModelingToolkit/dCa81/src/variables.jl:153 [inlined]                                                                                                                                                                                                                                                                                                                                  
  [4] _pullback(::Zygote.Context{false}, ::typeof(SciMLBase.process_p_u0_symbolic), ::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#551"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x3bc47462, 0x0ea3
1f1f, 0xcf75e0e0, 0xa7bb0225, 0x521d004a), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xcb3cc444, 0x9dc9b23b, 0x1bcbf8df, 0x3af0922d, 0x823a361f), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, No
thing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#662#generated_observed#561"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{Metho
dOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, Nothing, MethodOfLines.ScalarizedDiscretization}}, ::Vector{Pair{Num, Float64}}, ::Vector{Float64})                                                                                                                                                                                                       
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
  [5] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/.julia/packages/SciMLBase/8XHkk/src/remake.jl:78 [inlined]                                                                                                                                                                                                                                                                                                                                            
  [6] _pullback(::Zygote.Context{false}, ::SciMLBase.var"##remake#637", ::Missing, ::Missing, ::Missing, ::Vector{Pair{Num, Float64}}, ::Missing, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(remake), ::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#551"{RuntimeGeneratedFun
ctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x3bc47462, 0x0ea31f1f, 0xcf75e0e0, 0xa7bb0225, 0x521d004a), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xcb3cc444, 0x9dc9b23b, 0x1bcbf8df, 0x3af0922d
, 0x823a361f), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#662#generated_observed#561"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{()
, Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, MethodOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, Nothing, MethodOfLines.ScalarizedDiscretization}})                                                                                                       
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
  [7] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/.julia/packages/SciMLBase/8XHkk/src/remake.jl:52 [inlined]                                                                                                                                                                                                                                                                                                                                            
  [8] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:p,), Tuple{Vector{Pair{Num, Float64}}}}, ::typeof(remake), ::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#551"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", 
ModelingToolkit.var"#_RGF_ModTag", (0x3bc47462, 0x0ea31f1f, 0xcf75e0e0, 0xa7bb0225, 0x521d004a), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xcb3cc444, 0x9dc9b23b, 0x1bcbf8df, 0x3af0922d, 0x823a361f), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, No
thing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#662#generated_observed#561"{Bool, ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, MethodOfLines.MOLMetadata{Val{true}(), MethodOfLines.DiscreteSpace{1, 1, Metho
dOfLines.CenterAlignedGrid}, MOLFiniteDifference{MethodOfLines.CenterAlignedGrid, MethodOfLines.ScalarizedDiscretization}, PDESystem, Base.RefValue{Any}, Nothing, MethodOfLines.ScalarizedDiscretization}})                                                                                                                                                                                                  
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
  [9] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:50 [inlined]                                                                                                                                                                                                                                                                                                                            
 [10] _pullback(ctx::Zygote.Context{false}, f::typeof(predict), args::Vector{Float64})                                                                                                                                                                                                                                                                                                                        
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
 [11] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:59 [inlined]                                                                                                                                                                                                                                                                                                                            
 [12] _pullback(ctx::Zygote.Context{false}, f::typeof(loss), args::Vector{Float64})                                                                                                                                                                                                                                                                                                                           
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
 [13] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:83 [inlined]                                                                                                                                                                                                                                                                                                                            
 [14] _pullback(::Zygote.Context{false}, ::var"#43#44", ::Vector{Float64}, ::SciMLBase.NullParameters)                                                                                                                                                                                                                                                                                                        
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0                                                                                                                                                                                                                                                                                                                                      
 [15] _apply                                                                                                                                                                                                                                                                                                                                                                                                  
    @ ./boot.jl:838 [inlined]                                                                                                                                                                                                                                                                                                                                                                                 
 [16] adjoint                                                                                                                                                                                                                                                                                                                                                                                                 
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]                                                                                                                                                                                                                                                                                                                                             
 [17] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]                                                                                                                                                                                                                                                                                                                                         
 [18] _pullback                                                                                                                                                                                                                                                                                                                                                                                               
    @ ~/.julia/packages/SciMLBase/8XHkk/src/scimlfunctions.jl:3933 [inlined]
[19] _pullback(::Zygote.Context{false}, ::OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, ::Vector{Float64}, ::SciMLBase.NullParameters)                               
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [20] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [21] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [22] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [23] _pullback
    @ ~/.julia/packages/Optimization/fPVIW/ext/OptimizationZygoteExt.jl:88 [inlined]
 [24] _pullback(ctx::Zygote.Context{false}, f::OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [25] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [26] adjoint
    @ ~/.julia/packages/Zygote/YYT6v/src/lib/lib.jl:203 [inlined]
 [27] _pullback
    @ ~/.julia/packages/ZygoteRules/4nXuu/src/adjoint.jl:66 [inlined]
 [28] _pullback
    @ ~/.julia/packages/Optimization/fPVIW/ext/OptimizationZygoteExt.jl:91 [inlined]
 [29] _pullback(ctx::Zygote.Context{false}, f::OptimizationZygoteExt.var"#39#57"{Tuple{}, OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface2.jl:0
 [30] pullback(f::Function, cx::Zygote.Context{false}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:44
 [31] pullback
    @ ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:42 [inlined]
 [32] gradient(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/YYT6v/src/compiler/interface.jl:96
 [33] (::OptimizationZygoteExt.var"#38#56"{OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}})(::Vector{Float64}, ::Vector{Float64})
    @ OptimizationZygoteExt ~/.julia/packages/Optimization/fPVIW/ext/OptimizationZygoteExt.jl:91
 [34] macro expansion
    @ ~/.julia/packages/OptimizationOptimisers/hZdKg/src/OptimizationOptimisers.jl:65 [inlined]
 [35] macro expansion
    @ ~/.julia/packages/Optimization/fPVIW/src/utils.jl:41 [inlined]
 [36] __solve(cache::OptimizationCache{OptimizationFunction{true, AutoZygote, var"#43#44", OptimizationZygoteExt.var"#38#56"{OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}}, OptimizationZygoteExt.var"#41#59"{OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}}, OptimizationZygoteExt.var"#45#63", Nothing, OptimizationZygoteExt.var"#49#67"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}, OptimizationZygoteExt.var"#53#71"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}, Nothing, Nothing, Nothing, Nothing, Nothing, Optimisers.Adam, Base.Iterators.Cycle{Tuple{Optimization.NullData}}, Bool, OptimizationOptimisers.var"#11#13"})
    @ OptimizationOptimisers ~/.julia/packages/OptimizationOptimisers/hZdKg/src/OptimizationOptimisers.jl:63
 [37] solve!(cache::OptimizationCache{OptimizationFunction{true, AutoZygote, var"#43#44", OptimizationZygoteExt.var"#38#56"{OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}}, OptimizationZygoteExt.var"#41#59"{OptimizationZygoteExt.var"#37#55"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}}, OptimizationZygoteExt.var"#45#63", Nothing, OptimizationZygoteExt.var"#49#67"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}, OptimizationZygoteExt.var"#53#71"{OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}, Nothing, Nothing, Nothing, Nothing, Nothing, Optimisers.Adam, Base.Iterators.Cycle{Tuple{Optimization.NullData}}, Bool, OptimizationOptimisers.var"#11#13"})
    @ SciMLBase ~/.julia/packages/SciMLBase/8XHkk/src/solve.jl:177
 [38] solve(::OptimizationProblem{true, OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::Optimisers.Adam; kwargs::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:maxiters,), Tuple{Int64}}})
    @ SciMLBase ~/.julia/packages/SciMLBase/8XHkk/src/solve.jl:94
 [39] solve
    @ ~/.julia/packages/SciMLBase/8XHkk/src/solve.jl:91 [inlined]
 [40] __solve(::OptimizationProblem{true, OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt; maxiters::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OptimizationPolyalgorithms ~/.julia/packages/OptimizationPolyalgorithms/MOJAF/src/OptimizationPolyalgorithms.jl:24
 [41] __solve
    @ ~/.julia/packages/OptimizationPolyalgorithms/MOJAF/src/OptimizationPolyalgorithms.jl:9 [inlined]
 [42] #solve#614
    @ ~/.julia/packages/SciMLBase/8XHkk/src/solve.jl:97 [inlined]
 [43] solve(::OptimizationProblem{true, OptimizationFunction{true, AutoZygote, var"#43#44", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::PolyOpt)
    @ SciMLBase ~/.julia/packages/SciMLBase/8XHkk/src/solve.jl:91
 [44] top-level scope
    @ ~/minerva_bahrens/projects/MWEs/MOL_PolyOpt/polyOpt_expample.jl:86

BernhardAhrens avatar Jan 15 '24 15:01 BernhardAhrens