The issue is that in lbfgsb.jl’s
function SciMLBase.__solve(cache::OptimizationCache{...}) where {...}
...
maxiters = Optimization._check_and_convert_maxiters(cache.solver_args.maxiters)
...
for i in 1:maxiters
...
end
end
maxiters is set to nothing (which is also cache.solver_args.maxiters). The range in the for loop then becomes 1:nothing (a.k.a. Colon()(1, nothing)), which is not defined.
I’m not familiar enough with Optimization.jl to be certain, but this sounds like a bug to me, so you might want to open an issue on GitHub. In any case, if you explicitly supply the keyword argument maxiters to solve, the code does run.
julia> solve(opt_problem, Optimization.LBFGS(), maxiters=1000)
retcode: MaxIters
u: 16-element Vector{Float64}:
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
100000.0
1000.0
1.0