So I have a set of points V, which are the vertices of a convex polytope, and a separate point p. Basically, I want to check whether p is contained in V. To do so, I set up a linear program that checks whether there exists a hyperplane such that all points in V lie on one side, while p lies on the other, like so (using YALMIP):
z=sdpvar(size(p,1),1);
sdpvar z0;
LMI=[z'*vert-z0<=0,z'*probs-z0<=1];
solvesdp(LMI,-z'*probs+z0);
The hyperplane is defined by the set of points z such that z'*x - z0 = 0, such that if I get a value larger than zero for the point p, and one smaller than zero for all vertices, then I know they are separated by the plane (the second constraint is just so the problem is bounded). This works fine. However, now I want to check whether there is a hyperplane separating the two point sets such that it contains the origin. For this, I simply set z0 = 0, i.e. drop it entirely, getting:
z=sdpvar(size(p,1),1);
LMI=[z'*vert<=0,z'*probs<=1];
solvesdp(LMI,-z'*probs);
Now, however, even for cases in which I know there is a solution, it doesn't find it, and I'm at a loss for understanding why. As a test, I've used the vertices
v1=[0;0;0];v2=[1;0;0];v3=[0;1;0];v4=[1;1;1];
and the point
p=[0.4;0.6;0.6];
When plotted, that looks like the picture here.
So it's clear that there should be a plane separating the lone point and the polytope that contains the origin (the front and center point of the polytope).
One thing I've tried already is to offset the vertex of the polytope that's now on the origin from the origin a little (10^-5), such that the plane would not touch the polytope (although the LP should allow for that), but that didn't work either.
I'm grateful for any ideas!