-
Notifications
You must be signed in to change notification settings - Fork 31
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
WIP: Approximate convex hulls #114
base: master
Are you sure you want to change the base?
Conversation
1 similar comment
try: | ||
import cvxopt | ||
import cvxopt.solvers | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should only catch on ImportError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, though I don't want any error in importing CVXOPT to affect functions which don't require it. Perhaps silently ignoring ImportError
and raising a warning on other exceptions would be good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would catch on ImportError
and let all others raise an issue. This is important because if you have code that can use cvxopt
, and the package is installed, but something goes wrong (maybe an environment issue, or windows being stupid, etc) that it should halt.
If you want more rigorous separation you'll either need to use separate files (one for functions that use cvxopt
and one for those that don't), or if the number of functions that require this package is low (but those functions in turn do require them) you can lazy-load the package by doing your import statement in the function itself. Keep in mind though that that will be called every time the function is called, and while it is fast, its not free.
|
||
n_partial, dimension = partial_hull.shape | ||
n_candidates, dimension_check = candidate_points.shape | ||
assert dimension == dimension_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably raise something instead of just blind asserting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Given that this is still a first stab, I didn't yet take the care to validate inputs and all that will go into the final PR.
@@ -0,0 +1,279 @@ | |||
#!/usr/bin/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#!/usr/bin/env python
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this is what I get from copying a older header template, heh.
This work in progress PR aims to produce ε-apporixmate convex hulls using the algorithm of 1603.04422, with CVXOPT being used to solve the quadratic program at the innermost loop. Unfortunately, this approach results in CVXOPT taking up a truly absurd ratio of the runtime, so the current implementation is far too slow to be useful at the moment. That said, it seems to work reasonably well in local testing, even if its too slow to be usable.