SAMIN Example in Optim.jl not working

From Simulated Annealing w/ bounds - Optim.jl

julia> using Optim, OptimTestProblems

julia> prob = OptimTestProblems.UnconstrainedProblems.examples["Rosenbrock"];

julia> res = Optim.optimize(prob.f, prob.initial_x,
               fill(-100.0, 2), fill(100.0, 2), SAMIN(), Optim.Options(iterations=20000))
ERROR: UndefVarError: SAMIN not defined

This works on my machine. Can you update and see if this is still a problem?

still a problem here even after a Pkg.update(). what version are you using? anything defined in your startup?

ipro@~/bitcookbook:0:525> julia

  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin14.5.0

julia> using Optim, OptimTestProblems

julia> prob = OptimTestProblems.UnconstrainedProblems.examples["Rosenbrock"];

julia> res = Optim.optimize(prob.f, prob.initial_x,
                      fill(-100.0, 2), fill(100.0, 2), SAMIN(), Optim.Options(iterations=20000))
ERROR: UndefVarError: SAMIN not defined

julia> Pkg.status.(["Optim", "OptimTestProblems"]);
 - Optim                         0.14.1
 - OptimTestProblems             1.2.0

I will double check, I am using a modified 0.12.0.

Edit: this was actually modified master.

Ok I can reproduce. If you checkout master, it works. Run Pkg.checkout("Optim"). You can also open an issue on Github.

Edit: I see now, the algorithm was implemented at a later stage after v0.14.0 so you can either wait for the next tag or checkout master. You are looking at the latest docs but these reflect what’s happening on master not the last tag. For that, you need the stable docs Optim.jl.

2 Likes

thank you, m. this solved my problem. I understand that master will soon replace the standard branch anyway, so presumably this will fix itself soon. so its probably only annoying to ping the folks who are in charge.

regards,

/iaw

SAMIN is a very recent algorithm introduced in Optim, so if you have some feedback related to it (and anything else in Optim), you can create an issue on Github (or ask here on discourse, or ask on gitter :wink: )

This is a bit subtle, but the documentation you are looking at is the “latest”, which corresponds to the latest master branch. The stable documentation is valid for the most recent release.

1 Like