我正在尝试从MultivariatePolynomials导入函数的输出,并将其作为函数用于JuMp。以下是相关代码,它是NL方程的大型系统的一部分。
using JuMP
using MultivariatePolynomials
@polyvar k s θ_1k θ_2k θ_3k θ_4k θ_5k θ_6k θ_7k θ_8k θ_9k θ_10k θ_11k θ_12k θ_13k E ρ
d=....
j_11=subs(d,k=>q11(θ_1k,θ_2k,θ_3k,θ_4k,θ_5k,θ_6k,θ_7k,θ_8k,θ_9k),s=>f(s,ρ,E))
c_11=subs(j_11, k=>-0.7071067811865476,s=>0)
function v11(θ_1k,θ_2k,θ_3k,θ_4k,θ_5k,θ_6k,θ_7k,θ_8k,θ_9k,ρ,E)
c_11
end
m=Model(solver=IpoptSolver())
JuMP.register(m, :v11, 27, v11, autodiff=true)
@NLconstraint(m,cons1, ((v11(θ_1k,θ_2k,θ_3k,θ_4k,θ_5k,θ_6k,θ_7k,θ_8k,θ_9k,θ_10k,θ_11k,θ_12k,θ_13k,ρ, E))*w_1+*β*(1-δ+...
solve(m)
status=solve(m)
我收到以下错误:
MethodError: no method matching parseNLExpr_runtime(::JuMP.Model, ::DynamicPolynomials.PolyVar{true}, ::Array{ReverseDiffSparse.NodeData,1}, ::Int64, ::Array{Float64,1})
Closest candidates are:
parseNLExpr_runtime(::JuMP.Model, ::Number, ::Any, ::Any, ::Any) at C:\Users\s1364322\.julia\v0.6\JuMP\src\parsenlp.jl:196
parseNLExpr_runtime(::JuMP.Model, ::JuMP.Variable, ::Any, ::Any, ::Any) at C:\Users\s1364322\.julia\v0.6\JuMP\src\parsenlp.jl:202
似乎输出c_11
尚未转换为多变量函数类型,因为我尝试定义函数v11
,但仍保留为多项式类型。我该如何解决这个问题?
拜托,我非常感谢你的帮助