-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Rewrite macros using staged functions #271
Conversation
:) by the quadratic handling stuff do you mean doing the expression tree search to detect quadratic vs. linear expressions? |
No, just adding a case in |
Brave new world :) Feels so much more right than the old approach |
I still kinda like that you could read a model and know which terms are coefficients and which are variables, but that doesn't generalize very well to nonlinear expressions. Should we have some sort of a style guide? |
285734d
to
d32a78f
Compare
Rebased, compatible with 0.3 now. @IainNZ, does this break macros for JuMPeR? |
a8dc41e
to
00f691b
Compare
@IainNZ, just tested JuMPeR with this and tests pass. Safe to merge? |
Yep, go for it. |
Rewrite macros using staged functions
The Maros-Meszaros test set is probably the standard benchmark for QP's. If there isn't a Julia QPS reader yet (?), they're available as mat files here https://github.com/YimingYAN/QP-Test-Problems (I did the exact same thing a few years ago - used a mex interface to CoinUtils to read them into Matlab). Or maybe not too hard to parse from the originals http://www.cuter.rl.ac.uk/Problems/marmes.shtml These are a subset of CUTEr of course. Wonder where the Julia CUTEr/CUTEst interface got to. |
Major revamp of expression parsing macros using staged functions (requires Julia 0.4).
Primary new feature is that this lets us handle commutivity (#99) without sacrificing performance, and also we'll get faster quadratic expression building.
Before:
After:
So 5% slowdown for PMEDIAN build time, and 30% slowdown in CONT5 build time. This is a reasonable trade off for the extra flexibility, I think. I can do a bit more tweaking to see if I can get extra speed ups, and we can expect improvements in compiler optimizations for staged functions. Slow down in write time is unrelated, should investigate separately what's causing this in Julia 0.4.
Generated code is a bit more type stable now, since new intermediate variables are created for the output of each subexpression.
TODO: