We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This code which is
fmax = x->-f(x) gmax = (G,x)->(g(G,x); G.=-G) hmax = (H,x)->(h(G,x); H.=-H) MaximizationWrapper(optimize(fmax, gmax, hmax, x0, method, options; kwargs...)) end
has a typo in the Hessian.
In case you need to reproduce, this works:
f(x) = -(1.0 - x[1])^2 - 100.0 * (x[2] - x[1]^2)^2 function g!(G, x) G[1] = -1*(-2.0 * (1.0 - x[1]) - 400.0 * (x[2] - x[1]^2) * x[1]) G[2] = -200.0 * (x[2] - x[1]^2) end function H!(H, x) H[1, 1] = -2.0 + 800.0 * x[1]^2 + 400.0 * x[2] H[1, 2] = 400.0 * x[1] H[2, 1] = 400.0 * x[1] H[2, 2] = -200.0 end x0 = [0.0, 0.0] soln = maximize(f, g!, H!, x0, Newton())
throws the following error
julia> soln = maximize(f, g!, H!, x0, Newton()) ERROR: UndefVarError: `G` not defined Stacktrace: [1] (::Optim.var"#147#150"{typeof(H!)})(H::Matrix{Float64}, x::Vector{Float64}) @ Optim ~/.julia/packages/Optim/ZhuZN/src/maximize.jl:41 [2] hessian!!(obj::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64}) @ NLSolversBase ~/.julia/packages/NLSolversBase/kavn7/src/interface.jl:95 [3] initial_state(method::Newton{…}, options::Optim.Options{…}, d::TwiceDifferentiable{…}, initial_x::Vector{…}) @ Optim ~/.julia/packages/Optim/ZhuZN/src/multivariate/solvers/second_order/newton.jl:46 [4] optimize @ ~/.julia/packages/Optim/ZhuZN/src/multivariate/optimize/optimize.jl:36 [inlined] [5] #optimize#94 @ ~/.julia/packages/Optim/ZhuZN/src/multivariate/optimize/interface.jl:163 [inlined] [6] optimize @ ~/.julia/packages/Optim/ZhuZN/src/multivariate/optimize/interface.jl:158 [inlined] [7] maximize(f::var"#52#53", g::typeof(g!), h::typeof(H!), x0::Vector{…}, method::Newton{…}, options::Optim.Options{…}; kwargs::@Kwargs{}) @ Optim ~/.julia/packages/Optim/ZhuZN/src/maximize.jl:42 [8] maximize(f::Function, g::Function, h::Function, x0::Vector{…}, method::Newton{…}, options::Optim.Options{…}) @ Optim ~/.julia/packages/Optim/ZhuZN/src/maximize.jl:38 [9] maximize @ ~/.julia/packages/Optim/ZhuZN/src/maximize.jl:38 [inlined] [10] maximize(f::Function, g::Function, h::Function, x0::Vector{…}, method::Newton{…}) @ TechnicalCompute ~/Dropbox/dev/TechnicalCompute/src/overrides.jl:1747 [11] top-level scope @ REPL[889]:1 Some type information was truncated. Use `show(err)` to see complete types.
The text was updated successfully, but these errors were encountered:
Oh, interesting. Thank you
Edit: seems like only the maximize(f, x, ...) methods were tested.
maximize(f, x, ...)
Sorry, something went wrong.
The fix is on master. I'll release soon.
Thanks for handling it so promptly!!
No branches or pull requests
This code which is
has a typo in the Hessian.
In case you need to reproduce, this works:
throws the following error
The text was updated successfully, but these errors were encountered: