def contains(self, x): if isinstance(x, Polytope): return not cdd.pempty(cdd.pinters(self, x)) elif isinstance(x, np.ndarray): return not cdd.pempty( cdd.pinters(self, Polytope([np.insert(x, 0, 1)], False))) else: raise Exception("Not implemented")
def adj_matrix(pols): n = len(pols) m = dict() for i in range(n): for j in range(i, n): if i != j: ints = inters(pols[i], pols[j]) if not cdd.pempty(ints): m[i,j] = ints m[j,i] = ints return m