Optim.jl Implementing box minimization does not work for me

Hi all,

I am trying to implement a box minimization, but am struggling to do so.

I am at the moment trying to run the line:

    results = optimize(x -> blp_iteration(dt, z, x, W, random_coeff, fixed_coeff,agents), init, lower, upper, Fminbox(BFGS()), Optim.Options(f_tol = 1e-40, x_tol = 1e-40, g_tol = 1e-40, iterations = 5000))

and have been using Minimizing a function - Optim.jl to figure it out. There, it suggests running Fminbox{BFGS}() which does not work at all for me. What I get is the error:

This error does not come, when I remove lower, upper, and Fminbox(). Then, it just manages to solve it.


Hi, what is the value of init, lower, upper ? my intuition says that you are passing integer values instead of float values

init = [0.4,0.4,0,0.4]
lower = [0,0,-10,-10]
upper = [10,10,10,10]

This is how they are defined. What fix would you suggest ?

try using:

lower = [0.0,0.0,-10.0,-10.0]
upper = [10.0,10.0,10.0,10.0]

u are right, it runs now. How did you know this?

Your lower and upper were arrays of Integers (because all initial values were Ints). The error was complaining about some operation failing for that.

You could also have used lower = Float64[0, 0, -10, -10]

1 Like