aaowens / StaticOptim.jl

Other
23 stars 0 forks source link

0.7 #13

Closed chriselrod closed 6 years ago

chriselrod commented 6 years ago

This PR gets rid of the remaining dep warnings. Before:

julia> @btime soptimize(rosenbrock, $sx)
WARNING: importing deprecated binding Base.norm into StaticOptim.
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: importing deprecated binding Base.dot into StaticOptim.
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.dot is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
WARNING: Base.norm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module StaticOptim
┌ Warning: `ones(A::StaticArray)` is deprecated, use `ones(typeof(A))` instead.
│   caller = soptimize(::typeof(rosenbrock), ::SArray{Tuple{2},Float64,1,2}, ::StaticOptim.Order3, ::Nothing) at soptimize.jl:37
└ @ StaticOptim ~/.julia/dev/StaticOptim/src/soptimize.jl:37
┌ Warning: `diagm(v::StaticVector, k::Type{Val{D}}=Val{0}) where D` is deprecated, use `diagm(k() => v)` instead.
│   caller = diagm(::SArray{Tuple{2},Float64,1,2}) at deprecated.jl:54
└ @ StaticArrays ./deprecated.jl:54
  108.935 μs (201 allocations: 24.23 KiB)
Results of Static Optimization Algorithm
 * Minimizer: [1.00000000000079,1.0000000000014035]
 * Minimum: [3.7402786691745805e-24]
 * |Df(x)|: [7.219025377486226e-11]
 * Hf(x): [809.094042962608,-403.46938387131536,-403.4693838713215,201.6967228908349]
 * Number of iterations: [58]
 * Converged: [true]

After:

julia> @btime soptimize(rosenbrock, $sx)
  2.677 μs (0 allocations: 0 bytes)
Results of Static Optimization Algorithm
 * Minimizer: [1.00000000000079,1.0000000000014035]
 * Minimum: [3.7402786691745805e-24]
 * |Df(x)|: [7.219025377486226e-11]
 * Hf(x): [809.094042962608,-403.46938387131536,-403.4693838713215,201.6967228908349]
 * Number of iterations: [58]
 * Converged: [true]
chriselrod commented 6 years ago

I see fix07 is 8 commits behind master. This PR is on top of those. Want me to close this and have the PR target master instead?

aaowens commented 6 years ago

Oh wow. I had forgotten I turned off deprecation warnings in Juno, so I didn't realize I had any. Yes, please target master.

chriselrod commented 6 years ago

Okay, now targeting master.

No worries. I made a previous effort to speed up Optim, but never got close to 3 microseconds on rosenbrock!

aaowens commented 6 years ago

Looks good, thanks! It is probably the relatively new stack allocated gradients in ForwardDiff.