JuMP Unable to register the function

Hi @jgr, I’ve moved this to the optimisation section.

At a guess (I can’t run your code so I can’t confirm), you need params::Vector{<:Real} instead of params::Vector{Real}. The distinction is subtle, see:

julia> x = [1.0, 2.0]
2-element Vector{Float64}:
 1.0
 2.0

julia> x isa Vector{Real}
false

julia> x isa Vector{<:Real}
true

If that doesn’t work, you need to ensure that your function can be differentiated with ForwardDiff.jl.

I’d also encourage you to adopt the newer syntax for nonlinear modelling: Nonlinear Modeling · JuMP

For details, see ANN: JuMP v1.15 is released

1 Like