{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/comments/154802702","pull_request_review_id":81021158,"id":154802702,"diff_hunk":"@@ -445,16 +445,28 @@ and similarly, the dual is:\n \n An important note for the LP case is that the signs of the feasible duals depend only on the sense of the inequality and not on the objective sense.\n \n-\n-Currently, a convention for duals is not defined for problems with non-conic sets ``\\mathcal{S}_i`` or quadratic functions ``f_0, f_i``.\n-\n #### Duality and scalar product\n \n The scalar product is different from the canonical one for the sets [`PositiveSemidefiniteConeTriangle`](@ref MathOptInterface.PositiveSemidefiniteConeTriangle), [`LogDetConeTriangle`](@ref MathOptInterface.LogDetConeTriangle), [`RootDetConeTriangle`](@ref MathOptInterface.RootDetConeTriangle).\n If the set ``C_i`` of the section [Duals](@ref) is one of these three cones,\n then the rows of the matrix ``A_i`` corresponding to off-diagonal entries are twice the value of the `coefficients` field in the `VectorAffineFunction` for the corresponding rows.\n See [`PositiveSemidefiniteConeTriangle`](@ref MathOptInterface.PositiveSemidefiniteConeTriangle) for details.\n \n+#### Dual for convex problem with quadratic functions\n+\n+If ``Q`` is positive semidefinite, then the constraint ``x^TQx + a^Tx + b \\le 0`` can be rewritten as an equivalent SOC constraint ``\\lVert Ax + b\\rVert_2 \\le c^Tx + d`` which has a dual variable ``(s, y)`` constrained to satisfy ``\\lVert y \\rVert_2 \\leq s``.\n+We define the constraint value as ``x^TQx + a^Tx + b`` and the constraint dual as ``\\lVert y \\rVert_2 - s``.\n+Note that these scalar values are always nonpositive for feasible solutions and that complementary slackness holds, i.e. their product is always zero for an optimal primal-dual pair (indeed if two vectors in the second order cone are orthogonal then they are either both on the boundary or one of them is zero).\n+\n+Similarly, if ``Q`` is negative semidefinite, then the constraint ``x^TQx + a^Tx + b \\ge 0`` can be rewritten as an equivalent SOC constraint ``\\lVert Ax + b\\rVert_2 \\le c^Tx + d`` which has a dual variable ``(s, y)`` constrained to satisfy ``\\lVert y \\rVert_2 \\leq s``.\n+In this case, we define the constraint value as ``x^TQx + a^Tx + b`` and the constraint dual as ``s - \\lVert y \\rVert_2``.\n+Note that these scalar values are always nonnegative for feasible solutions and that complementary slackness holds.\n+\n+If the objective is a minimization of a convex quadratic function or the maximization of a concave quadratic function then it can be transformed into a linear objective and a second order cone constraint.","path":"docs/src/apimanual.md","position":24,"original_position":24,"commit_id":"9403f2e52368f59c91b5730dc290834e613d2b92","original_commit_id":"9403f2e52368f59c91b5730dc290834e613d2b92","user":{"login":"mlubin","id":1733683,"avatar_url":"https://avatars3.githubusercontent.com/u/1733683?v=4","gravatar_id":"","url":"https://api.github.com/users/mlubin","html_url":"https://github.com/mlubin","followers_url":"https://api.github.com/users/mlubin/followers","following_url":"https://api.github.com/users/mlubin/following{/other_user}","gists_url":"https://api.github.com/users/mlubin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlubin/subscriptions","organizations_url":"https://api.github.com/users/mlubin/orgs","repos_url":"https://api.github.com/users/mlubin/repos","events_url":"https://api.github.com/users/mlubin/events{/privacy}","received_events_url":"https://api.github.com/users/mlubin/received_events","type":"User","site_admin":false},"body":"Could you give an example with a QCQP, its canonical dual, and what duals MOI should report?","created_at":"2017-12-04T23:06:20Z","updated_at":"2017-12-04T23:06:20Z","html_url":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43#discussion_r154802702","pull_request_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/comments/154802702"},"html":{"href":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43#discussion_r154802702"},"pull_request":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43","id":130746058,"html_url":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43","diff_url":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43.diff","patch_url":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43.patch","issue_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/43","number":43,"state":"open","locked":false,"title":"[RFC] Add dual for convex problem with quadratic","user":{"login":"blegat","id":1048205,"avatar_url":"https://avatars3.githubusercontent.com/u/1048205?v=4","gravatar_id":"","url":"https://api.github.com/users/blegat","html_url":"https://github.com/blegat","followers_url":"https://api.github.com/users/blegat/followers","following_url":"https://api.github.com/users/blegat/following{/other_user}","gists_url":"https://api.github.com/users/blegat/gists{/gist_id}","starred_url":"https://api.github.com/users/blegat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blegat/subscriptions","organizations_url":"https://api.github.com/users/blegat/orgs","repos_url":"https://api.github.com/users/blegat/repos","events_url":"https://api.github.com/users/blegat/events{/privacy}","received_events_url":"https://api.github.com/users/blegat/received_events","type":"User","site_admin":false},"body":"I have attempted a convention for the dual and constraint values for convex programs with quadratic functions.\r\nIt seems to me that it would be inconsistent to say that the dual is the dual of the equivalent SOC formulation since the dimension depends on the choice of `A` and the constraint value has scalar dimension.","created_at":"2017-07-16T10:13:38Z","updated_at":"2017-12-04T23:06:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"529b1a307d278ccd3568e01ab0eb62e597eafebf","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43/commits","review_comments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43/comments","review_comment_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/43/comments","statuses_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/statuses/9403f2e52368f59c91b5730dc290834e613d2b92","head":{"label":"JuliaOpt:convexquad","ref":"convexquad","sha":"9403f2e52368f59c91b5730dc290834e613d2b92","user":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars1.githubusercontent.com/u/5667382?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"repo":{"id":95823645,"name":"MathOptInterface.jl","full_name":"JuliaOpt/MathOptInterface.jl","owner":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars1.githubusercontent.com/u/5667382?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaOpt/MathOptInterface.jl","description":"An abstraction layer for mathematical optimization solvers.","fork":false,"url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl","forks_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/deployments","created_at":"2017-06-29T22:02:15Z","updated_at":"2017-11-27T18:16:44Z","pushed_at":"2017-12-04T16:17:23Z","git_url":"git://github.com/JuliaOpt/MathOptInterface.jl.git","ssh_url":"git@github.com:JuliaOpt/MathOptInterface.jl.git","clone_url":"https://github.com/JuliaOpt/MathOptInterface.jl.git","svn_url":"https://github.com/JuliaOpt/MathOptInterface.jl","homepage":"http://www.juliaopt.org/","size":806,"stargazers_count":15,"watchers_count":15,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":19,"watchers":15,"default_branch":"master"}},"base":{"label":"JuliaOpt:master","ref":"master","sha":"d47eb232b9d6609cd3c626b0e1f14e88c182563f","user":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars1.githubusercontent.com/u/5667382?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"repo":{"id":95823645,"name":"MathOptInterface.jl","full_name":"JuliaOpt/MathOptInterface.jl","owner":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars1.githubusercontent.com/u/5667382?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaOpt/MathOptInterface.jl","description":"An abstraction layer for mathematical optimization solvers.","fork":false,"url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl","forks_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/deployments","created_at":"2017-06-29T22:02:15Z","updated_at":"2017-11-27T18:16:44Z","pushed_at":"2017-12-04T16:17:23Z","git_url":"git://github.com/JuliaOpt/MathOptInterface.jl.git","ssh_url":"git@github.com:JuliaOpt/MathOptInterface.jl.git","clone_url":"https://github.com/JuliaOpt/MathOptInterface.jl.git","svn_url":"https://github.com/JuliaOpt/MathOptInterface.jl","homepage":"http://www.juliaopt.org/","size":806,"stargazers_count":15,"watchers_count":15,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":19,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43"},"html":{"href":"https://github.com/JuliaOpt/MathOptInterface.jl/pull/43"},"issue":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/43"},"comments":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaOpt/MathOptInterface.jl/statuses/9403f2e52368f59c91b5730dc290834e613d2b92"}},"author_association":"OWNER"}}
{"actor":{"display_login":"mlubin"}}