{"action":"created","comment":{"url":"https://api.github.com/repos/gonum/optimize/pulls/comments/39820629","id":39820629,"diff_hunk":"@@ -246,60 +272,64 @@ func getStartingLocation(p *Problem, method Method, initX []float64, stats *Stat\n \t\t\tloc.Hessian.CopySym(initH)\n \t\t}\n \t} else {\n-\t\tevalType = FuncEvaluation\n+\t\teval := FuncEvaluation\n \t\tif loc.Gradient != nil {\n-\t\t\tevalType |= GradEvaluation\n+\t\t\teval |= GradEvaluation\n \t\t}\n \t\tif loc.Hessian != nil {\n-\t\t\tevalType |= HessEvaluation\n+\t\t\teval |= HessEvaluation\n \t\t}\n-\t\tevaluate(p, evalType, loc.X, loc, stats)\n+\t\tevaluate(p, loc, eval, stats)\n \t}\n \n \tif math.IsNaN(loc.F) {\n-\t\treturn loc, evalType, ErrNaN\n+\t\treturn loc, ErrNaN\n \t}\n \tif math.IsInf(loc.F, 1) {\n-\t\treturn loc, evalType, ErrInf\n+\t\treturn loc, ErrInf\n \t}\n \tfor _, v := range loc.Gradient {\n \t\tif math.IsInf(v, 0) {\n-\t\t\treturn loc, evalType, ErrGradInf\n+\t\t\treturn loc, ErrGradInf\n \t\t}\n \t\tif math.IsNaN(v) {\n-\t\t\treturn loc, evalType, ErrGradNaN\n+\t\t\treturn loc, ErrGradNaN\n \t\t}\n \t}\n \n-\treturn loc, evalType, nil\n+\treturn loc, nil\n }\n \n-func checkConvergence(loc *Location, iterType IterationType, stats *Stats, settings *Settings) Status {\n-\tif iterType == MajorIteration || iterType == InitIteration {\n-\t\tif loc.Gradient != nil {\n-\t\t\tnorm := floats.Norm(loc.Gradient, math.Inf(1))\n-\t\t\tif norm < settings.GradientThreshold {\n-\t\t\t\treturn GradientThreshold\n-\t\t\t}\n-\t\t}\n-\t\tif loc.F < settings.FunctionThreshold {\n-\t\t\treturn FunctionThreshold\n+func checkConvergence(loc *Location, settings *Settings) Status {\n+\tif loc.Gradient != nil {\n+\t\tnorm := floats.Norm(loc.Gradient, math.Inf(1))\n+\t\tif norm < settings.GradientThreshold {\n+\t\t\treturn GradientThreshold\n \t\t}\n \t}\n \n-\tif iterType == MajorIteration && settings.FunctionConverge != nil {\n-\t\tstatus := settings.FunctionConverge.FunctionConverged(loc.F)\n-\t\tif status != NotTerminated {\n-\t\t\treturn status\n-\t\t}\n+\tif loc.F < settings.FunctionThreshold {\n+\t\treturn FunctionThreshold\n+\t}\n+\n+\tif settings.FunctionConverge != nil {\n+\t\treturn settings.FunctionConverge.FunctionConverged(loc.F)\n \t}\n \n+\treturn NotTerminated\n+}\n+\n+func checkLimits(loc *Location, stats *Stats, settings *Settings) Status {","path":"local.go","position":null,"original_position":289,"commit_id":"0cb4899a134f7da92c4bac5b02fb30e4d3e8173a","original_commit_id":"f351ca94fa2a52f58cd4c787524c9f44f1f2c2ad","user":{"login":"vladimir-ch","id":1837502,"avatar_url":"https://avatars.githubusercontent.com/u/1837502?v=3","gravatar_id":"","url":"https://api.github.com/users/vladimir-ch","html_url":"https://github.com/vladimir-ch","followers_url":"https://api.github.com/users/vladimir-ch/followers","following_url":"https://api.github.com/users/vladimir-ch/following{/other_user}","gists_url":"https://api.github.com/users/vladimir-ch/gists{/gist_id}","starred_url":"https://api.github.com/users/vladimir-ch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladimir-ch/subscriptions","organizations_url":"https://api.github.com/users/vladimir-ch/orgs","repos_url":"https://api.github.com/users/vladimir-ch/repos","events_url":"https://api.github.com/users/vladimir-ch/events{/privacy}","received_events_url":"https://api.github.com/users/vladimir-ch/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-09-18T02:57:33Z","updated_at":"2015-09-18T02:57:33Z","html_url":"https://github.com/gonum/optimize/pull/123#discussion_r39820629","pull_request_url":"https://api.github.com/repos/gonum/optimize/pulls/123","_links":{"self":{"href":"https://api.github.com/repos/gonum/optimize/pulls/comments/39820629"},"html":{"href":"https://github.com/gonum/optimize/pull/123#discussion_r39820629"},"pull_request":{"href":"https://api.github.com/repos/gonum/optimize/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/gonum/optimize/pulls/123","id":44926498,"html_url":"https://github.com/gonum/optimize/pull/123","diff_url":"https://github.com/gonum/optimize/pull/123.diff","patch_url":"https://github.com/gonum/optimize/pull/123.patch","issue_url":"https://api.github.com/repos/gonum/optimize/issues/123","number":123,"state":"open","locked":false,"title":"Merge IterationType and EvaluationType, simplify Method interface","user":{"login":"vladimir-ch","id":1837502,"avatar_url":"https://avatars.githubusercontent.com/u/1837502?v=3","gravatar_id":"","url":"https://api.github.com/users/vladimir-ch","html_url":"https://github.com/vladimir-ch","followers_url":"https://api.github.com/users/vladimir-ch/followers","following_url":"https://api.github.com/users/vladimir-ch/following{/other_user}","gists_url":"https://api.github.com/users/vladimir-ch/gists{/gist_id}","starred_url":"https://api.github.com/users/vladimir-ch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladimir-ch/subscriptions","organizations_url":"https://api.github.com/users/vladimir-ch/orgs","repos_url":"https://api.github.com/users/vladimir-ch/repos","events_url":"https://api.github.com/users/vladimir-ch/events{/privacy}","received_events_url":"https://api.github.com/users/vladimir-ch/received_events","type":"User","site_admin":false},"body":"A proposal for resolving #103 ~~but still work in progress~~.\r\n\r\n* Merged `IterationType` and `EvaluationType` into ~~`RequestType`~~ `Operation`.\r\n* Simplified `Method` interface. It can't be any simpler than this, so if this PR is accepted, further changes are very unlikely.\r\n* The above two modifications ripple through the code and lead at some places to essentially a complete rewrite, most importantly in `LinesearchMethod` and `minimize()`. But the issue at hand is solved, and the code is now much cleaner and more correct. I am ~~quite~~ very happy with the changes (if nobody praises you, you must praise yourself).\r\n* Updated docs, especially for `Method` and `Operation`, although while at it, I updated the docs also at other places, which, as a by-product, resolves issues #29 and #96.\r\n\r\n@kortschak @btracey Please take a look.","created_at":"2015-09-14T12:57:37Z","updated_at":"2015-09-18T02:57:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2bfbeac3946481441f9aa1218926be13d07f33ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gonum/optimize/pulls/123/commits","review_comments_url":"https://api.github.com/repos/gonum/optimize/pulls/123/comments","review_comment_url":"https://api.github.com/repos/gonum/optimize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gonum/optimize/issues/123/comments","statuses_url":"https://api.github.com/repos/gonum/optimize/statuses/0cb4899a134f7da92c4bac5b02fb30e4d3e8173a","head":{"label":"gonum:remove-evaluationtype","ref":"remove-evaluationtype","sha":"0cb4899a134f7da92c4bac5b02fb30e4d3e8173a","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":24917465,"name":"optimize","full_name":"gonum/optimize","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/optimize","description":"Package for finding the optimum value of functions.","fork":false,"url":"https://api.github.com/repos/gonum/optimize","forks_url":"https://api.github.com/repos/gonum/optimize/forks","keys_url":"https://api.github.com/repos/gonum/optimize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/optimize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/optimize/teams","hooks_url":"https://api.github.com/repos/gonum/optimize/hooks","issue_events_url":"https://api.github.com/repos/gonum/optimize/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/optimize/events","assignees_url":"https://api.github.com/repos/gonum/optimize/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/optimize/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/optimize/tags","blobs_url":"https://api.github.com/repos/gonum/optimize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/optimize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/optimize/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/optimize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/optimize/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/optimize/languages","stargazers_url":"https://api.github.com/repos/gonum/optimize/stargazers","contributors_url":"https://api.github.com/repos/gonum/optimize/contributors","subscribers_url":"https://api.github.com/repos/gonum/optimize/subscribers","subscription_url":"https://api.github.com/repos/gonum/optimize/subscription","commits_url":"https://api.github.com/repos/gonum/optimize/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/optimize/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/optimize/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/optimize/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/optimize/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/optimize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/optimize/merges","archive_url":"https://api.github.com/repos/gonum/optimize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/optimize/downloads","issues_url":"https://api.github.com/repos/gonum/optimize/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/optimize/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/optimize/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/optimize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/optimize/labels{/name}","releases_url":"https://api.github.com/repos/gonum/optimize/releases{/id}","created_at":"2014-10-08T00:14:50Z","updated_at":"2015-08-02T02:45:34Z","pushed_at":"2015-09-18T02:53:39Z","git_url":"git://github.com/gonum/optimize.git","ssh_url":"git@github.com:gonum/optimize.git","clone_url":"https://github.com/gonum/optimize.git","svn_url":"https://github.com/gonum/optimize","homepage":null,"size":1549,"stargazers_count":24,"watchers_count":24,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":24,"default_branch":"master"}},"base":{"label":"gonum:master","ref":"master","sha":"0c9c65747b35b06fb1ed5f1f6113c3c63845aeb5","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":24917465,"name":"optimize","full_name":"gonum/optimize","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/optimize","description":"Package for finding the optimum value of functions.","fork":false,"url":"https://api.github.com/repos/gonum/optimize","forks_url":"https://api.github.com/repos/gonum/optimize/forks","keys_url":"https://api.github.com/repos/gonum/optimize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/optimize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/optimize/teams","hooks_url":"https://api.github.com/repos/gonum/optimize/hooks","issue_events_url":"https://api.github.com/repos/gonum/optimize/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/optimize/events","assignees_url":"https://api.github.com/repos/gonum/optimize/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/optimize/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/optimize/tags","blobs_url":"https://api.github.com/repos/gonum/optimize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/optimize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/optimize/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/optimize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/optimize/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/optimize/languages","stargazers_url":"https://api.github.com/repos/gonum/optimize/stargazers","contributors_url":"https://api.github.com/repos/gonum/optimize/contributors","subscribers_url":"https://api.github.com/repos/gonum/optimize/subscribers","subscription_url":"https://api.github.com/repos/gonum/optimize/subscription","commits_url":"https://api.github.com/repos/gonum/optimize/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/optimize/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/optimize/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/optimize/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/optimize/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/optimize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/optimize/merges","archive_url":"https://api.github.com/repos/gonum/optimize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/optimize/downloads","issues_url":"https://api.github.com/repos/gonum/optimize/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/optimize/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/optimize/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/optimize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/optimize/labels{/name}","releases_url":"https://api.github.com/repos/gonum/optimize/releases{/id}","created_at":"2014-10-08T00:14:50Z","updated_at":"2015-08-02T02:45:34Z","pushed_at":"2015-09-18T02:53:39Z","git_url":"git://github.com/gonum/optimize.git","ssh_url":"git@github.com:gonum/optimize.git","clone_url":"https://github.com/gonum/optimize.git","svn_url":"https://github.com/gonum/optimize","homepage":null,"size":1549,"stargazers_count":24,"watchers_count":24,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gonum/optimize/pulls/123"},"html":{"href":"https://github.com/gonum/optimize/pull/123"},"issue":{"href":"https://api.github.com/repos/gonum/optimize/issues/123"},"comments":{"href":"https://api.github.com/repos/gonum/optimize/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/gonum/optimize/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/gonum/optimize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gonum/optimize/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/gonum/optimize/statuses/0cb4899a134f7da92c4bac5b02fb30e4d3e8173a"}}}}