1
$\begingroup$

I have an unanswered question on Stack Overflow that might more related to mathematics than programming. So the part where I am having a problem is described below.

EDIT: I reformulated the whole problem hoping that will be clearer.

Let $\mathcal{A}$ be a set of $m$ points: $$ \mathcal{A} = \{P_i \in \mathbb{R}^6, i \in [1,\ldots, m]\}. $$

From this set of points, a convex hull $\mathcal{C}$ (the smallest convex set that contains the points ${P_i}$) can be defined such that: $$ \mathcal{A} \subseteq \mathcal{C} $$

Let's define $Q \in \mathbb{R}^6$ such that: $$ Q \not\in \mathcal{C} $$

How do I find $Q^{\prime} \in \mathbb{R}^6$, the closest point from $Q$ belonging to the convex hull $\mathcal{C}$: $$ Q^{\prime} \in \mathcal{C}, \forall r \in \mathcal{C}\quad ||Q^{\prime}-Q|| \leq ||r-Q|| $$

I am looking for any algorithm or mathematic method to solve such problem so that I can implement it in my code.

For information: I am using the python scipy implementation of the qhull library for finding the convex hull from $\mathcal{A}$.

  • 0
    By "inside the set of points", do you mean "in the convex closure of the set of points"?2017-02-16
  • 0
    @quasi Yes, exactly2017-02-16
  • 0
    If you give a specific numerical example, the solution might suggest a general strategy. Perhaps that could be a separate question with a link to the current, more general one.2017-02-16
  • 1
    I don't understand the projection you are meaning: 1) as the $P_k$s are already in the plane, it is not the orthogonal projection 2) what is the role of the convex hull ? Could you explain what would happen if the plane is, plainly, xOy plane ?2017-02-16
  • 0
    Is there a reason to you use $n$ ? Why not replacing all $n$ by $3$ ?2017-02-16
  • 0
    To give some context, I am working with $n=6$: from a set of points, I am getting the convex hull with the Qhull library, and my aim is to find the closest point on this convex hull from any point outside. The reason I am working with planes is because the Qhull library gives me the plane equations and the points forming the convex hull.2017-02-16
  • 0
    Why not post the actual example? Or perhaps a smaller one.2017-02-16
  • 0
    Did you look at this? http://www.qhull.org/html/qh-faq.htm#closest2017-02-16
  • 0
    Sorry, I should have included it before: http://stackoverflow.com/questions/42248202/how-to-get-the-projection-of-a-point-on-the-closest-edge-of-a-convex-hull-with-s : it works well for $n=2$, but for $n>2$, only the projection works but it does not lie on the facet. As you can see, I am using scipy which as a very limited documentation and implemented function from qhull2017-02-16
  • 0
    I don't think it helps to post a code example. It unnecessarily clutters up the question, so in my opinion, the question would be improved if you deleted the code example. Instead, post a math example with numerical inputs2017-02-16

2 Answers 2

1

Why not just this ...

(1) Using this Qhull libary function

$\qquad$http://www.qhull.org/html/qh-faq.htm#closest

find the facet of the convex hull which is closest to the given point.

(2) For that facet ($k$-dimensional with $0 \le k \le n-1$), find the equations of the $k$-plane containing it.

(3) Using standard techniques from Vector Calculus, find the point on that $k$-plane which is closest to the given point.

Done.

If you post an actual numerical example, we can see if this works.

  • 0
    Thanks for the suggestion. I reformulated the problem but this still answers it. However, the Qhull function that is supposed to give the closest facet only works if the point is inside the convex hull and not outside, and the biggest problem I am facing is to actually do the point 3.2017-02-20
  • 0
    One of the inputs to that function is a boolean which, if set to true, tells the routine that the point is _outside_ the convex hull. So it should work.2017-02-20
  • 0
    Unfortunately I don't have access to this low-level interface through scipy. The point 3 is not that trivial.2017-02-20
0

I will post some piece of information I got from google and co which might be quite close to what I am looking for.

A similar question here seems to suggest that this is simply a quadratic programming problem formulated as such: $$ \begin{align} \text{minimize} & \quad ||Q^{\prime}Q||\\ \text{subject to} & \quad A Q^{\prime} + b = 0\\ \text{subject to} & \quad \mathbf{G} Q^{\prime} + h \leq 0. \end{align} $$ $A Q^{\prime}+b = 0$ specifies that the point $Q^{\prime}$ is on the closest hull boundaries and $\mathbf{G} Q^{\prime} + h \leq 0$ specifies that $Q^{\prime}$ is inside or on the other boundaries.

If we develop $||QQ^{\prime}||$, the problem is written as (correct me if I made a mistake): $$ \begin{align} \text{minimize} & \quad 2\left(\frac{1}{2} {Q^{\prime}}^{T} \mathbf{I} Q^{\prime} - Q^T Q^{\prime}\right)\\ \text{subject to} & \quad A Q^{\prime} + b = 0\\ \text{subject to} & \quad \mathbf{G} Q^{\prime} + h \leq 0, \end{align} $$ with $\mathbf{I}$ the identity matrix.

If we didn't have the second constraint, the resolution of a linear solution should yield to the solution as explained on Wikipedia quadratic programming page, but this cannot be used.

According to qhull documentation:

The convex hull of a point set P is the smallest convex set that contains P. If P is finite, the convex hull defines a matrix A and a vector b such that for all x in P, Ax+b <= [0,...].

Qhull computes the convex hull in 2-d, 3-d, 4-d, and higher dimensions. Qhull represents a convex hull as a list of facets. Each facet has a set of vertices, a set of neighboring facets, and a halfspace. A halfspace is defined by a unit normal and an offset (i.e., a row of A and an element of b).

I am not entirely sure at this point but the closest hyperplane equation should lead to the vector $A$ and float $b$, and all the other hyperplanes give the matrix $\mathbf{G}$ and vector $h$. I don't think an analytical solution exists (correct me if I am wrong) so the problem must be solved with a non-linear optimiser such as SLSQP for each facet of the convex. The solution point $Q^{\prime}$ will be the closest point to $Q$.

  • 0
    Solving the same problem, with the constraint being: $\max \left(\mathbf{A}Q^{\prime} + b\right) = 0$ using a traditional non-linear optimiser (I used scipy.minimize) works great. I used $\max$ since only one hyperplane will satisfy the constraint, not all. How to incorporate it in the quadratic programming?2017-02-20
  • 0
    This works great, thanks! But it seems too slow when implemented in dimension 6...2017-02-22