Main /

HowTos

Main.HowTos History

Hide minor edits - Show changes to output

August 07, 2013, at 05:33 PM by Michal Kvasnica -
Changed line 23 from:
...retrieve vertices of an H-polytope @@{ x | A*x<=b, Aeq*x=beq }@@?
to:
...retrieve rays and vertices of an H-polytope {$ P = \{x \ | \ Ax \le b, \ A_e x = b_e \} $}?
Changed line 25 from:
V = P.V
to:
vertices = P.V; rays = P.R;
August 07, 2013, at 05:33 PM by Michal Kvasnica -
Deleted line 1:
August 07, 2013, at 05:30 PM by Michal Kvasnica -
Changed line 14 from:
...specify a polyhedron @@P = {x | A*x <= b, Ae*x = be}@@?
to:
...specify a polyhedron {$ P = \{x \ | \ Ax \le b, \ A_e x = b_e \} $}?
Changed line 19 from:
...retrieve the H-representation @@{ x | A*x<=b, Aeq*x=beq }@@ of polyhedron @@P@@?
to:
...retrieve the H-representation {$ P = \{x \ | \ Ax \le b, \ A_e x = b_e \} $}?
August 07, 2013, at 05:29 PM by Michal Kvasnica -
Changed line 4 from:
...specify a polyhedron @@P = {x | A*x <= b}@@?
to:
...specify a polyhedron {$ P = \{x \ | \ Ax \le b\} $}?
May 23, 2013, at 08:35 PM by Michal Kvasnica -
Added lines 1-87:
! 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();
@]