{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/70","repository_url":"https://api.github.com/repos/JuliaOpt/NLopt.jl","labels_url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/70/comments","events_url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/70/events","html_url":"https://github.com/JuliaOpt/NLopt.jl/issues/70","id":196150871,"number":70,"title":"Problems with LN_PRAXIS, GN_DIRECT and others...","user":{"login":"lruthotto","id":4249607,"avatar_url":"https://avatars.githubusercontent.com/u/4249607?v=3","gravatar_id":"","url":"https://api.github.com/users/lruthotto","html_url":"https://github.com/lruthotto","followers_url":"https://api.github.com/users/lruthotto/followers","following_url":"https://api.github.com/users/lruthotto/following{/other_user}","gists_url":"https://api.github.com/users/lruthotto/gists{/gist_id}","starred_url":"https://api.github.com/users/lruthotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lruthotto/subscriptions","organizations_url":"https://api.github.com/users/lruthotto/orgs","repos_url":"https://api.github.com/users/lruthotto/repos","events_url":"https://api.github.com/users/lruthotto/events{/privacy}","received_events_url":"https://api.github.com/users/lruthotto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-16T20:46:47Z","updated_at":"2017-01-19T04:01:52Z","closed_at":null,"body":"I've been experimenting with this package to compare some optimization methods (global/ local and with/without derivatives). I apologize if this is a dumb comment (since it's my first experience with NLopt), but I ran into some difficulties. \r\n\r\nMy first objective was to follow README.md and find a minimizer of the Himmelblau function. Here is what I tried:\r\n```julia\r\nusing NLopt\r\n\r\ncount = 0 # keep track of # function evaluations\r\n\r\nfunction Himmelblau(x::Vector,grad::Vector=[])\r\n    if !isempty(grad)&& length(grad)>0\r\n        grad[1] = 4*(x[1]^2+x[2]-11)*x[1]+2*(x[1]+x[2]^2-7)\r\n        grad[2] = 2*(x[1]^2+x[2]-11)+4*(x[1]+x[2]^2-7)*x[2]\r\n    end\r\n\r\n    global count\r\n    count::Int += 1\r\n    \r\n    (x[1]^2 +  x[2] - 11)^2 + (x[1] + x[2].^2 - 7).^2\r\nend\r\nopt = Opt(:GN_DIRECT, 2) # throws error\r\n# opt = Opt(:LD_MMA, 2) # works fine\r\n\r\nmin_objective!(opt, Himmelblau)\r\nx0 = [-0.1;-1]\r\n(minf,minx,ret) = NLopt.optimize(opt,x0)\r\n```\r\n\r\nrunning this code, I get the following error (that I have a hard time understanding):\r\n```\r\nLoadError: ArgumentError: invalid NLopt arguments\r\nwhile loading In[50], in expression starting on line 20\r\n\r\n in chk(::Int32) at ~/.julia/v0.5/NLopt/src/NLopt.jl:259\r\n in chks(::Int32) at ~/.julia/v0.5/NLopt/src/NLopt.jl:276\r\n in optimize!(::NLopt.Opt, ::Array{Float64,1}) at~/.julia/v0.5/NLopt/src/NLopt.jl:529\r\n in optimize(::NLopt.Opt, ::Array{Float64,1}) at ~/.julia/v0.5/NLopt/src/NLopt.jl:532\r\n```\r\nIs this a bug, or am I using NLopt incorrectly? If we get this to work, can I add this example (I have a longer ipynb with plots) to this repository? "},"comment":{"url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/comments/273676471","html_url":"https://github.com/JuliaOpt/NLopt.jl/issues/70#issuecomment-273676471","issue_url":"https://api.github.com/repos/JuliaOpt/NLopt.jl/issues/70","id":273676471,"user":{"login":"stevenjgilmore","id":8894716,"avatar_url":"https://avatars.githubusercontent.com/u/8894716?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenjgilmore","html_url":"https://github.com/stevenjgilmore","followers_url":"https://api.github.com/users/stevenjgilmore/followers","following_url":"https://api.github.com/users/stevenjgilmore/following{/other_user}","gists_url":"https://api.github.com/users/stevenjgilmore/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenjgilmore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenjgilmore/subscriptions","organizations_url":"https://api.github.com/users/stevenjgilmore/orgs","repos_url":"https://api.github.com/users/stevenjgilmore/repos","events_url":"https://api.github.com/users/stevenjgilmore/events{/privacy}","received_events_url":"https://api.github.com/users/stevenjgilmore/received_events","type":"User","site_admin":false},"created_at":"2017-01-19T04:01:52Z","updated_at":"2017-01-19T04:01:52Z","body":"According to the NLopt documentation [link](http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms#DIRECT_and_DIRECT-L): \r\n\"Most of the above algorithms only handle bound constraints, and in fact require finite bound constraints (they are not applicable to unconstrained problems).\"\r\n\r\nSo I would guess that you need to add constraints to your optimization. This README specifies how to do that, specifically:\r\n`lower_bounds!(opt::Opt, lb::AbstractVector)`\r\n`upper_bounds!(opt::Opt, ub::AbstractVector)` "}}
{"actor":{"display_login":"stevenjgilmore"}}