I am trying to optimize a function with respect to 3 variables using the optimize function of Optim.jl. I am using NelderMead as my objective does not have a gradient and the Fminbox method as I know the lower and upper bounds. The chunk of code looks like this:
lower_bound = [0.93,0.01,1.0001]
upper_bound = [0.999,1.0,1.05]
init_val = [0.99,0.15,1.005]
result = optimize(moments_norm, lower_bound, upper_bound, init_val, Fminbox(NelderMead()))
It gives me the error:
MethodError: no method matching +(::Float64, ::Array{Float64,1})
Closest candidates are:
+(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:529
+(::Float64, !Matched::Float64) at float.jl:401
+(::AbstractFloat, !Matched::Bool) at bool.jl:106
...
Note that moment_norm is the nontrivial objective function that yields an expression similar as ax+by+cz with (a,b,c) constant and (x,y,z) moments that depend on the variables I optimize over.
A previous version of my code worked perfectly fine when I only optimized over 2 variables instead of 3.