Ask Your Question
1

Checking cone containment

asked 2015-12-28 20:59:45 +0100

GraduateStudent gravatar image

I would like to check if one cone contains another cone, where the cones are convex rational polyhedral cones. I don't want to compute the intersection of two cones, because when done many times, that becomes prohibitively slow. Checking containment should be much faster. Is this possible in Sage? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-12-28 21:31:01 +0100

vdelecroix gravatar image

updated 2015-12-28 21:33:36 +0100

Assuming that your cones only contains the vertex 0, you can use containment as follows

sage: def polyhedron_contains(P, Q):
....:     return all(P.contains(v) for v in Q.rays())
sage: P1 = Polyhedron(rays = [(1,0,0), (0,1,0), (0,0,1)])
sage: P2 = Polyhedron(rays = [(1,2,1), (1,0,0), (1,1,1), (1,1,2)])
sage: polyhedron_contains(P1,P2)
True
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-12-28 20:59:45 +0100

Seen: 4,585 times

Last updated: Dec 28 '15