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

Add "performance tips" page to docs #675

Merged
merged 7 commits into from
May 20, 2024
Merged

Add "performance tips" page to docs #675

merged 7 commits into from
May 20, 2024

Conversation

ericphanson
Copy link
Collaborator

I figure this could be helpful, since Convex is fairly different from both JuMP and regular Julia in that it has trouble with scalar indexing, and since conic solvers in general can be a bit unintuitive to folks.


Convex.jl is built around conic programming, and it works with conic solvers. This may be a different optimization methodology than you may be used to, and it works by formulating problems in terms of affine objective functions and affine-function-in-cone constraints for a variety of convex cones. Convex.jl reformulates all problems to this form. For example, the objective function you give Convex will not actually be executed line-by-line; instead, it will be reformulated to a possibly very-different looking form for the conic solver to handle. This has important consequences for performance.

For example, it is typically easier for conic solvers to minimize $\|A*x\|$ than $\|A*x\|^2$, since the former is reformulated as a second order cone constraint, and the latter as the same second order cone constraint, plus a rotated second order cone constraint (to model the final squaring). This may be unintuitive, since for non-conic solvers, often $\|A*x\|^2$ is easier to solve (as it avoids a square-root in the typical formulation).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really true, since the latter can be a rotated second order cone constraint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we make two constraints like l wrote. Maybe there’s a better example though?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I just delete this section? I feel like there's a pedagogical reason to discuss this stuff but I'm not 100% sure how actionable it is for "performance tips", since Convex basically makes you formulate conic-friendly things and I haven't seen this come up that often in practice. I guess the actionable thing is: "the problem you write down is not the problem being solved, so you may need to dig in and break the abstraction if you want to top performance"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(filed #677 btw)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote this section to be about "look at the final problem formulation". I believe the only stable API we have for this is write_to_file, so I used that.

BTW, it would probably be more standard to put the filename first (like in Base.write), but probably it's not worth changing from the MOI convention here.

@odow odow merged commit 934913d into master May 20, 2024
3 checks passed
@odow odow deleted the eph/perf-tips branch May 20, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants