{"action":"created","comment":{"url":"https://api.github.com/repos/gonum/optimize/pulls/comments/50069511","id":50069511,"diff_hunk":"@@ -0,0 +1,129 @@\n+// Copyright ©2015 The gonum Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package optimize\n+\n+import (\n+\t\"fmt\"\n+\t\"math\"\n+\t\"reflect\"\n+\t\"testing\"\n+\n+\t\"github.com/gonum/optimize/functions\"\n+)\n+\n+func TestMoreThuente(t *testing.T) {\n+\td := 0.001\n+\tc := 0.001\n+\tls := &MoreThuente{\n+\t\tDecreaseFactor:  d,\n+\t\tCurvatureFactor: c,\n+\t}\n+\ttestLinesearcher(ls, d, c, true, t)\n+}\n+\n+func TestBisection(t *testing.T) {\n+\tc := 0.1\n+\tls := &Bisection{\n+\t\tGradConst: c,\n+\t}\n+\ttestLinesearcher(ls, 0, c, true, t)\n+}\n+\n+func TestBacktracking(t *testing.T) {\n+\td := 0.001\n+\tls := &Backtracking{\n+\t\tFuncConst: d,\n+\t}\n+\ttestLinesearcher(ls, d, 0, false, t)\n+}\n+\n+type funcGrader interface {\n+\tFunc([]float64) float64\n+\tGrad([]float64, []float64)\n+}\n+\n+type linesearcherTest struct {\n+\tname string\n+\tf    func(float64) float64\n+\tg    func(float64) float64\n+}\n+\n+func newLinesearcherTest(name string, fg funcGrader) linesearcherTest {\n+\tgrad := make([]float64, 1)\n+\treturn linesearcherTest{\n+\t\tname: name,\n+\t\tf: func(x float64) float64 {\n+\t\t\treturn fg.Func([]float64{x})\n+\t\t},\n+\t\tg: func(x float64) float64 {\n+\t\t\tfg.Grad(grad, []float64{x})\n+\t\t\treturn grad[0]\n+\t\t},\n+\t}\n+}\n+\n+func testLinesearcher(ls Linesearcher, decrease, curvature float64, strongWolfe bool, t *testing.T) {\n+\tfor i, prob := range []linesearcherTest{\n+\t\tnewLinesearcherTest(\"Concave-to-the-right function\", functions.ConcaveRight{}),\n+\t\tnewLinesearcherTest(\"Concave-to-the-left function\", functions.ConcaveLeft{}),\n+\t\tnewLinesearcherTest(\"Plassmann wiggly function (l=39, beta=0.01)\", functions.Plassmann{39, 0.01}),\n+\t\tnewLinesearcherTest(\"Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.001)\", functions.YanaiOzawaKaneko{0.001, 0.001}),\n+\t\tnewLinesearcherTest(\"Yanai-Ozawa-Kaneko function (beta1=0.01, beta2=0.001)\", functions.YanaiOzawaKaneko{0.01, 0.001}),\n+\t\tnewLinesearcherTest(\"Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.01)\", functions.YanaiOzawaKaneko{0.001, 0.01}),\n+\t} {\n+\t\tfor _, initStep := range []float64{0.001, 0.1, 1, 10, 1000} {\n+\t\t\tf0 := prob.f(0)\n+\t\t\tg0 := prob.g(0)\n+\t\t\tif g0 >= 0 {\n+\t\t\t\tpanic(\"bad test function\")\n+\t\t\t}\n+\n+\t\t\top := ls.Init(f0, g0, initStep)\n+\n+\t\t\tvar (\n+\t\t\t\terr  error\n+\t\t\t\tk    int\n+\t\t\t\tf, g float64\n+\t\t\t\tstep float64\n+\t\t\t)\n+\t\tloop:","path":"linesearcher_test.go","position":91,"original_position":91,"commit_id":"738663acbb2b1cd510d62e73535269a516ffc5fd","original_commit_id":"738663acbb2b1cd510d62e73535269a516ffc5fd","user":{"login":"btracey","id":3680859,"avatar_url":"https://avatars.githubusercontent.com/u/3680859?v=3","gravatar_id":"","url":"https://api.github.com/users/btracey","html_url":"https://github.com/btracey","followers_url":"https://api.github.com/users/btracey/followers","following_url":"https://api.github.com/users/btracey/following{/other_user}","gists_url":"https://api.github.com/users/btracey/gists{/gist_id}","starred_url":"https://api.github.com/users/btracey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btracey/subscriptions","organizations_url":"https://api.github.com/users/btracey/orgs","repos_url":"https://api.github.com/users/btracey/repos","events_url":"https://api.github.com/users/btracey/events{/privacy}","received_events_url":"https://api.github.com/users/btracey/received_events","type":"User","site_admin":false},"body":"This is good for now though until we know how that design should be. Maybe just a \"TODO\"","created_at":"2016-01-19T03:32:02Z","updated_at":"2016-01-19T03:32:02Z","html_url":"https://github.com/gonum/optimize/pull/148#discussion_r50069511","pull_request_url":"https://api.github.com/repos/gonum/optimize/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/gonum/optimize/pulls/comments/50069511"},"html":{"href":"https://github.com/gonum/optimize/pull/148#discussion_r50069511"},"pull_request":{"href":"https://api.github.com/repos/gonum/optimize/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/gonum/optimize/pulls/148","id":50203364,"html_url":"https://github.com/gonum/optimize/pull/148","diff_url":"https://github.com/gonum/optimize/pull/148.diff","patch_url":"https://github.com/gonum/optimize/pull/148.patch","issue_url":"https://api.github.com/repos/gonum/optimize/issues/148","number":148,"state":"open","locked":false,"title":"Add MoreThuente Linesearcher","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":"I like the names DecreaseFactor and CurvatureFactor. I would vote for using them also in the other Linesearchers.\r\n\r\nAs I mentioned before, CG is the method that most benefits from this Linesearcher, so I set it as the default. Maybe we should remake the CG tests, there are already many combinations and the Linesearchers add an extra dimension.\r\n\r\nPTAL @btracey ","created_at":"2015-11-10T01:33:25Z","updated_at":"2016-01-19T03:32:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4beaaf322c106f294a073d6ec01d6c4ed5cf9e6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gonum/optimize/pulls/148/commits","review_comments_url":"https://api.github.com/repos/gonum/optimize/pulls/148/comments","review_comment_url":"https://api.github.com/repos/gonum/optimize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gonum/optimize/issues/148/comments","statuses_url":"https://api.github.com/repos/gonum/optimize/statuses/738663acbb2b1cd510d62e73535269a516ffc5fd","head":{"label":"gonum:morethuente","ref":"morethuente","sha":"738663acbb2b1cd510d62e73535269a516ffc5fd","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":"2016-01-15T21:01:37Z","pushed_at":"2016-01-19T01:31:06Z","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":453,"stargazers_count":28,"watchers_count":28,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":13,"forks":8,"open_issues":13,"watchers":28,"default_branch":"master"}},"base":{"label":"gonum:master","ref":"master","sha":"24ec818cf9cf485498160f62ca2659cda1cb2aa2","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":"2016-01-15T21:01:37Z","pushed_at":"2016-01-19T01:31:06Z","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":453,"stargazers_count":28,"watchers_count":28,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":13,"forks":8,"open_issues":13,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gonum/optimize/pulls/148"},"html":{"href":"https://github.com/gonum/optimize/pull/148"},"issue":{"href":"https://api.github.com/repos/gonum/optimize/issues/148"},"comments":{"href":"https://api.github.com/repos/gonum/optimize/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/gonum/optimize/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/gonum/optimize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gonum/optimize/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/gonum/optimize/statuses/738663acbb2b1cd510d62e73535269a516ffc5fd"}}}}