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

"Please load the corresponding AD package Symbolics" #88

Open
jariji opened this issue Aug 16, 2024 · 3 comments
Open

"Please load the corresponding AD package Symbolics" #88

jariji opened this issue Aug 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jariji
Copy link

jariji commented Aug 16, 2024

It says to load Symbolics but I have loaded it already.

Julia 1.10.3

⌃ [a0c0ee7d] DifferentiationInterface v0.5.11
  [f6369f11] ForwardDiff v0.10.36
  [7f7a1694] Optimization v3.27.0
  [36348300] OptimizationOptimJL v0.3.2
⌅ [0c5d862f] Symbolics v5.36.0

julia> using DifferentiationInterface, Symbolics, Optimization, OptimizationOptimJL, ForwardDiff

julia> let f(x,_) = x'x
           optfunc = OptimizationFunction(f, DifferentiationInterface.AutoForwardDiff())
           optprob = OptimizationProblem(optfunc, [4.0])
           solve(optprob, LBFGS())
       end
retcode: Success
u: 1-element Vector{Float64}:
 0.0

julia> let f(x,_) = x'x
           optfunc = OptimizationFunction(f, DifferentiationInterface.AutoSymbolics())
           optprob = OptimizationProblem(optfunc, [4.0])
           solve(optprob, LBFGS())
       end
ERROR: ArgumentError: The passed automatic differentiation backend choice is not available. Please load the corresponding AD package Symbolics.
Stacktrace:
  [1] instantiate_function(f::Function, x::OptimizationBase.ReInitCache{…}, adtype::AutoSymbolics, p::Int64, num_cons::Int64)
    @ OptimizationBase ~/.julia/packages/OptimizationBase/mGHPN/src/function.jl:114
  [2] instantiate_function(f::Function, x::OptimizationBase.ReInitCache{…}, adtype::AutoSymbolics, p::Int64)
    @ OptimizationBase ~/.julia/packages/OptimizationBase/mGHPN/src/function.jl:106
  [3] OptimizationCache(prob::OptimizationProblem{…}, opt::LBFGS{…}, data::Base.Iterators.Cycle{…}; callback::Function, maxiters::Nothing, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, structural_analysis::Bool, manifold::Nothing, kwargs::@Kwargs{})
    @ OptimizationBase ~/.julia/packages/OptimizationBase/mGHPN/src/cache.jl:38
  [4] __init(prob::OptimizationProblem{…}, opt::LBFGS{…}, data::Base.Iterators.Cycle{…}; callback::Function, maxiters::Nothing, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, kwargs::@Kwargs{})
    @ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/hDX5k/src/OptimizationOptimJL.jl:112
  [5] __init(prob::OptimizationProblem{…}, opt::LBFGS{…}, data::Base.Iterators.Cycle{…})
    @ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/hDX5k/src/OptimizationOptimJL.jl:77
  [6] init(::OptimizationProblem{…}, ::LBFGS{…}; kwargs::@Kwargs{})
    @ SciMLBase ~/.julia/packages/SciMLBase/vhP5T/src/solve.jl:174
  [7] init(::OptimizationProblem{…}, ::LBFGS{…})
    @ SciMLBase ~/.julia/packages/SciMLBase/vhP5T/src/solve.jl:172
  [8] solve(::OptimizationProblem{…}, ::LBFGS{…}; kwargs::@Kwargs{})
    @ SciMLBase ~/.julia/packages/SciMLBase/vhP5T/src/solve.jl:96
  [9] solve(::OptimizationProblem{…}, ::LBFGS{…})
    @ SciMLBase ~/.julia/packages/SciMLBase/vhP5T/src/solve.jl:93
 [10] top-level scope
@jariji jariji added the bug Something isn't working label Aug 16, 2024
@gdalle
Copy link
Contributor

gdalle commented Aug 16, 2024

Maybe this is linked to the fact that the corresponding backend was called AutoModelingToolkit before? @Vaibhavdixit02

@Vaibhavdixit02
Copy link
Member

The error message is too naive sorry about that. You need to load ModelingToolkit to be able to use this since the extension is for MTK

@jariji
Copy link
Author

jariji commented Aug 16, 2024

Yep that works, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants