We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I didn't dig deep, I just greped eval and found https://github.com/JuliaNonconvex/NonconvexUtils.jl/blob/710d57ff61ee2f94cea9558b2c4d5fb127da7efa/src/symbolic.jl#L23-L39
grep
eval
You likely need build_function(; epression = Val(false)) like we do here https://github.com/odow/SymbolicAD.jl/blob/bae8b1e042841b80fef5606b71e13e1d30255df2/src/nonlinear_oracle.jl#L230.
build_function(; epression = Val(false))
Docs: https://symbolics.juliasymbolics.org/dev/manual/build_function/
julia> import Nonconvex julia> Nonconvex.@load Ipopt [ Info: Attempting to load the package NonconvexIpopt. [ Info: Loading succesful. julia> function main() model = Nonconvex.DictModel() addvar!(model, "x", 0.0, 1.0) Nonconvex.set_objective!(model, x -> x["x"]) Nonconvex.add_eq_constraint!(model, x -> x["x"]) return Nonconvex.optimize( Nonconvex.symbolify(model), IpoptAlg(), NonconvexCore.getinit(model); options = IpoptOptions(), ) end main (generic function with 1 method) julia> main() ERROR: MethodError: no method matching (::NonconvexUtils.var"#138#139")(::Vector{Float64}) The applicable method may be too new: running in world age 31663, while current world is 31665. Closest candidates are: (::NonconvexUtils.var"#138#139")(::Any) at ~/.julia/packages/SymbolicUtils/9IZDP/src/code.jl:349 (method too new to be called from this world context.) Stacktrace: [1] (::NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}})(x::Vector{Float64}) @ NonconvexUtils ~/.julia/packages/NonconvexUtils/Lw5GL/src/symbolic.jl:30 [2] (::NonconvexUtils.CustomGradFunction{NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing})(x::Vector{Float64}) @ NonconvexUtils ~/.julia/packages/NonconvexUtils/Lw5GL/src/custom.jl:5 [3] (::NonconvexUtils.var"#67#72"{Vector{Float64}})(Δ::Float64) @ NonconvexUtils ~/.julia/packages/NonconvexUtils/Lw5GL/src/symbolic.jl:76 [4] ZBack @ ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:205 [inlined] [5] Pullback @ ~/.julia/packages/NonconvexUtils/Lw5GL/src/symbolic.jl:124 [inlined] [6] (::typeof(∂(λ)))(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [7] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/models/vec_model.jl:82 [inlined] [8] (::typeof(∂(λ)))(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [9] #208 @ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined] [10] (::Zygote.var"#1750#back#210"{Zygote.var"#208#209"{Tuple{Tuple{Nothing}}, typeof(∂(λ))}})(Δ::Float64) @ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [11] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/functions/functions.jl:272 [inlined] [12] (::typeof(∂(#_#14)))(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [13] (::Zygote.var"#208#209"{Tuple{Tuple{Nothing, Nothing}, Tuple{Nothing}}, typeof(∂(#_#14))})(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [14] #1750#back @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined] [15] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/functions/functions.jl:272 [inlined] [16] (::typeof(∂(λ)))(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [17] #208 @ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined] [18] (::Zygote.var"#1750#back#210"{Zygote.var"#208#209"{Tuple{Tuple{Nothing}}, typeof(∂(λ))}})(Δ::Float64) @ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [19] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/functions/functions.jl:106 [inlined] [20] (::typeof(∂(λ)))(Δ::Float64) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [21] #546 @ ~/.julia/packages/Zygote/DkIUK/src/lib/array.jl:198 [inlined] [22] #4 @ ./generator.jl:36 [inlined] [23] iterate @ ./generator.jl:47 [inlined] [24] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Tuple{Float64, typeof(∂(λ))}}, Tuple{Float64}}}, Base.var"#4#5"{Zygote.var"#546#551"}}) @ Base ./array.jl:724 [25] map @ ./abstractarray.jl:2948 [inlined] [26] (::Zygote.var"#map_back#548"{NonconvexCore.var"#5#6"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Tuple{Vector{Float64}}}, 1, Tuple{Vector{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{NonconvexUtils.var"#90#95"{NonconvexUtils.SymbolicFunction{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{FunctionWrapper{var"#22#24", Int64}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{Any, Any}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}, NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing, Vector{Float64}}}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}}}, Tuple{Tuple{Base.OneTo{Int64}}}, Vector{Tuple{Float64, typeof(∂(λ))}}})(Δ::Tuple{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/array.jl:198 [27] (::Zygote.var"#2578#back#552"{Zygote.var"#map_back#548"{NonconvexCore.var"#5#6"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Tuple{Vector{Float64}}}, 1, Tuple{Vector{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{NonconvexUtils.var"#90#95"{NonconvexUtils.SymbolicFunction{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{FunctionWrapper{var"#22#24", Int64}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{Any, Any}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}, NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing, Vector{Float64}}}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}}}, Tuple{Tuple{Base.OneTo{Int64}}}, Vector{Tuple{Float64, typeof(∂(λ))}}}})(Δ::Tuple{Float64}) @ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [28] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/functions/functions.jl:105 [inlined] [29] (::typeof(∂(#_#4)))(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [30] (::Zygote.var"#208#209"{Tuple{Tuple{Nothing, Nothing}, Tuple{Nothing}}, typeof(∂(#_#4))})(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [31] #1750#back @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined] [32] Pullback @ ~/.julia/packages/NonconvexCore/uZAVo/src/functions/functions.jl:105 [inlined] [33] (::typeof(∂(λ)))(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [34] #208 @ ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [inlined] [35] (::Zygote.var"#1750#back#210"{Zygote.var"#208#209"{Tuple{Tuple{Nothing}}, typeof(∂(λ))}})(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [36] Pullback @ ./operators.jl:1085 [inlined] [37] (::typeof(∂(#_#83)))(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [38] (::Zygote.var"#208#209"{Tuple{Tuple{Nothing, Nothing}, Tuple{Nothing}}, typeof(∂(#_#83))})(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/lib.jl:207 [39] #1750#back @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined] [40] Pullback @ ./operators.jl:1085 [inlined] [41] (::typeof(∂(λ)))(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:0 [42] (::Zygote.var"#52#53"{typeof(∂(λ))})(Δ::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/interface.jl:41 [43] withjacobian(f::Function, args::Vector{Float64}) @ Zygote ~/.julia/packages/Zygote/DkIUK/src/lib/grad.jl:162 [44] jacobian @ ~/.julia/packages/Zygote/DkIUK/src/lib/grad.jl:140 [inlined] [45] get_ipopt_problem(obj::NonconvexCore.CountingFunction{NonconvexCore.Objective{NonconvexCore.var"#133#140"{DictModel, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Base.RefValue{Float64}, Set{Symbol}}}, ineq_constr::Nothing, eq_constr::NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{NonconvexUtils.var"#90#95"{NonconvexUtils.SymbolicFunction{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{FunctionWrapper{var"#22#24", Int64}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{Any, Any}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}, NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing, Vector{Float64}}}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}}}, x0::Vector{Float64}, xlb::Vector{Float64}, xub::Vector{Float64}, first_order::Bool, linear::Bool) @ NonconvexIpopt ~/.julia/packages/NonconvexIpopt/jkxtN/src/ipopt.jl:110 [46] get_ipopt_problem(model::NonconvexCore.VecModel{NonconvexCore.Objective{NonconvexCore.var"#133#140"{DictModel, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Base.RefValue{Float64}, Set{Symbol}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{NonconvexUtils.var"#90#95"{NonconvexUtils.SymbolicFunction{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{FunctionWrapper{var"#22#24", Int64}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{Any, Any}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}, NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing, Vector{Float64}}}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.IneqConstraint}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.SDConstraint}}, Vector{Float64}, Vector{Float64}, Vector{Float64}}, x0::Vector{Float64}, first_order::Bool, linear::Bool) @ NonconvexIpopt ~/.julia/packages/NonconvexIpopt/jkxtN/src/ipopt.jl:86 [47] NonconvexIpopt.IpoptWorkspace(model::NonconvexCore.VecModel{NonconvexCore.Objective{NonconvexCore.var"#133#140"{DictModel, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Base.RefValue{Float64}, Set{Symbol}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{NonconvexUtils.var"#90#95"{NonconvexUtils.SymbolicFunction{NonconvexCore.EqConstraint{NonconvexCore.var"#135#142"{NonconvexCore.EqConstraint{FunctionWrapper{var"#22#24", Int64}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{Any, Any}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}, NonconvexUtils.var"#55#62"{NonconvexUtils.var"#53#60"{DataType}}, Nothing, Vector{Float64}}}, Float64, Int64, Set{Symbol}}, NonconvexCore.Unflatten{OrderedDict{String, Float64}, NonconvexCore.var"#unflatten_to_Dict#64"{typeof(identity), OrderedDict{String, Float64}}}}, Float64, Int64, Set{Symbol}}}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.IneqConstraint}}, NonconvexCore.VectorOfFunctions{Vector{NonconvexCore.SDConstraint}}, Vector{Float64}, Vector{Float64}, Vector{Float64}}, x0::Vector{Float64}; options::IpoptOptions{NamedTuple{(:hessian_approximation, :jac_c_constant, :jac_d_constant), Tuple{String, String, String}}}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ NonconvexIpopt ~/.julia/packages/NonconvexIpopt/jkxtN/src/ipopt.jl:29 [48] #Workspace#5 @ ~/.julia/packages/NonconvexIpopt/jkxtN/src/ipopt.jl:71 [inlined] [49] #optimize#131 @ ~/.julia/packages/NonconvexCore/uZAVo/src/models/vec_model.jl:62 [inlined] [50] optimize(::DictModel, ::IpoptAlg, ::OrderedDict{String, Float64}; kwargs::Base.Pairs{Symbol, IpoptOptions{NamedTuple{(:hessian_approximation, :jac_c_constant, :jac_d_constant), Tuple{String, String, String}}}, Tuple{Symbol}, NamedTuple{(:options,), Tuple{IpoptOptions{NamedTuple{(:hessian_approximation, :jac_c_constant, :jac_d_constant), Tuple{String, String, String}}}}}}) @ NonconvexCore ~/.julia/packages/NonconvexCore/uZAVo/src/common.jl:233 [51] main() @ Main ./REPL[27]:6
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I didn't dig deep, I just
grep
edeval
and foundhttps://github.com/JuliaNonconvex/NonconvexUtils.jl/blob/710d57ff61ee2f94cea9558b2c4d5fb127da7efa/src/symbolic.jl#L23-L39
You likely need
build_function(; epression = Val(false))
like we do here https://github.com/odow/SymbolicAD.jl/blob/bae8b1e042841b80fef5606b71e13e1d30255df2/src/nonlinear_oracle.jl#L230.Docs: https://symbolics.juliasymbolics.org/dev/manual/build_function/
The text was updated successfully, but these errors were encountered: