Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use staged functions in @variable #346

Closed
joehuchette opened this issue Jan 7, 2015 · 9 comments
Closed

Use staged functions in @variable #346

joehuchette opened this issue Jan 7, 2015 · 9 comments

Comments

@joehuchette
Copy link
Contributor

Currently we don't recognize this as something we can store as a JuMPArray:

I = 1:3
@defVar(m, x[I])

It should be fairly straightforward to add a staged function in the generated macro code that takes the JuMPArray branch based on the type of I.

@mlubin
Copy link
Member

mlubin commented Jan 7, 2015

As I alluded to in #337 we can't easily implement this until we move over to the dormant JuMPArray.jl implementation because we're currently generating custom types inside of the macros. That's sketchy enough as it is, I don't think we should try to generate types at runtime within staged functions.

@joehuchette
Copy link
Contributor Author

Should we try to bump the ntuple inlining thing?

@mlubin
Copy link
Member

mlubin commented Jan 7, 2015

Not sure if it will be helpful, it's already a well-known issue.

@mlubin mlubin added this to the 0.10 milestone Apr 28, 2015
@mlubin
Copy link
Member

mlubin commented Jul 29, 2015

Don't think this is needed for JuMP 0.10, it'll be easier to do after we drop support for 0.3.

@mlubin mlubin removed this from the 0.10 milestone Jul 29, 2015
@mlubin mlubin added this to the 0.11 milestone Sep 29, 2015
@mlubin mlubin modified the milestones: 0.12, 0.11 Dec 1, 2015
@mlubin mlubin modified the milestones: 0.13, 0.12 Feb 21, 2016
@mlubin mlubin removed this from the 0.13 milestone Apr 29, 2016
@joehuchette joehuchette added this to the 0.14 milestone Aug 3, 2016
@mlubin mlubin changed the title Use staged functions in @defVar Use staged functions in @variable Aug 7, 2016
@mlubin
Copy link
Member

mlubin commented Aug 7, 2016

@joehuchette, are you planning on taking a stab at this soon? Does it need to block 0.14?

@joehuchette
Copy link
Contributor Author

I meant to tag it 0.15. Thinking about this more, we won't be able to return a Vector{Variable} for my I=1:3 example above without checking the endpoint at runtime, which will ruin type stability. The best we could do with generated functions is to return a JuMPArray. Is it still worth it? If this is mostly about performance, rather than semantics, type instability seems like a show-stopper.

@joehuchette joehuchette removed this from the 0.14 milestone Aug 7, 2016
@mlubin
Copy link
Member

mlubin commented Aug 7, 2016

We should be looking at the new arbitrary-indexed arrays for that: JuliaLang/julia#16260
So definitely after we drop support for 0.4

@chriscoey
Copy link
Contributor

any new thoughts on this? #933 was added to 1.0 milestone, should this be also?

@joehuchette
Copy link
Contributor Author

d032934

@mlubin mlubin mentioned this issue Sep 17, 2017
3 tasks
mlubin added a commit that referenced this issue Sep 17, 2017
Replace JuMPDict with Dict. Rewrite JuMPArray to be compatible with
AbstractArray. Explicit keyword argument in macro to force container
type.

Closes #1099
Closes #1047
Closes #417 (collect is now well defined for Array, JuMPArray, and Dict)
Closes #833 (`eachindex` and `indices` are defined for JuMPArray)
Closes #740 (dot broadcast syntax is now the default, no need to explicitly define vectorized functions)
Closes #922 (fixed by checking for duplicates)
Closes #933 (corollary: closes #346)
mlubin added a commit that referenced this issue Sep 19, 2017
Replace JuMPDict with Dict. Rewrite JuMPArray to be compatible with
AbstractArray. Explicit keyword argument in macro to force container
type.

Closes #1099
Closes #1047
Closes #417 (collect is now well defined for Array, JuMPArray, and Dict)
Closes #833 (`eachindex` and `indices` are defined for JuMPArray)
Closes #740 (dot broadcast syntax is now the default, no need to explicitly define vectorized functions)
Closes #922 (fixed by checking for duplicates)
Closes #933 (corollary: closes #346)
Closes #643 (colons work for Array and JuMPArray, obviously not Dict)
Closes #730 (end is not supported for JuMPArray)
Closes #646 (we now rely on built-in iteration behavior for Dict)
mlubin added a commit that referenced this issue Sep 19, 2017
Replace JuMPDict with Dict. Rewrite JuMPArray to be compatible with
AbstractArray. Explicit keyword argument in macro to force container
type.

Closes #1099
Closes #1047
Closes #417 (collect is now well defined for Array, JuMPArray, and Dict)
Closes #833 (`eachindex` and `indices` are defined for JuMPArray)
Closes #740 (dot broadcast syntax is now the default, no need to explicitly define vectorized functions)
Closes #922 (fixed by checking for duplicates)
Closes #933 (corollary: closes #346)
Closes #643 (colons work for Array and JuMPArray, obviously not Dict)
Closes #730 (end is not supported for JuMPArray)
Closes #646 (we now rely on built-in iteration behavior for Dict)
@mlubin mlubin closed this as completed in 852a3af Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants