-
Notifications
You must be signed in to change notification settings - Fork 33
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
#676 - Add _projection method for set - hyperplane lazy intersection #694
Conversation
Apart from the unit test that i'll add now, it is ready from my side. I gave the options Once we have an efficient intersection of zonogon and line (here, they will work by default when a zonotope is given because of the dispatch on |
src/Intersection.jl
Outdated
@@ -308,6 +308,11 @@ or a hyperplane in a given direction. | |||
* `"line_search"` -- solve the associated univariate optimization problem | |||
using a line search method (either Brent or the | |||
Golden Section method) | |||
* `"projection"` -- evaluate the support function by reducing the problem to | |||
the 2D intersection of a rank 2 linear transformation of | |||
the given compat set in the plane generated by the given |
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.
compact
src/Intersection.jl
Outdated
the 2D intersection of a rank 2 linear transformation of | ||
the given compat set in the plane generated by the given | ||
direction `d` and the hyperplane's normal vector `n`; | ||
only valid for intersection with a hyperplane |
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.
Maybe move the last sentence to the top; otherwise the hyperplane
in the text is confusing.
src/Intersection.jl
Outdated
|
||
- `ℓ` -- direction | ||
- `X` -- set | ||
- `H` -- hyperplane |
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.
spaces
src/Intersection.jl
Outdated
_projection(ℓ, X, H::Union{Hyperplane{N}, Line{N}}; kwargs...) where {N} | ||
|
||
Given a compact and convex set ``X`` and a hyperplane ``H = \\{x: n ⋅ x = γ \\}``, | ||
calculate ... |
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.
"...", now I am excited 😄
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.
haha sorry. forgot to write the maths
|
||
The support function of ``X ∩ H`` along direction ``ℓ``. | ||
""" | ||
function _projection(ℓ, X, H::Union{Hyperplane{N}, Line{N}}; |
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.
ℓ
-> d
?
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.
if u don't mind i would keep ℓ
here so that it matches the original algorithm
src/Intersection.jl
Outdated
lazy_2d_intersection=true, | ||
kwargs...) where {N} | ||
|
||
options = Dict(kwargs) |
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.
options
is never actually used.
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.
correct, i have to remove it 👍
options = Dict(kwargs) | ||
n = H.a # normal vector to the hyperplane | ||
γ = H.b # displacement of the hyperplane | ||
Πnℓ = vcat(n', ℓ') # projection map |
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.
Πnℓ
- cool idea
src/Intersection.jl
Outdated
|
||
Lγ = Line(x_dir, γ) | ||
|
||
Snℓ = lazy_linear_map ? LinearMap(Πnℓ, X) : linear_map(Πnℓ, X) |
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.
In the spirit of above, what about \bigcap<TAB>Sℓ
or S\bigcap<TAB>ℓ
(resp. d
instead of ℓ
)?
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.
nice! we can use the \bigcap
notation in the hybrid algorithm too 👍
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 misinterpreted the n
as a symbol for intersection 😄
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.
hmm better if i use Xnℓ
since the given set is X
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.
What does the notation mean?
Thanks for the comments, i've addressed them all. I've also reworked the return statement and added a new keyword argument. The idea is to have more control on how the 2D intersection is performed. |
Codecov Report
@@ Coverage Diff @@
## master #694 +/- ##
==========================================
+ Coverage 94.26% 98.42% +4.16%
==========================================
Files 51 51
Lines 1674 1271 -403
==========================================
- Hits 1578 1251 -327
+ Misses 96 20 -76
Continue to review full report at Codecov.
|
Closes #676.