-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Volume of H-represenation #191
Comments
I was able to make it work by converting to a vrep using the using Polyhedra, QHull
cube = HalfSpace([0,0,1],1)∩HalfSpace([0,0,-1],0)∩HalfSpace([0,1,0],1)∩HalfSpace([0,-1,0],0)∩HalfSpace([1,0,0],1)∩HalfSpace([-1,0,0],0)
vcube = doubledescription(cube)
p = polyhedron(vcube,QHull.Library())
Polyhedra.volume(p) Shouldn't you be able to calculate the volume directly from the hrep? |
The error message should be improved, the issue is that if the origin is not in the interior of the polytope, QHull won't work (since QHull takes a V-Rep so we need to transform the H-Rep to a V-Rep by taking the polar, which requires the origin to be in the interior). So we solve an LP to find the chebyshev center and shift the polytope by this center so that the chebyshev center of the shifted polytope is the origin. Solving this LP requires an LP solver but you did not provide any solver to QHull. You need to do for instance using JuMP
lib = QHull.Library(with_optimizer(GLPK.Optimizer))
QHull takes a V-Rep as input and gives as output the H-Rep and the volume. What we do is take a H-Rep, give the V-Rep of the polar to QHull which gives the H-Rep of the polar and the volume of the polar that we transform back into V-Rep and volume of the original polytope. I am not aware of a direct way to obtain the volume with QHull from the H-Rep. |
I'm having difficulty finding the volume of an H-rep
This throws the following error:
What would be the correct way of getting the volume?
The text was updated successfully, but these errors were encountered: