Hi Tim,
Good that you asked for the backtrace, I did indeed miss a line;
specifically, the issue arises in Optim\src\brent.jl:117
You're also right that my question gets increasingly specific and hard to
answer, so I've put together a minimum working example
that does what I'm trying to do in my original code and reproduces the
issue:
using Distributions
using Optim
z1 = 1.7
z2 = 0.1
z3 = 1.9
z4 = 0.1
z5 = 0.2
z6 = 40
stdz = 0.22
coeffz = rand(7,1)
expz1 = LogNormal(2, 0.3)
expand(x, z1, z2, z3, z4, z5, z6) = [x^2, z1^2, z2^2, z3^2, z4^2, z5^2,
z6^2]
function f2(x, z1=z1, z2=z2, z3=z3, z4=z4, z5=z5, z6=z6)
z1_l = z1 - 3*stdz
z1_h = z1 + 3*stdz
f(z1) = expand(x, z1, z2, z3, z4, z5, z6)'*coeffz*pdf(expz1, z1)
quadgk(f, z1_l, z1_h)[1]
end
> f2(5)
1x1 Array{Float64,2}:
0.0683061
> optimize(f2, 0, 2)
`isless` has no method matching isless(::Array{Float64,2}, ::Array{Float64,2})
while loading In[4], in expression starting on line 1
in <= at operators.jl:34
in brent at C:\Users\tew207\.julia\v0.3\Optim\src\brent.jl:117
Let me know if this works for you in producing the same output!