{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97","repository_url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl","labels_url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97/comments","events_url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97/events","html_url":"https://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97","id":296576032,"number":97,"title":"Model: canget objective function of the wrong type","user":{"login":"tkoolen","id":2585880,"avatar_url":"https://avatars0.githubusercontent.com/u/2585880?v=4","gravatar_id":"","url":"https://api.github.com/users/tkoolen","html_url":"https://github.com/tkoolen","followers_url":"https://api.github.com/users/tkoolen/followers","following_url":"https://api.github.com/users/tkoolen/following{/other_user}","gists_url":"https://api.github.com/users/tkoolen/gists{/gist_id}","starred_url":"https://api.github.com/users/tkoolen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkoolen/subscriptions","organizations_url":"https://api.github.com/users/tkoolen/orgs","repos_url":"https://api.github.com/users/tkoolen/repos","events_url":"https://api.github.com/users/tkoolen/events{/privacy}","received_events_url":"https://api.github.com/users/tkoolen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-13T00:44:28Z","updated_at":"2018-02-13T13:25:44Z","closed_at":null,"author_association":"NONE","body":"Because of\r\n\r\nhttps://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/blob/532ebec78b8b8e35dbf7e7443ddcdb663ff279cf/src/model.jl#L225-L231\r\n\r\nand\r\nhttps://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/blob/532ebec78b8b8e35dbf7e7443ddcdb663ff279cf/src/model.jl#L171\r\n\r\nyou can set a quadratic objective, ask if you can get a `SingleVariable` objective (why yes you can!) and then when you call `get` with `ObjectiveFunction{SingleVariable}` you receive a `ScalarQuadraticFunction`.\r\n \r\nBy the way, I was expecting this to be implemented with three different fields, not just one field with `Union` type; I guess this is a temporary solution?"},"comment":{"url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/comments/365265731","html_url":"https://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97#issuecomment-365265731","issue_url":"https://api.github.com/repos/JuliaOpt/MathOptInterfaceUtilities.jl/issues/97","id":365265731,"user":{"login":"tkoolen","id":2585880,"avatar_url":"https://avatars0.githubusercontent.com/u/2585880?v=4","gravatar_id":"","url":"https://api.github.com/users/tkoolen","html_url":"https://github.com/tkoolen","followers_url":"https://api.github.com/users/tkoolen/followers","following_url":"https://api.github.com/users/tkoolen/following{/other_user}","gists_url":"https://api.github.com/users/tkoolen/gists{/gist_id}","starred_url":"https://api.github.com/users/tkoolen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkoolen/subscriptions","organizations_url":"https://api.github.com/users/tkoolen/orgs","repos_url":"https://api.github.com/users/tkoolen/repos","events_url":"https://api.github.com/users/tkoolen/events{/privacy}","received_events_url":"https://api.github.com/users/tkoolen/received_events","type":"User","site_admin":false},"created_at":"2018-02-13T13:25:43Z","updated_at":"2018-02-13T13:25:43Z","author_association":"NONE","body":"Just like there are separate fields for e.g. `SingleVariable` and `ScalarAffineFunction` constraints. Sure, there can be multiple of those and only one objective function, but you're losing type stability with the `Union` type, which makes me ask why the `ObjectiveFunction` attribute should be parameterized at all. But come to think of it, I guess a better approach would probably be to use use return type annotations in the `get` functions to regain type stability. However, that's currently not the case."}}
{"actor":{"display_login":"tkoolen"}}