First time using JuMP. Below is my JuMP specific code. I am getting very vague error when I try to solve the model and so I am not sure how to follow up. I’m not even sure how specific I should get:
m = Model(solver=NLoptSolver(algorithm=:LD_MMA)) JuMP.register(m, :f, 2, f, autodiff=true) @variable(m, lambda3) @variable(m, lambda4) setlowerbound(lambda3, -0.25) setlowerbound(lambda4, -0.25) @NLobjective(m, Min, f(lambda3, lambda4))
julia> solve(m) ERROR: StackOverflowError:
f is a user-defined function that is quite complicated, but I can certainly put it here if that is the next place to check.
Some suspicions i have:
f is a function defined within a function and references some variables that are in the scope of that function (its a closure, is that the correct term?). Could that be the issue? If so, how do I get around that?
f calls some other functions within it. Do they all have to be registered?
I might have narrowed it down to:
julia> f(ForwardDiff.Dual(1.2),ForwardDiff.Dual(3.4)) ERROR: StackOverflowError: julia> f(1.2,3.4) 4.688062610165983