I have a code that compute de number of vertices of a polytope and the coordinates of each vertex. But I have an error for the coordinates that I didn't manage to solve.
Error in np.array(poly.get_generators())[:, :-1] : too many indices for array: array is 1-dimensional, but 2 were indexed
Here is the code :
import numpy as np
import cdd as pcdd
A = np.array([
[-1,0,0],
[0,-1,0],
[1,1,0]])
b = np.array([
[-1],
[-1],
[1]])
M = np.hstack( (b, -A) )
mat = pcdd.Matrix(M, linear=False, number_type="fraction")
mat.rep_type = pcdd.RepType.INEQUALITY
poly = pcdd.Polyhedron(mat)
ext = poly.get_generators()
print(ext)
vertices = np.array(poly.get_generators())[:, :-1]
print("Vertices:")
for vertex in vertices:
print(vertex)