Main /

How do I...

...specify a polyhedron {$P = \{x \ | \ Ax \le b\}$}?

P = Polyhedron(A, b)

...specify a polyhedron using vertices V?

P = Polyhedron(V)

...specify a polyhedron {$P = \{x \ | \ Ax \le b, \ A_e x = b_e \}$}?

P = Polyhedron('A', A, 'b', b, 'Ae', Ae, 'be', be)

...retrieve the H-representation {$P = \{x \ | \ Ax \le b, \ A_e x = b_e \}$}?

A = P.A, b = P.B, Aeq = P.Ae; beq = P.be

...retrieve rays and vertices of an H-polytope {$P = \{x \ | \ Ax \le b, \ A_e x = b_e \}$}?

vertices = P.V; rays = P.R;

...remove redundant faces of a polyhedron?

P.minHRep()

...plot polyhedron P in red and polyhedron Q in blue in the same figure?

plot(P, 'color', 'r', Q, 'color', 'b')

...normalize the H-representation of a polyhedron?

P.normalize()

...find out how many inequality and equality constraints define polyhedron P?

nineq = size(P.H, 1); neq = size(P.He, 1);

...plot the k-th facet of polyhedron P?

facet = P.getFacet(k); facet.plot()

...compute the Chebyshev center and radius of the k-th facet of polyhedron P?

data = P.minHRep().getFacet(k).chebyCenter(); x = data.x, r = data.r

...project point z onto the k-th facet of polyhedron P?

y = P.minHRep().getFacet(k).project(z).x

...determine whether polyhedron P is empty?

...determine whether polyhedron P is lower-dimensional?

lowdim = ~P.isFullDim()

...specify an n-dimensional hyperbox with unit length of its sides?

box = Polyhedron('lb', -ones(n, 1), 'ub', ones(n, 1))

...compute the bounding box of a polyhedron P?

box = P.outerApprox()

...compute the bounding box of an array of polyhedra (say, A = [P; Q]?

box = PolyUnion(A).outerApprox();