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

#676 - Add _projection method for set - hyperplane lazy intersection #694

Merged
merged 8 commits into from
Oct 4, 2018

Conversation

mforets
Copy link
Member

@mforets mforets commented Oct 3, 2018

Closes #676.

@mforets mforets changed the title WIP #676 - Add _projection method for set - hyperplane lazy intersection #676 - Add _projection method for set - hyperplane lazy intersection Oct 4, 2018
@mforets
Copy link
Member Author

mforets commented Oct 4, 2018

Apart from the unit test that i'll add now, it is ready from my side.

I gave the options lazy_linear_map and lazy_2d_intersection such that their default values coincide with the given algorithm in Le Guernic.

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 ρ(y_dir, cap; kwargs...), if mean we can dispatch on cap.X::Zonotope.

@@ -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
Copy link
Member

Choose a reason for hiding this comment

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

compact

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
Copy link
Member

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.


- `ℓ` -- direction
- `X` -- set
- `H` -- hyperplane
Copy link
Member

Choose a reason for hiding this comment

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

spaces

_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 ...
Copy link
Member

Choose a reason for hiding this comment

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

"...", now I am excited 😄

Copy link
Member Author

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}};
Copy link
Member

Choose a reason for hiding this comment

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

-> d?

Copy link
Member Author

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

lazy_2d_intersection=true,
kwargs...) where {N}

options = Dict(kwargs)
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

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

Πnℓ - cool idea


Lγ = Line(x_dir, γ)

Snℓ = lazy_linear_map ? LinearMap(Πnℓ, X) : linear_map(Πnℓ, X)
Copy link
Member

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 )?

Copy link
Member Author

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 👍

Copy link
Member

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 😄

Copy link
Member Author

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

Copy link
Member

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?

@mforets
Copy link
Member Author

mforets commented Oct 4, 2018

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-io
Copy link

codecov-io commented Oct 4, 2018

Codecov Report

Merging #694 into master will increase coverage by 4.16%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/Intersection.jl 95.45% <91.66%> (+11.14%) ⬆️
src/MinkowskiSum.jl 95.91% <0%> (-4.09%) ⬇️
src/Approximations/decompositions.jl 97.95% <0%> (-2.05%) ⬇️
src/is_intersection_empty.jl 96.52% <0%> (-0.38%) ⬇️
src/convex_hull_algorithms.jl 100% <0%> (ø) ⬆️
src/Approximations/box_approximations.jl 100% <0%> (ø) ⬆️
src/AbstractHPolygon.jl 100% <0%> (ø) ⬆️
src/Ball1.jl 100% <0%> (ø) ⬆️
src/HPolygon.jl 100% <0%> (ø) ⬆️
src/AbstractHyperrectangle.jl 100% <0%> (ø) ⬆️
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04cde85...e5529c8. Read the comment docs.

@mforets mforets merged commit 827206d into master Oct 4, 2018
@mforets mforets deleted the mforets/676 branch October 4, 2018 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants