Optim.jl and Fminbox errors


I’m having trouble getting Optim.jl’s box minimization to work. From the example in the docs the error I get is here:

julia> od = OnceDifferentiable(f, g!, initial_x)
ERROR: MethodError: Cannot `convert` an object of type Array{Float64,1} to an object of type Function
 [1] Optim.OnceDifferentiable(::Function, ::Function, ::Array{Float64,1}) at /Users/me/.julia/v0.6/Optim/src/types.jl:101

If I delete the initial_x there (although issue 449 says I need it?) then I get different errors:

julia> od = OnceDifferentiable(f, g!)#, initial_x)
Optim.OnceDifferentiable(f, g!, Optim.fg!)

julia> results = Optim.optimize(od, initial_x, lower, upper, Fminbox{GradientDescent}())
ERROR: TypeError: Type{...} expression: expected UnionAll, got Type{Optim.Fminbox}

Am I doing something wrong or is this a bug?

I have just run Pkg.update() and am on Julia 0.6.0.


It all works fine with me. Please post a complete code snippet that generates the error.


OK I think I found the problem! I was stuck on Optim v0.7.8, because of ReverseDiff:

julia> Pkg.add("Optim.jl")
INFO: Installing LineSearches v0.1.5
INFO: Installing Optim v0.7.8
INFO: Installing PositiveFactorizations v0.0.4
INFO: Package database updated

julia> Pkg.pin("Optim", v"0.9.3")
INFO: Creating Optim branch pinned.c4e0116a.tmp
ERROR: Unsatisfiable requirements detected for package ForwardDiff:
├─version range [0.5.0,∞) required by package Optim, whose only allowed version is 0.9.3:
│ ├─version 0.9.3 set by fixed requirement (package is checked out, dirty or pinned)
│ └─version range [0.0.0-,∞) set by an explicit requirement
└─version range [0.3.2,0.5.0) required by package ReverseDiff, whose allowed version range is [0.0.0-,∞):
  └─version range [0.0.0-,∞) set by an explicit requirement
The intersection of the requirements is empty.

After Pkg.rm("ReverseDiff") I could upgrade, and now it works.