{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1152","repository_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl","labels_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1152/labels{/name}","comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1152/comments","events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1152/events","html_url":"https://github.com/JuliaOpt/JuMP.jl/issues/1152","id":284808828,"number":1152,"title":"Handling custom constraint types","user":{"login":"rdeits","id":591886,"avatar_url":"https://avatars0.githubusercontent.com/u/591886?v=4","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-12-27T22:47:42Z","updated_at":"2017-12-29T20:36:24Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"(carried over from discussion on gitter)\r\n\r\nHow should we handle custom constraint types (custom MOI functions or sets) that users might want to add to a model? For example, if I want to make a `Complementarity` `AbstractSet` and add it to my model, how should i go about that? The current design doesn't allow this, because the set of function and set types is fixed in the definition of `JuMPInstance`. \r\n\r\nI can see a couple of options:\r\n\r\n1. Store the instance constraints in a container with an abstract type, so that users can add whatever types they want\r\n2. Ask users to create their own instance type using the `@MOI.instance` macro\r\n\r\nOption 1 seems likely to be easier, but may have performance issues. But I would be interested in benchmarking that before making any assumptions. \r\n\r\nAnother way of implementing (1) would be to have a field with the (abstract) type `::TypeSortedCollection` using https://github.com/tkoolen/TypeSortedCollections.jl and update that field as constraints are added to the model. Accessing that field would not be type-stable, but iterating over it would still be fast. "},"comment":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/comments/354497570","html_url":"https://github.com/JuliaOpt/JuMP.jl/issues/1152#issuecomment-354497570","issue_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/1152","id":354497570,"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},"created_at":"2017-12-29T20:36:24Z","updated_at":"2017-12-29T20:36:24Z","author_association":"OWNER","body":"@rdeits, the type-erased container does surprisingly well in your benchmarks. Maybe it would be worth throwing together an `AbstractStandaloneInstance` implementation based on that ideal to have as a baseline."}}
{"actor":{"display_login":"mlubin"}}