{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/692","repository_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl","labels_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/692/labels{/name}","comments_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/692/comments","events_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/692/events","html_url":"https://github.com/JuliaOpt/JuMP.jl/issues/692","id":138706414,"number":692,"title":"syntax brainstorming","user":{"login":"mlubin","id":1733683,"avatar_url":"https://avatars.githubusercontent.com/u/1733683?v=3","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},"labels":[{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/labels/modeling","name":"modeling","color":"207de5"},{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/labels/speculative","name":"speculative","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":75,"created_at":"2016-03-05T18:26:21Z","updated_at":"2016-10-05T02:56:25Z","closed_at":null,"body":"Addressing the issue raised in https://github.com/JuliaOpt/JuMP.jl/pull/688, the current syntax of ``@defVar``, despite the name, doesn't make it clear that all we're doing is defining a julia variable. Maybe it's time to brainstorm a new approach:\r\n\r\nBoth examples below are valid julia syntax:\r\nIdea 1:\r\n```julia\r\n@variables m begin\r\n    x = (0 <= Variable[i=1:n](Int, start=5) <= i)\r\n    ...\r\nend\r\n```\r\nThe trouble here is that it looks like you're assigning x to refer to the constraints enforcing the bounds instead of the variables.\r\n\r\nIdea 2:\r\n```julia\r\n# variant 1\r\n@variables m begin\r\n    x = Variable[i=1:n](Int, start=5,lowerbound=0,upperbound=i)\r\n    ...\r\nend\r\n# variant 2\r\n@variables m begin\r\n    x[i=1:n] = Variable(Int, start=5,lowerbound=0,upperbound=i)\r\n    ...\r\nend\r\n```\r\nWe lose some of the magic of using comparison operators, but maybe this is much clearer. You can always use explicit constraints instead if you prefer the mathy syntax. Of the two variants I prefer the first because it's more clear that we're just assigning a collection of variables to ``x`` whereas the second variant might lead you to think that you can append indices to ``x`` later on.\r\n\r\nCC @StefanKarpinski @carnaval @yeesian @JackDunnNZ @davidanthoff @juan-pablo-vielma @chriscoey"},"comment":{"url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/comments/251569795","html_url":"https://github.com/JuliaOpt/JuMP.jl/issues/692#issuecomment-251569795","issue_url":"https://api.github.com/repos/JuliaOpt/JuMP.jl/issues/692","id":251569795,"user":{"login":"mlubin","id":1733683,"avatar_url":"https://avatars.githubusercontent.com/u/1733683?v=3","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":"2016-10-05T02:56:25Z","updated_at":"2016-10-05T02:56:25Z","body":"I think we should aim for a well-defined concept of the domain of a variable (or collection of variables) that can be constructed programmatically, and then find the right syntax for it. We're having trouble deciding how integer/bounds/semicontinuous/PSD restrictions interact because it's been pretty ad-hoc up to this point. Now is the right time to look forward to make the concepts and syntax general enough to allow for future extensions to JuMP that could allow unions of domains and/or CP-style domains."}}
{"actor":{"display_login":"mlubin"}}