{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/comments/238399216","pull_request_review_id":180928581,"id":238399216,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODM5OTIxNg==","diff_hunk":"@@ -0,0 +1,130 @@\n+module CustomIndexing\n+\n+\"\"\"\n+    struct SparseArray{T,N} <: AbstractArray{T,N}\n+        data::Dict{Tuple,T}\n+    end\n+\n+`N`-dimensional array with elements of type `T` where only a subset of the entries are defined.\n+The entries with indices `idx = (i1, i2, ..., iN)` in `keys(data)` has value `data[idx]`.\n+Note that as opposed to `SparseArrays.AbstractSparseArray`, the missing entries are not assumed\n+to be `zero(T)`. The indexing structure of the array is not rectangular and the missing entries","path":"src/CustomIndexing/CustomIndexing.jl","position":11,"original_position":11,"commit_id":"9986a488923f4ffb35c406e89a51abd54831081b","original_commit_id":"9986a488923f4ffb35c406e89a51abd54831081b","user":{"login":"mlubin","id":1733683,"node_id":"MDQ6VXNlcjE3MzM2ODM=","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":"What is a \"missing entry\" defined as? This implicitly assumes some axis structure, no? Is there a difference between a missing entry and an out-of-bounds entry like there are for regular sparse arrays?","created_at":"2018-12-03T19:10:44Z","updated_at":"2018-12-03T19:16:07Z","html_url":"https://github.com/JuliaOpt/JuMP.jl/pull/1657#discussion_r238399216","pull_request_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/comments/238399216"},"html":{"href":"https://github.com/JuliaOpt/JuMP.jl/pull/1657#discussion_r238399216"},"pull_request":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657","id":235419822,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1NDE5ODIy","html_url":"https://github.com/JuliaOpt/JuMP.jl/pull/1657","diff_url":"https://github.com/JuliaOpt/JuMP.jl/pull/1657.diff","patch_url":"https://github.com/JuliaOpt/JuMP.jl/pull/1657.patch","issue_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1657","number":1657,"state":"open","locked":false,"title":"[WIP] Add CustomIndexing.SparseArray","user":{"login":"blegat","id":1048205,"node_id":"MDQ6VXNlcjEwNDgyMDU=","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":"Implement solution 3. of https://github.com/JuliaOpt/JuMP.jl/pull/1537#issuecomment-443438792 \r\nAll the sophisticated indexing of JuMP macros as well as `JuMPArray` and `JuMPDict` are not relatated to optimization.\r\nThere does not seem to be any package that we could rely on of this so we have to implement everything in-house.\r\nIt seems to me that moving most of the logic into a separate submodule that is independent of the rest of the JuMP code might help readability and improve the code mainainability.\r\nIn the long term, we might move this submodule into a separate package `CustomIndexing.jl` to make it usable outside JuMP and make contribution to it easier.\r\n\r\nIn the long term, it would be nice to have a macro\r\n```julia\r\n@container [i=..., j=...) f(i, j)\r\n```\r\nin `CustomIndexing` that creates a container and fill it with `f(i, j)`. The element type would be determined from the first entry like what is done for `map` and `broadcast` in base.\r\nThis macro would rely on a function in `CustomIndexing` similar to `JuMP.generatecontainer` what JuMP could use.\r\nAs it would not need the element type as argument, we will be able to get rid of `variable_type` and `constraint_type` and have containers with concrete element types (which is not the same at the moment with `@constraint`).\r\n\r\nTODO:\r\n- [ ] Add helpful error for unsupported operations\r\n- [ ] inplement indexing with `:`\r\n- [ ] Use SparseArray in `JuMP.generatecontainer`instead of `Dict`\r\n- [ ] Move `JuMPArray` into `CustomIndexing.DenseArray`\r\n\r\nWhat do you think ?","created_at":"2018-12-03T11:52:24Z","updated_at":"2018-12-03T19:16:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2db7f5f677c3759928b39566ed01f43d8e14dd0e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657/commits","review_comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657/comments","review_comment_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1657/comments","statuses_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/statuses/9986a488923f4ffb35c406e89a51abd54831081b","head":{"label":"JuliaOpt:bl/customindexing","ref":"bl/customindexing","sha":"9986a488923f4ffb35c406e89a51abd54831081b","user":{"login":"JuliaOpt","id":5667382,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NjczODI=","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":6150069,"node_id":"MDEwOlJlcG9zaXRvcnk2MTUwMDY5","name":"JuMP.jl","full_name":"JuliaOpt/JuMP.jl","private":false,"owner":{"login":"JuliaOpt","id":5667382,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NjczODI=","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},"html_url":"https://github.com/JuliaOpt/JuMP.jl","description":"Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)","fork":false,"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl","forks_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/deployments","created_at":"2012-10-10T00:34:45Z","updated_at":"2018-12-03T12:15:18Z","pushed_at":"2018-12-03T15:25:23Z","git_url":"git://github.com/JuliaOpt/JuMP.jl.git","ssh_url":"git@github.com:JuliaOpt/JuMP.jl.git","clone_url":"https://github.com/JuliaOpt/JuMP.jl.git","svn_url":"https://github.com/JuliaOpt/JuMP.jl","homepage":"","size":11954,"stargazers_count":629,"watchers_count":629,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":168,"mirror_url":null,"archived":false,"open_issues_count":72,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":168,"open_issues":72,"watchers":629,"default_branch":"master"}},"base":{"label":"JuliaOpt:master","ref":"master","sha":"ce09774418e3768bc4182504cf54a39393b9e220","user":{"login":"JuliaOpt","id":5667382,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NjczODI=","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":6150069,"node_id":"MDEwOlJlcG9zaXRvcnk2MTUwMDY5","name":"JuMP.jl","full_name":"JuliaOpt/JuMP.jl","private":false,"owner":{"login":"JuliaOpt","id":5667382,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NjczODI=","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},"html_url":"https://github.com/JuliaOpt/JuMP.jl","description":"Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)","fork":false,"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl","forks_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/deployments","created_at":"2012-10-10T00:34:45Z","updated_at":"2018-12-03T12:15:18Z","pushed_at":"2018-12-03T15:25:23Z","git_url":"git://github.com/JuliaOpt/JuMP.jl.git","ssh_url":"git@github.com:JuliaOpt/JuMP.jl.git","clone_url":"https://github.com/JuliaOpt/JuMP.jl.git","svn_url":"https://github.com/JuliaOpt/JuMP.jl","homepage":"","size":11954,"stargazers_count":629,"watchers_count":629,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":168,"mirror_url":null,"archived":false,"open_issues_count":72,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":168,"open_issues":72,"watchers":629,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657"},"html":{"href":"https://github.com/JuliaOpt/JuMP.jl/pull/1657"},"issue":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1657"},"comments":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1657/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/pulls/1657/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaOpt/JuMP.jl/statuses/9986a488923f4ffb35c406e89a51abd54831081b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mlubin"}}