@@ -20,6 +20,56 @@ struct FourierMotzkin <: EliminationAlgorithm end
2020 BlockElimination
2121
2222Computation of the projection by computing the H-representation and applying the block elimination algorithm to it.
23+
24+ The idea is as follows.
25+ Consider a H-representation given by ``Ax + By \\ le c``.
26+ For any ``d``, the projection on the `x` variables has
27+ belongs to the halfspace ``d^\\ top x \\ le \\ delta`` where ``\\ delta``
28+ is
29+ ```math
30+ \\ begin{aligned}
31+ \\ max \\ ; & d^\\ top x \\
32+ \\ text{s.t.} & A x + By \\ le c \\
33+ \\ end{aligned}
34+ ```
35+ By duality, this is equal to
36+ ```math
37+ \\ begin{aligned}
38+ \\ min \\ ; & c^\\ top \\ nu \\
39+ \\ text{s.t.} & A^\\ top \\ nu = d \\
40+ & B^\\ top \\ nu = 0 \\
41+ & \\ nu \\ ge 0
42+ \\ end{aligned}
43+ ```
44+ Let `R` be the matrix for which the columns are the extreme rays of the
45+ polyhedron with defined by
46+ ``B^\\ top \\ nu = 0, \\ nu \\ ge 0``.
47+ The program can be rewritten as
48+ ```math
49+ \\ begin{aligned}
50+ \\ min \\ ; & c^\\ top \\ nu \\
51+ \\ text{s.t.} & A^\\ top \\ nu = d \\
52+ & \\ nu = R\\ lambda \\
53+ & \\ lambda \\ ge 0
54+ \\ end{aligned}
55+ ```
56+ which is equivalent to
57+ ```math
58+ \\ begin{aligned}
59+ \\ min \\ ; & c^\\ top R \\ lambda \\
60+ \\ text{s.t.} & A^\\ top R \\ lambda = d \\
61+ & \\ lambda \\ ge 0
62+ \\ end{aligned}
63+ ```
64+ Dualizing, we obtain
65+ ```math
66+ \\ begin{aligned}
67+ \\ max \\ ; & d^\\ top x \\
68+ \\ text{s.t.} & R^\\ top A x \\ le R^\\ top c \\
69+ \\ end{aligned}
70+ ```
71+ where we see that ``R^\\ top A x \\ le R^\\ top c``
72+ is the H-representation of the polyhedron.
2373"""
2474struct BlockElimination <: EliminationAlgorithm end
2575
@@ -49,8 +99,19 @@ project(p::Polyhedron, pset, algo) = eliminate(p, setdiff(1:fulldim(p), pset), a
4999
50100supportselimination (p:: Polyhedron , :: FourierMotzkin ) = false
51101eliminate (p:: Polyhedron , delset, :: FourierMotzkin ) = error (" Fourier-Motzkin elimination not implemented for $(typeof (p)) " )
52- supportselimination (p:: Polyhedron , :: BlockElimination ) = false
53- eliminate (p:: Polyhedron , delset, :: BlockElimination ) = error (" Block elimination not implemented for $(typeof (p)) " )
102+ supportselimination (p:: Polyhedron , :: BlockElimination ) = true
103+
104+ struct ProjectionMatrix <: AbstractMatrix{Bool}
105+ indices:: Vector{Int}
106+ n:: Int
107+ end
108+ Base. size ()
109+ Base. adjoint (P:: ProjectionMatrix ) = transpose (P)
110+
111+ function eliminate (p:: Polyhedron , delset, :: BlockElimination )
112+ h_eliminate = ProjectionMatrix (sort (collect (delset)), fulldim (p)) \ hrep (p)
113+ return h_eliminate
114+ end
54115
55116eliminate (p:: Polyhedron , algo:: EliminationAlgorithm ) = eliminate (p, BitSet (fulldim (p)), algo)
56117
0 commit comments