You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realized that when defining a one-dimensional polytope via its vertices and obtaining the H representation from its V representation, the vertices will be flipped.
For example, we want to define the polytope given by the inverval $[-a,b]$, where $a,b>0$, and define a polytope based on $a$ and $b$.
Then the H representation of this polytope actually describes the polytope $[-b, a]$ and not$[-a, b]$.
Furthermore, when determining the V representation after determining the H representation, the V representation will also contain the flipped vertices.
Below I provide a code snippet to reproduce the issue, where $a=0.5$ and $b=1$.
import numpy as np
import pytope as pt # tested version 0.0.5# define vertices for the polytope [-0.5, 1]
V= np.array([[-0.5], [1]])
# define polytope by vertices
poly = pt.Polytope(V=V)
print('Vertices describing poly before determining H rep:')
print(poly._get_V().T)
poly.determine_H_rep()
# Check if vertices are in the H representationforiin range(len(V)):
vertex = V[i]
print(f"Is vertex = {vertex[0]} in the H representation of the polytope defined by [-0.5, 1]?")
if sum(poly.A*vertex-poly.b>0)>0:
print("No")
# check vertices after determining the H rep
print('Vertices describing poly after determining H rep:')
print(poly._get_V().T)
# check vertices after determining both the H and V reppoly.determine_V_rep()
print('Vertices describing poly after determining H rep and V rep:')
print(poly._get_V().T)
This code will print out "No", when we check if the vertex $1$ is in the H representation of the polytope and show that the vertices are flipped when determining the V representation after the H representation.
The text was updated successfully, but these errors were encountered:
Hi,
I realized that when defining a one-dimensional polytope via its vertices and obtaining the H representation from its V representation, the vertices will be flipped.$[-a,b]$ , where $a,b>0$ , and define a polytope based on $a$ and $b$ .$[-b, a]$ and not $[-a, b]$ .
For example, we want to define the polytope given by the inverval
Then the H representation of this polytope actually describes the polytope
Furthermore, when determining the V representation after determining the H representation, the V representation will also contain the flipped vertices.
Below I provide a code snippet to reproduce the issue, where$a=0.5$ and $b=1$ .
This code will print out "No", when we check if the vertex$1$ is in the H representation of the polytope and show that the vertices are flipped when determining the V representation after the H representation.
The text was updated successfully, but these errors were encountered: