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

#640 - Check for empty intersection of compact set with Hyperplane #650

Merged
merged 3 commits into from
Sep 24, 2018

Conversation

schillic
Copy link
Member

Closes #640.

@schillic schillic requested a review from mforets September 22, 2018 19:09

### Output

* If `witness` option is deactivated: `true` iff ``P ∩ Q = ∅``
Copy link
Member

Choose a reason for hiding this comment

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

P -> X, Q -> hp

witness::Bool=false
)::Union{Bool, Tuple{Bool,Vector{N}}} where N<:Real
sv_left = σ(-hp.a, X)
if -dot(sv_left, -hp.a) <= hp.b
Copy link
Member

Choose a reason for hiding this comment

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

maybe use ρ(d, X) directly. for eventual optimizations #600.

Copy link
Member Author

Choose a reason for hiding this comment

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

I need the support vector below anyway.

left and right, and then take the intersection of the line with the hyperplane.
We follow
[this algorithm](https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection#Algebraic_form)
for the line-hyperplane intersection.
Copy link
Member

Choose a reason for hiding this comment

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

Nice idea!

I was thinking how can we use it outside this function but then realized we don't have "hyperlines". See #652.

point_hp = an_element(hp)
point_line = sv_left
dir_line = sv_right - sv_left
d = dot((point_hp - point_line), hp.a) / dot(dir_line, hp.a)
Copy link
Member

@mforets mforets Sep 22, 2018

Choose a reason for hiding this comment

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

maybe use normal_hp or normal_hyperplane here and above

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not understand.

Copy link
Member

Choose a reason for hiding this comment

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

i was suggesting to give a variable name to hp.a. for readability of the code. not a big deal.

@schillic schillic merged commit 6668e77 into master Sep 24, 2018
@schillic schillic deleted the schillic/640 branch September 24, 2018 07:59
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.

2 participants