! How do I...
...specify a polyhedron @@P = {x | A*x <= b}@@?
(:source lang=MATLAB -getcode:) [@
P = Polyhedron(A, b)
@]
...specify a polyhedron using vertices @@V@@?
(:source lang=MATLAB -getcode:) [@
P = Polyhedron(V)
@]
...specify a polyhedron @@P = {x | A*x <= b, Ae*x = be}@@?
(:source lang=MATLAB -getcode:) [@
P = Polyhedron('A', A, 'b', b, 'Ae', Ae, 'be', be)
@]
...retrieve the H-representation @@{ x | A*x<=b, Aeq*x=beq }@@ of polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
A = P.A, b = P.B, Aeq = P.Ae; beq = P.be
@]
...retrieve vertices of an H-polytope @@{ x | A*x<=b, Aeq*x=beq }@@?
(:source lang=MATLAB -getcode:) [@
V = P.V
@]
...remove redundant faces of a polyhedron?
(:source lang=MATLAB -getcode:) [@
P.minHRep()
@]
...plot polyhedron @@P@@ in red and polyhedron @@Q@@ in blue in the same figure?
(:source lang=MATLAB -getcode:) [@
plot(P, 'color', 'r', Q, 'color', 'b')
@]
...normalize the H-representation of a polyhedron?
(:source lang=MATLAB -getcode:) [@
P.normalize()
@]
...find out how many inequality and equality constraints define polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
nineq = size(P.H, 1); neq = size(P.He, 1);
@]
...plot the @@k@@-th facet of polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
facet = P.getFacet(k); facet.plot()
@]
...compute the Chebyshev center and radius of the @@k@@-th facet of polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
data = P.minHRep().getFacet(k).chebyCenter(); x = data.x, r = data.r
@]
...project point @@z@@ onto the @@k@@-th facet of polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
y = P.minHRep().getFacet(k).project(z).x
@]
...determine whether polyhedron @@P@@ is empty?
(:source lang=MATLAB -getcode:) [@
answer = P.isEmptySet()
@]
...determine whether polyhedron @@P@@ is lower-dimensional?
(:source lang=MATLAB -getcode:) [@
lowdim = ~P.isFullDim()
@]
...specify an @@n@@-dimensional hyperbox with unit length of its sides?
(:source lang=MATLAB -getcode:) [@
box = Polyhedron('lb', -ones(n, 1), 'ub', ones(n, 1))
@]
...compute the bounding box of a polyhedron @@P@@?
(:source lang=MATLAB -getcode:) [@
box = P.outerApprox()
@]
...compute the bounding box of an array of polyhedra (say, @@A = [P; Q]@@?
(:source lang=MATLAB -getcode:) [@
box = PolyUnion(A).outerApprox();
@]