bernstein: add piecewise_lst::is_equal
[barvinok.git] / doc / implementation.tex
blobe5a8c2c1a4fa02e8cdca6aa6ab65053e6f5ff7cb
1 \section{Implementation details}
3 \subsection{An interior point of a polyhedron}
4 \label{s:interior}
6 We often need a point that lies in the interior of a polyhedron.
7 The function \ai[\tt]{inner\_point} implements the following algorithm.
8 Each polyhedron $P$ can be written as the sum of a polytope $P'$ and a cone $C$
9 (the \ai{recession cone} or \ai{characteristic cone} of $P$).
10 Adding a positive multiple of the sum of the extremal rays of $C$ to
11 the \ai{barycenter}
13 \frac 1 N \sum_i \vec v_i(\vec p)
15 of $P'$, where $N$ is the number of vertices, results in a point
16 in the interior of $P$.
18 \subsection{The integer points in the fundamental parallelepiped of a simple cone}
20 \label{s:fundamental}
22 This section is based on \shortciteN[Lemma 5.1]{Barvinok1992volume} and
23 \shortciteN{Koeppe2006experiments}.
25 \sindex{simple}{cone}
26 \sindex{open}{facet}
27 \sindex{open}{ray}
28 \sindex{explicit}{representation}
29 In this section we will deal exclusively with \ai{simple cone}s,
30 i.e. $d$-dimensional cones with $d$ extremal rays and $d$ facets.
31 \index{open facet}%
32 Some of the facets of these cones may be open.
33 Since we will mostly be dealing with cones in their
34 \ai{explicit representation}, we will have occasion to speak of
35 ``\ai{open ray}s'', by which we will mean that the facet not
36 containing the ray is open. (There is only one such facet because the cone
37 is simple.)
39 \sindex{fundamental}{parallelepiped}
40 \begin{definition}[Fundamental parallelepiped]
41 Let $K = \vec v + \poshull \lb\, \vec u_i \,\rb$ be
42 a closed (shifted) cone, then the \defindex{fundamental parallelepiped} $\Pi$
43 of $K$ is
45 \Pi = \vec v +
46 \lb\, \sum_i \alpha_i \vec u_i \mid 0 \leq \alpha_i < 1 \,\rb
49 If some of the rays $\vec u_i$ of $K$ are open, then the constraints on
50 the corresponding coefficient $\alpha_i$ are such that $0 < \alpha_i \le 1$.
51 \end{definition}
53 \begin{lemma}[Integer points in the fundamental parallelepiped of a simple cone]
54 \label{l:fundamental}
55 Let $K = \vec v + \poshull \lb\, \vec u_i \,\rb$ be a closed simple cone
56 and let $A$ be the matrix with the generators $\vec u_i$ of $K$
57 as rows.
58 Furthermore let $V A W^{-1} = S = \diag \vec s$ be the \indac{SNF} of $A$.
59 Then the integer points in the fundamental parallelepiped of $K$ are given
61 \begin{eqnarray}
62 \label{eq:parallelepiped}
63 \vec w^\T & = & \vec v^\T + \fractional{(\vec k^\T W - \vec v^\T) A^{-1}} A
65 \nonumber
66 & = &
67 \vec v^\T +
68 \sum_{i=1}^d
69 \fractional{\sps{\sum_{j=1}^d k_j \vec w^\T_j - \vec v^\T}{\vec u^*_i}}
70 \vec u_i^\T,
71 \end{eqnarray}
72 where $\vec u^*_i$ are the columns of $A^{-1}$ and $k_j \in \ZZ$ ranges
73 over $0 \le k_j < s_j$.
74 \end{lemma}
76 \begin{proof}
77 Since $0 \le \fractional{x} < 1$, it is clear that each such $\vec w$
78 lies inside the fundamental parallelepiped.
79 Furthermore,
80 \begin{eqnarray*}
81 \vec w^\T & = & \vec v^\T + \fractional{(\vec k^\T W - \vec v^\T) A^{-1}} A
83 & = &
84 \vec v^T +
85 \left(
86 (\vec k^\T W - \vec v^\T) A^{-1} - \floor{(\vec k^\T W - \vec v^\T) A^{-1}}
87 \right) A
89 & = &
90 \underbrace{\vec k^\T W\mathstrut}_{\in \ZZ^{1\times d}}
92 \underbrace{\floor{(\vec k^\T W - \vec v^\T) A^{-1}}}_{\in \ZZ^{1\times d}}
93 \underbrace{A\mathstrut}_{\in \ZZ^{d\times d}} \in \ZZ^{1\times d}.
94 \end{eqnarray*}
95 Finally, if two such $\vec w$ are equal, i.e., $\vec w_1 = \vec w_2$,
96 then
97 \begin{eqnarray*}
98 \vec 0^\T = \vec w_1^\T - \vec w_2^\T
99 & = & \vec k_1^\T W - \vec k_2^\T W + \vec p^\T A
101 & = & \left(\vec k_1^\T - \vec k_2^\T \right) W + \vec p^\T V^{-1} S W,
102 \end{eqnarray*}
103 with $\vec p \in \ZZ^d$,
104 or $\vec k_1 \equiv \vec k_2 \mod \vec s$, i.e., $\vec k_1 = \vec k_2$.
105 Since $\det S = \det A$, we obtain all points in the fundamental parallelepiped
106 by taking all $\vec k \in \ZZ^d$ satisfying $0 \le k_j < s_j$.
107 \end{proof}
109 If the cone $K$ is not closed then the coefficients of the open rays
110 should be in $(0,1]$ rather than in $[0,1)$.
111 In (\ref{eq:parallelepiped}),
112 we therefore need to replace the fractional part $\fractional{x} = x - \floor{x}$
113 by $\cractional{x} = x - \ceil{x-1}$ for the open rays.
115 \begin{figure}
116 \intercol=1.2cm
117 \begin{xy}
118 <\intercol,0pt>:<0pt,\intercol>::
119 \POS@i@={(0,-3),(0,0),(4,2),(4,-3)},{0*[grey]\xypolyline{*}}
120 \POS@i@={(0,-3),(0,0),(4,2)},{0*[|(2)]\xypolyline{}}
121 \POS(-1,0)\ar(4.5,0)
122 \POS(0,-3)\ar(0,3)
123 \POS(0,0)\ar@[|(3)](0,-1)
124 \POS(0,0)\ar@[|(3)](2,1)
125 \POS(0,-1)\ar@{--}@[|(2)](2,0)
126 \POS(2,1)\ar@{--}@[|(2)](2,0)
127 \POS(0,0)*{\bullet}
128 \POS(1,0)*{\bullet}
129 \end{xy}
130 \caption{The integer points in the fundamental parallelepiped of $K$}
131 \label{f:parallelepiped}
132 \end{figure}
134 \begin{example}
135 Let $K$ be the cone
137 K = \sm{0 \\ 0} + \poshull \lb\, \sm{2 \\ 1}, \sm{0 \\ -1} \,\rb
140 shown in Figure~\ref{f:parallelepiped}.
141 Then
143 A = \sm{2 & 1\\0 & -1} \qquad A^{-1} = \sm{1/2 & 1/2 \\ 0 & -1 }
147 \sm{1 & 0 \\ 1 & 1 } \sm{2 & 1\\0 & -1} = \sm{1 & 0 \\ 0 & 2} \sm{2 & 1 \\ 1 & 0}.
149 We have $\det A = \det S = 2$ and
150 $\vec k_1^\T = \sm{0 & 0}$ and $\vec k_2^\T = \sm{0 & 1}$.
151 Therefore,
153 \vec w_1^\T = \fractional{\sm{0 & 0} \sm{2 & 1 \\ 1 & 0} \sm{1/2 & 1/2 \\ 0 & -1 }}
154 \sm{2 & 1\\0 & -1} = \sm{0 & 0}
157 \begin{eqnarray*}
158 \vec w_2^\T & = &
159 \fractional{\sm{0 & 1} \sm{2 & 1 \\ 1 & 0} \sm{1/2 & 1/2 \\ 0 & -1 }}
160 \sm{2 & 1\\0 & -1}
162 & = &
163 \sm{1/2 & 1/2} \sm{2 & 1\\0 & -1} = \sm{1 & 0}.
164 \end{eqnarray*}
165 \end{example}
170 \subsection{Barvinok's decomposition of simple cones in primal space}
171 \label{s:decomposition}
173 As described by \shortciteN{DeLoera2003effective}, the first
174 implementation of Barvinok's counting algorithm applied
175 \ai{Barvinok's decomposition} \shortcite{Barvinok1994} in the \ai{dual space}.
176 \ai{Brion's polarization trick} \shortcite{Brion88} then ensures that you
177 do not need to worry about lower-dimensional faces in the decomposition.
178 Another way of avoiding the lower-dimensional faces, in the \ai{primal space},
179 is to perturb the vertex of the cone such that none of the lower-dimensional
180 face encountered contain any integer points \shortcite{Koeppe2006primal}.
181 In this section, we describe another technique that is based on allowing
182 some of the facets of the cone to be open.
184 The basic step in Barvinok's decomposition is to replace a
185 $d$-dimensional simple cone
186 $K = \poshull \lb\, \vec u_i \,\rb_{i=1}^d \subset \QQ^d$
187 by a signed sum of (at most) $d$ cones $K_j$
188 with a smaller determinant (in absolute value).
189 The cones are obtained by successively replacing each generator
190 of $K$ by an appropriately chosen
191 $\vec w = \sum_{i=1}^d \alpha_i \vec u_i$, i.e.,
192 \begin{equation}
193 \label{eq:K_j}
194 K_j =
195 \poshull \left(\lb\, \vec u_i \,\rb_{i=1}^d
196 \setminus \{\, \vec u_j \,\} \cup \{\, \vec w \,\}\right)
198 \end{equation}
199 To see that we can use these $K_j$ to perform a decomposition,
200 rearrange the $\vec u_i$ such that for all $1 \le i \le k$ we have
201 $\alpha_i < 0$ and for all $k+1 \le i \le d'$ we have $\alpha_i > 0$,
202 with $d - d'$ the number of zero $\alpha_i$.
203 We may assume $k < d'$; otherwise replace $\vec w \in B$ by
204 $-\vec w \in B$. We have
206 \vec w + \sum_{i=1}^k (-\alpha_i) \vec u_i =
207 \sum_{i=k+1}^{d'} \alpha_i \vec u_i
210 \begin{equation}
211 \label{eq:sub}
212 \sum_{i=0}^k \beta_i \vec u_i =
213 \sum_{i=k+1}^{d'} \alpha_i \vec u_i
215 \end{equation}
216 with $\vec u_0 = \vec w$, $\beta_0 = 1$ and $\beta_i = -\alpha_i > 0$
217 for $1 \le i \le k$. Any two $\vec u_j$ and $\vec u_l$ on the same side
218 of the equality are on opposite sides of the linear hull $H$ of
219 the other $\vec u_i$s since there exists a convex combination
220 of $\vec u_j$ and $\vec u_l$ on this hyperplane.
221 In particular, since $\alpha_j$ and $\alpha_l$ have the same sign,
222 we have
223 \begin{equation}
224 \label{eq:opposite}
225 \frac {\alpha_j}{\alpha_j+\alpha_l} \vec u_j
227 \frac {\alpha_l}{\alpha_j+\alpha_l} \vec u_l
228 \in H
229 \qquad\text{for $\alpha_i \alpha_l > 0$}
231 \end{equation}
232 The corresponding cones $K_j$ and $K_l$ (with $K_0 = K$)
233 therefore intersect in a common face $F \subset H$.
234 Let
236 K' :=
237 \poshull \left(\lb\, \vec u_i \,\rb_{i=1}^d \cup \{\, \vec w \,\}\right)
240 then any $\vec x \in K'$ lies both in some cone $K_i$ with
241 $0 \le i \le k$ and in some cone $K_i$ with $k+1 \le i \le d'$.
242 (Just subtract an appropriate multiple of Equation~(\ref{eq:sub}).)
243 The cones
244 $\{\, K_i \,\}_{i=0}^k$
246 $\{\, K_i \,\}_{i=k+1}^{d'}$
247 therefore both form a triangulation of $K'$ and hence
248 \begin{equation}
249 \label{eq:triangulations}
250 \indf{K'}
252 \indf{K} + \sum_{i=1}^k \indf{K_i} - \sum_{j\in J_1} \indf{F_j}
254 \sum_{i=k+1}^{d'} \indf{K_i} - \sum_{j\in J_2} \indf{F_j}
255 \end{equation}
257 \begin{equation}
258 \label{eq:decomposition}
259 \indf{K} = \sum_{i=1}^{d'} \varepsilon_i \indf{K_i} + \sum_j \delta_j \indf{F_j}
261 \end{equation}
262 with $\varepsilon_i = -1$ for $1 \le i \le k$,
263 $\varepsilon_i = 1$ for $k+1 \le i \le d'$,
264 $\delta_j \in \{ -1, 1 \}$ and $F_j$ some lower-dimensional faces.
265 Figure~\ref{fig:w} shows the possible configurations
266 in the case of a $3$-dimensional cone.
268 \begin{figure}
269 \intercol=0.48cm
270 \begin{center}
271 \begin{minipage}{0cm}
272 \begin{xy}
273 <\intercol,0pt>:<0pt,\intercol>::
275 \xybox{
276 \POS(-2,-1)="a"*+!U{+}
277 \POS(2,0)="b"*+!L{+}
278 \POS(0,2)="c"*+!D{+}
279 \POS(0,0)="w"*+!DR{\vec w}
280 \POS"a"\ar@{-}"b"
281 \POS"b"\ar@{-}"c"
282 \POS"c"\ar@{-}"a"
283 \POS"a"\ar@{--}"w"
284 \POS"b"\ar@{--}"w"
285 \POS"c"\ar@{--}"w"
286 }="a"
287 +R+(2,0)*!L
288 \xybox{
289 \POS(-2,-1)="a"*+!U{+}
290 \POS(2,0)="b"*+!L{-}
291 \POS(0,2)="c"*+!D{+}
292 \POS(-3,1)="w"*+!DR{\vec w}
293 \POS"a"\ar@{-}"b"
294 \POS"b"\ar@{-}"c"
295 \POS"c"\ar@{-}"a"
296 \POS"a"\ar@{--}"w"
297 \POS"b"\ar@{--}"w"
298 \POS"c"\ar@{--}"w"
299 }="b"
300 +R+(2,0)*!L
301 \xybox{
302 \POS(-2,-1)="a"*+!U{-}
303 \POS(2,0)="b"*+!U{+}
304 \POS(0,2)="c"*+!D{-}
305 \POS(5,-1)="w"*+!L{\vec w}
306 \POS"a"\ar@{-}"b"
307 \POS"b"\ar@{-}"c"
308 \POS"c"\ar@{-}"a"
309 \POS"a"\ar@{--}"w"
310 \POS"b"\ar@{--}"w"
311 \POS"c"\ar@{--}"w"
313 \POS"a"
314 +D-(0,1)*!U
315 \xybox{
316 \POS(-2,-1)="a"*+!U{0}
317 \POS(2,0)="b"*+!L{+}
318 \POS(0,2)="c"*+!D{+}
319 \POS(1,1)="w"*+!DL{\vec w}
320 \POS"a"\ar@{-}"b"
321 \POS"b"\ar@{-}"c"
322 \POS"c"\ar@{-}"a"
323 \POS"a"\ar@{--}"w"
325 \POS"b"
326 +DL-(0,1)*!UL
327 \xybox{
328 \POS(-2,-1)="a"*+!U{0}
329 \POS(2,0)="b"*+!U{+}
330 \POS(0,2)="c"*+!D{-}
331 \POS(4,-2)="w"*+!L{\vec w}
332 \POS"a"\ar@{-}"b"
333 \POS"b"\ar@{-}"c"
334 \POS"c"\ar@{-}"a"
335 \POS"a"\ar@{--}"w"
336 \POS"b"\ar@{--}"w"
338 \end{xy}
339 \end{minipage}
340 \end{center}
341 \caption[Possible locations of the vector $\vec w$ with respect to the rays
342 of a $3$-dimensional cone.]
343 {Possible locations of $\vec w$ with respect to the rays
344 of a $3$-dimensional cone. The figure shows a section of the cones.}
345 \label{fig:w}
346 \end{figure}
348 As explained above there are several ways of avoiding the lower-dimensional
349 faces in (\ref{eq:decomposition}). Here we will apply the following proposition.
350 \begin{proposition}[\shortciteN{Koeppe2007parametric}]
351 \label{p:inclusion-exclusion}
352 Let
353 \begin{equation}
354 \label{eq:full-source-identity}
355 \sum_{i\in {I_1}} \epsilon_i [P_i] + \sum_{i\in {I_2}} \delta_k [P_i] = 0
356 \end{equation}
357 be a (finite) linear identity of indicator functions of closed
358 polyhedra~$P_i\subseteq\QQ^d$, where the
359 polyhedra~$P_i$ with $i \in I_1$ are full-dimensional and those with $i \in I_2$
360 lower-dimensional. Let each closed polyhedron be given as
362 P_i = \left\{\, \vec x \mid \sp{b^*_{i,j}}{x} \ge \beta_{i,j} \text{
363 for $j\in J_i$}\,\right\}
366 Let $\vec y\in\QQ^d$ be a vector such that $\langle \vec b^*_{i,j}, \vec
367 y\rangle \neq 0$ for all $i\in I_1\cup I_2$, $j\in J_i$.
368 For each $i\in I_1$, we define the half-open polyhedron
369 \begin{equation}
370 \label{eq:half-open-by-y}
371 \begin{aligned}
372 \tilde P_i = \Bigl\{\, \vec x\in\QQ^d \mid {}&
373 \sp{b^*_{i,j}}{x} \ge \beta_{i,j}
374 \text{ for $j\in J_i$ with $\sp{b^*_{i,j}}{y} > 0$,} \\
375 & \sp{b^*_{i,j}}{x} > \beta_{i,j}
376 \text{ for $j\in J_i$ with $\sp{b^*_{i,j}}{y} < 0$} \,\Bigr\}.
377 \end{aligned}
378 \end{equation}
379 Then
380 \begin{equation}
381 \label{eq:target-identity}
382 \sum_{i\in I_1} \epsilon_i [\tilde P_i] = 0.
383 \end{equation}
384 \end{proposition}
385 When applying this proposition to (\ref{eq:decomposition}), we obtain
386 \begin{equation}
387 \label{eq:decomposition:2}
388 \indf{\tilde K} = \sum_{i=1}^{d'} \varepsilon_i \indf{\tilde K_i}
390 \end{equation}
391 where we start out
392 from a given $\tilde K$, which may be $K$ itself, i.e., a fully closed cone,
393 or the result of a previous application of the proposition, either through
394 a triangulation (Section~\ref{s:triangulation}) or a previous decomposition.
395 In either case, a suitable $\vec y$ is available, either as an interior
396 point of the cone or as the vector used in the previous application
397 (which may require a slight perturbation if it happens to lie on one of
398 the new facets of the cones $K_i$).
399 We are, however, free to construct a new $\vec y$ on each application
400 of the proposition.
401 In fact, we will not even construct such a vector explicitly, but
402 rather apply a set of rules that is equivalent to a valid choice of $\vec y$.
403 Below, we will present an ``intuitive'' motivation for these rules.
404 For a more algebraic, shorter, and arguably simpler motivation we
405 refer to \shortciteN{Koeppe2007parametric}.
407 The vector $\vec y$ has to satisfy $\sp{b^*_j}y > 0$ for normals $\vec b^*_j$
408 of closed facets and $\sp{b^*_j}y < 0$ for normals $\vec b^*_j$ of open facets of
409 $\tilde K$.
410 These constraints delineate a non-empty open cone $R$ from which
411 $\vec y$ should be selected. For some of the new facets of the cones
412 $\tilde K_j$, the cone $R$ will not be cut by the affine hull of the facet.
413 The closedness of these facets is therefore predetermined by $\tilde K$.
414 For the other facets, a choice will have to be made.
415 To be able to make the choice based on local information and without
416 computing an explicit vector $\vec y$, we use the following convention.
417 We first assign an arbitrary total order to the rays.
418 If (the affine hull of) a facet separates the two rays not on the facet $\vec u_i$
419 and $\vec u_j$, i.e., $\alpha_i \alpha_j > 0$ (\ref{eq:opposite}), then
420 we choose $\vec y$ to lie on the side of the smallest ray, according
421 to the chosen order.
422 That is, $\sp{{\tilde n}_{ij}}y > 0$, for
423 $\vec {\tilde n}_{ij}$ the normal of the facet pointing towards this smallest ray.
424 Otherwise, i.e., if $\alpha_i \alpha_j < 0$,
425 the interior of $K$ will lie on one side
426 of the facet and then we choose $\vec y$ to lie on the other side.
427 That is, $\sp{{\tilde n}_{ij}}y > 0$, for
428 $\vec {\tilde n}_{ij}$ the normal of the facet pointing away from the cone $K$.
429 Figure~\ref{fig:primal:examples} shows some example decompositions with
430 an explicitly marked $\vec y$.
432 \begin{figure}
433 \begin{align*}
434 \intercol=0.48cm
435 \begin{xy}
436 <\intercol,0pt>:<0pt,\intercol>::
437 \POS(-2,-1)="a"*+!U{+}
438 \POS(2,0)="b"*+!L{+}
439 \POS(0,2)="c"*+!D{+}
440 \POS"a"\ar@{-}@[|(3)]"b"
441 \POS"b"\ar@{-}@[|(3)]"c"
442 \POS"c"\ar@{-}@[|(3)]"a"
443 \POS(0.3,0.6)*{\bullet},*+!L{\vec y}
444 \end{xy}
446 \intercol=0.48cm
447 \begin{xy}
448 <\intercol,0pt>:<0pt,\intercol>::
449 \POS(2,0)="b"*+!L{+}
450 \POS(0,2)="c"*+!D{+}
451 \POS(0,0)="w"*+!DR{\vec w}
452 \POS"b"\ar@{-}@[|(3)]"c"
453 \POS"b"\ar@{-}@[|(3)]"w"
454 \POS"c"\ar@{-}@[|(3)]"w"
455 \POS(0.3,0.6)*{\bullet},*+!L{\vec y}
456 \end{xy}
458 \begin{xy}
459 <\intercol,0pt>:<0pt,\intercol>::
460 \POS(-2,-1)="a"*+!U{+}
461 \POS(0,2)="c"*+!D{+}
462 \POS(0,0)="w"*+!DR{\vec w}
463 \POS"c"\ar@{-}@[|(3)]"a"
464 \POS"a"\ar@{-}@[|(3)]"w"
465 \POS"c"\ar@{--}@[|(3)]"w"
466 \POS(0.3,0.6)*{\bullet},*+!L{\vec y}
467 \end{xy}
469 \begin{xy}
470 <\intercol,0pt>:<0pt,\intercol>::
471 \POS(-2,-1)="a"*+!U{+}
472 \POS(2,0)="b"*+!L{+}
473 \POS(0,0)="w"*+!DR{\vec w}
474 \POS"a"\ar@{-}@[|(3)]"b"
475 \POS"a"\ar@{--}@[|(3)]"w"
476 \POS"b"\ar@{--}@[|(3)]"w"
477 \POS(0.3,0.6)*{\bullet},*+!L{\vec y}
478 \end{xy}
480 \intercol=0.48cm
481 \begin{xy}
482 <\intercol,0pt>:<0pt,\intercol>::
483 \POS(-2,-1)="a"*+!U{+}
484 \POS(2,0)="b"*+!L{+}
485 \POS(0,2)="c"*+!D{+}
486 \POS"a"\ar@{--}@[|(3)]"b"
487 \POS"b"\ar@{-}@[|(3)]"c"
488 \POS"c"\ar@{--}@[|(3)]"a"
489 \POS(-2.5,-1.5)*{\bullet},*+!U{\vec y}
490 \end{xy}
492 \intercol=0.48cm
493 \begin{xy}
494 <\intercol,0pt>:<0pt,\intercol>::
495 \POS(2,0)="b"*+!L{+}
496 \POS(0,2)="c"*+!D{+}
497 \POS(0,0)="w"*+!DR{\vec w}
498 \POS"b"\ar@{-}@[|(3)]"c"
499 \POS"b"\ar@{--}@[|(3)]"w"
500 \POS"c"\ar@{--}@[|(3)]"w"
501 \POS(-2.5,-1.5)*{\bullet},*+!U{\vec y}
502 \end{xy}
504 \begin{xy}
505 <\intercol,0pt>:<0pt,\intercol>::
506 \POS(-2,-1)="a"*+!U{+}
507 \POS(0,2)="c"*+!D{+}
508 \POS(0,0)="w"*+!DR{\vec w}
509 \POS"c"\ar@{--}@[|(3)]"a"
510 \POS"a"\ar@{--}@[|(3)]"w"
511 \POS"c"\ar@{-}@[|(3)]"w"
512 \POS(-2.5,-1.5)*{\bullet},*+!U{\vec y}
513 \end{xy}
515 \begin{xy}
516 <\intercol,0pt>:<0pt,\intercol>::
517 \POS(-2,-1)="a"*+!U{+}
518 \POS(2,0)="b"*+!L{+}
519 \POS(0,0)="w"*+!DR{\vec w}
520 \POS"a"\ar@{--}@[|(3)]"b"
521 \POS"a"\ar@{-}@[|(3)]"w"
522 \POS"b"\ar@{-}@[|(3)]"w"
523 \POS(-2.5,-1.5)*{\bullet},*+!U{\vec y}
524 \end{xy}
526 \intercol=0.48cm
527 \begin{xy}
528 <\intercol,0pt>:<0pt,\intercol>::
529 \POS(-2,-1)="a"*+!U{+}
530 \POS(2,0)="b"*+!L{+}
531 \POS(0,2)="c"*+!D{+}
532 \POS"a"\ar@{--}@[|(3)]"b"
533 \POS"b"\ar@{-}@[|(3)]"c"
534 \POS"c"\ar@{-}@[|(3)]"a"
535 \POS(1,-1.5)*{\bullet},*+!L{\vec y}
536 \end{xy}
538 \intercol=0.48cm
539 \begin{xy}
540 <\intercol,0pt>:<0pt,\intercol>::
541 \POS(2,0)="b"*+!L{+}
542 \POS(0,2)="c"*+!D{+}
543 \POS(0,0)="w"*+!DR{\vec w}
544 \POS"b"\ar@{-}@[|(3)]"c"
545 \POS"b"\ar@{--}@[|(3)]"w"
546 \POS"c"\ar@{-}@[|(3)]"w"
547 \POS(1,-1.5)*{\bullet},*+!L{\vec y}
548 \end{xy}
550 \begin{xy}
551 <\intercol,0pt>:<0pt,\intercol>::
552 \POS(-2,-1)="a"*+!U{+}
553 \POS(0,2)="c"*+!D{+}
554 \POS(0,0)="w"*+!DR{\vec w}
555 \POS"c"\ar@{-}@[|(3)]"a"
556 \POS"a"\ar@{--}@[|(3)]"w"
557 \POS"c"\ar@{--}@[|(3)]"w"
558 \POS(1,-1.5)*{\bullet},*+!L{\vec y}
559 \end{xy}
561 \begin{xy}
562 <\intercol,0pt>:<0pt,\intercol>::
563 \POS(-2,-1)="a"*+!U{+}
564 \POS(2,0)="b"*+!L{+}
565 \POS(0,0)="w"*+!DR{\vec w}
566 \POS"a"\ar@{--}@[|(3)]"b"
567 \POS"a"\ar@{-}@[|(3)]"w"
568 \POS"b"\ar@{-}@[|(3)]"w"
569 \POS(1,-1.5)*{\bullet},*+!L{\vec y}
570 \end{xy}
572 \intercol=0.48cm
573 \begin{xy}
574 <\intercol,0pt>:<0pt,\intercol>::
575 \POS(-2,-1)="a"*+!U{0}
576 \POS(2,0)="b"*+!L{+}
577 \POS(0,2)="c"*+!D{+}
578 \POS"a"\ar@{-}@[|(3)]"b"
579 \POS"b"\ar@{-}@[|(3)]"c"
580 \POS"c"\ar@{-}@[|(3)]"a"
581 \POS(1,0.2)*{\bullet},*+!R{\vec y}
582 \end{xy}
584 \intercol=0.48cm
585 \begin{xy}
586 <\intercol,0pt>:<0pt,\intercol>::
587 \POS(-2,-1)="a"*+!U{0}
588 \POS(2,0)="b"*+!L{+}
589 \POS(1,1)="w"*+!DL{\vec w}
590 \POS"a"\ar@{-}@[|(3)]"b"
591 \POS"a"\ar@{-}@[|(3)]"w"
592 \POS"b"\ar@{-}@[|(3)]"w"
593 \POS(1,0.2)*{\bullet},*+!R{\vec y}
594 \end{xy}
596 \begin{xy}
597 <\intercol,0pt>:<0pt,\intercol>::
598 \POS(-2,-1)="a"*+!U{0}
599 \POS(0,2)="c"*+!D{+}
600 \POS(1,1)="w"*+!DL{\vec w}
601 \POS"c"\ar@{-}@[|(3)]"a"
602 \POS"a"\ar@{--}@[|(3)]"w"
603 \POS"c"\ar@{-}@[|(3)]"w"
604 \POS(1,0.2)*{\bullet},*+!R{\vec y}
605 \end{xy}
607 \intercol=0.48cm
608 \begin{xy}
609 <\intercol,0pt>:<0pt,\intercol>::
610 \POS(-2,-1)="a"*+!U{0}
611 \POS(2,0)="b"*+!U{+}
612 \POS(0,2)="c"*+!D{-}
613 \POS"a"\ar@{-}@[|(3)]"b"
614 \POS"b"\ar@{--}@[|(3)]"c"
615 \POS"c"\ar@{-}@[|(3)]"a"
616 \POS(1.5,1.5)*{\bullet},*+!D{\vec y}
617 \end{xy}
619 \intercol=0.48cm
620 \begin{xy}
621 <\intercol,0pt>:<0pt,\intercol>::
622 \POS(-2,-1)="a"*+!U{0}
623 \POS(0,2)="c"*+!D{-}
624 \POS(4,-2)="w"*+!L{\vec w}
625 \POS"c"\ar@{-}@[|(3)]"a"
626 \POS"a"\ar@{-}@[|(3)]"w"
627 \POS"c"\ar@{--}@[|(3)]"w"
628 \POS(1.5,1.5)*{\bullet},*+!D{\vec y}
629 \end{xy}
631 \begin{xy}
632 <\intercol,0pt>:<0pt,\intercol>::
633 \POS(-2,-1)="a"*+!U{0}
634 \POS(2,0)="b"*+!U{+}
635 \POS(4,-2)="w"*+!L{\vec w}
636 \POS"a"\ar@{--}@[|(3)]"b"
637 \POS"a"\ar@{-}@[|(3)]"w"
638 \POS"b"\ar@{--}@[|(3)]"w"
639 \POS(1.5,1.5)*{\bullet},*+!D{\vec y}
640 \end{xy}
642 \intercol=0.48cm
643 \begin{xy}
644 <\intercol,0pt>:<0pt,\intercol>::
645 \POS(-2,-1)="a"*+!U{0}
646 \POS(2,0)="b"*+!U{+}
647 \POS(0,2)="c"*+!D{-}
648 \POS"a"\ar@{--}@[|(3)]"b"
649 \POS"b"\ar@{--}@[|(3)]"c"
650 \POS"c"\ar@{-}@[|(3)]"a"
651 \POS(4.7,-2.5)*{\bullet},*+!R{\vec y}
652 \end{xy}
654 \intercol=0.48cm
655 \begin{xy}
656 <\intercol,0pt>:<0pt,\intercol>::
657 \POS(-2,-1)="a"*+!U{0}
658 \POS(0,2)="c"*+!D{-}
659 \POS(4,-2)="w"*+!L{\vec w}
660 \POS"c"\ar@{-}@[|(3)]"a"
661 \POS"a"\ar@{--}@[|(3)]"w"
662 \POS"c"\ar@{--}@[|(3)]"w"
663 \POS(4.7,-2.5)*{\bullet},*+!R{\vec y}
664 \end{xy}
666 \begin{xy}
667 <\intercol,0pt>:<0pt,\intercol>::
668 \POS(-2,-1)="a"*+!U{0}
669 \POS(2,0)="b"*+!U{+}
670 \POS(4,-2)="w"*+!L{\vec w}
671 \POS"a"\ar@{-}@[|(3)]"b"
672 \POS"a"\ar@{--}@[|(3)]"w"
673 \POS"b"\ar@{--}@[|(3)]"w"
674 \POS(4.7,-2.5)*{\bullet},*+!R{\vec y}
675 \end{xy}
676 \end{align*}
677 \caption{Examples of decompositions in primal space.}
678 \label{fig:primal:examples}
679 \end{figure}
681 To see that there is a $\vec y$ satisfying the above constraints,
682 we need to show that $R \cap S$ is non-empty, with
683 $S = \{ \vec y \mid \sp{{\tilde n}_{i_kj_k}}y > 0 \text{ for all $k$}\}$.
684 It will be easier to show this set is non-empty when the $\vec u_i$ form
685 an orthogonal basis. Applying a non-singular linear transformation $T$
686 does not change the decomposition of $\vec w$ in terms of the $\vec u_i$ (i.e., the
687 $\alpha_i$ remain unchanged), nor does this change
688 any of the scalar products in the constraints that define $R \cap S$
689 (the normals are transformed by $\left(T^{-1}\right)^\T$).
690 Finding a vector $\vec y \in T(R \cap S)$ ensures that
691 $T^{-1}(\vec y) \in R \cap S$.
692 Without loss of generality, we can therefore assume for the purpose of
693 showing that $R \cap S$ is non-empty that
694 the $\vec u_i$ indeed form an orthogonal basis.
696 In the orthogonal basis, we have $\vec b_i^* = \vec u_i$
697 and the corresponding inward normal $\vec N_i$ is either
698 $\vec u_i$ or $-\vec u_i$.
699 Furthermore, each normal of a facet of $S$ of the first type is of the
700 form $\vec {\tilde n}_{i_kj_k} = a_k \vec u_{i_k} - b_k \vec u_{j_k}$, with
701 $a_k, b_k > 0$ and ${i_k} < {j_k}$,
702 while for the second type each normal is of the form
703 $\vec {\tilde n}_{i_kj_k} = -a_k \vec u_{i_k} - b_k \vec u_{j_k}$, with
704 $a_k, b_k > 0$.
705 If $\vec {\tilde n}_{i_kj_k} = a_k \vec u_{i_k} - b_k \vec u_{j_k}$
706 is the normal of a facet of $S$
707 then either
708 $(\vec N_{i_k}, \vec N_{j_k}) = (\vec u_{i_k}, \vec u_{j_k})$
710 $(\vec N_{i_k}, \vec N_{j_k}) = (-\vec u_{i_k}, -\vec u_{j_k})$.
711 Otherwise, the facet would not cut $R$.
712 Similarly,
713 if $\vec {\tilde n}_{i_kj_k} = -a_k \vec u_{i_k} - b_k \vec u_{j_k}$
714 is the normal of a facet of $S$
715 then either
716 $(\vec N_{i_k}, \vec N_{j_k}) = (\vec u_{i_k}, -\vec u_{j_k})$
718 $(\vec N_{i_k}, \vec N_{j_k}) = (-\vec u_{i_k}, \vec u_{j_k})$.
719 Assume now that $R \cap S$ is empty, then there exist
720 $\lambda_k, \mu_i \ge 0$ not all zero
721 such that
722 $\sum_k \lambda_k \vec {\tilde n}_{i_kj_k} + \sum_l \mu_i \vec N_i = \vec 0$.
723 Assume $\lambda_k > 0$ for some facet of the first type.
724 If $\vec N_{j_k} = -\vec u_{j_k}$, then $-b_k$ can only be canceled
725 by another facet $k'$ of the first type with $j_k = i_{k'}$, but then
726 also $\vec N_{j_{k'}} = -\vec u_{j_{k'}}$. Since the $j_k$ are strictly
727 increasing, this sequence has to stop with a strictly positive coefficient
728 for the largest $\vec u_{j_k}$ in this sequence.
729 If, on the other hand, $\vec N_{i_k} = \vec u_{i_k}$, then $a_k$ can only
730 be canceled by the normal of a facet $k'$ of the second kind
731 with $i_k = j_{k'}$, but then
732 $\vec N_{i_{k'}} = -\vec u_{i_{k'}}$ and we return to the first case.
733 Finally, if $\lambda_k > 0$ only for normals of facets of the second type,
734 then either $\vec N_{i_k} = -\vec u_{i_k}$ or $\vec N_{j_k} = -\vec u_{j_k}$
735 and so the coefficient of one of these basis vectors will be strictly
736 negative.
737 That is, the sum of the normals will never be zero and
738 the set $R \cap S$ is non-empty.
740 For each ray $\vec u_j$ of cone $K_i$, i.e., the cone with $\vec u_i$ replaced
741 by $\vec w$, we now need to determine whether the facet not containing this
742 ray is closed or not. We denote the (inward) normal of this cone by
743 $\vec n_{ij}$. Note that cone $K_j$ (if it appears in (\ref{eq:triangulations}),
744 i.e., $\alpha_j \ne 0$) has the same facet opposite $\vec u_i$
745 and its normal $\vec n_{ji}$ will be equal to either $\vec n_{ij}$ or
746 $-\vec n_{ij}$, depending on whether we are dealing with an ``external'' facet,
747 i.e., a facet of $K'$, or an ``internal'' facet.
748 If, on the other hand, $\alpha_j = 0$, then $\vec n_{ij} = \vec n_{0j}$.
749 If $\sp{n_{ij}}y > 0$, then the facet is closed.
750 Otherwise it is open.
751 It follows that the two (or more) occurrences of external facets are either all open
752 or all closed, while for internal facets, exactly one is closed.
754 First consider the facet not containing $\vec u_0 = \vec w$.
755 If $\alpha_i > 0$, then $\vec u_i$ and $\vec w$ are on the same side of the facet
756 and so $\vec n_{i0} = \vec n_{0i}$. Otherwise, $\vec n_{i0} = -\vec n_{i0}$.
757 Second, if $\alpha_j = 0$, then replacing $\vec u_i$ by $\vec w$ does not
758 change the affine hull of the facet and so $\vec n_{ij} = \vec n_{0j}$.
759 Now consider the case that $\alpha_i \alpha_j < 0$, i.e., $\vec u_i$
760 and $\vec u_j$ are on the same side of the hyperplane through the other rays.
761 If we project $\vec u_i$, $\vec u_j$ and $\vec w$ onto a plane orthogonal
762 to the ridge through the other rays, then the possible locations of $\vec w$
763 with respect to $\vec u_i$ and $\vec u_j$ are shown in Figure~\ref{fig:w:same}.
764 If both $\vec n_{0i}$ and $\vec n_{0j}$ are closed then $\vec y$ lies in region~1
765 and therefore $\vec n_{ij}$ (as well as $\vec n_{ji}$) is closed too.
766 Similarly, if both $\vec n_{0i}$ and $\vec n_{0j}$ are open then so is
767 $\vec n_{ij}$. If only one of the facets is closed, then, as explained above,
768 we choose $\vec n_{ij}$ to be open, i.e., we take $\vec y$ to lie in region~3
769 or~5.
770 Figure~\ref{fig:w:opposite} shows the possible configurations
771 for the case that $\alpha_i \alpha_j > 0$.
772 If exactly one of $\vec n_{0i}$ and $\vec n_{0j}$ is closed, then
773 $\vec y$ lies in region~3 or region~5 and therefore $\vec n_{ij}$ is closed iff
774 $\vec n_{0j}$ is closed.
775 Otherwise, as explained above, we choose $\vec n_{ij}$ to be closed if $i < j$.
777 \begin{figure}
778 \intercol=0.7cm
779 \begin{minipage}{0cm}
780 \begin{xy}
781 <\intercol,0pt>:<0pt,\intercol>::
782 \POS(-4,0)="a"\ar@[|(2)]@{-}(4,0)
783 \POS?(0)/\intercol/="b"\POS(2,0)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0i}}(0,0.75)}
784 \POS(2,0)*{\bullet},*+!U{\vec u_j}
785 \POS(-2,-3)="a"\ar@[|(2)]@{-}(2,3)
786 \POS?(0)/\intercol/="b"\POS(1,1.5)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0j}}(0,-0.75)}
787 \POS(1,1.5)*{\bullet},*+!R{\vec u_i}
788 \POS(-2,3)="a"\ar@{-}(2,-3)
789 \POS?(0)/\intercol/="b"\POS(1.5,-2.25)
790 *\xybox{"b"-"a":(0,0)\ar_{\vec n_{ji}}^{\vec n_{ij}}(0,+0.75)}
791 \POS(1.5,-2.25)*{\bullet},*+!R{\vec u_0 = \vec w}
792 \POS(0,0)*{\bullet}
793 \POS(3,1.5)*+[o][F]{\scriptstyle 1}
794 \POS(0,2.5)*+[o][F]{\scriptstyle 2}
795 \POS(-3,1.5)*+[o][F]{\scriptstyle 3}
796 \POS(-3,-1.5)*+[o][F]{\scriptstyle 4}
797 \POS(0,-3)*+[o][F]{\scriptstyle 5}
798 \POS(3,-1.5)*+[o][F]{\scriptstyle 6}
799 \end{xy}
800 \end{minipage}
801 \begin{minipage}{0cm}
802 \begin{xy}
803 <\intercol,0pt>:<0pt,\intercol>::
804 \POS(-4,0)="a"\ar@[|(2)]@{-}(4,0)
805 \POS?(0)/\intercol/="b"\POS(2,0)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0i}}(0,0.75)}
806 \POS(2,0)*{\bullet},*+!U{\vec u_j}
807 \POS(-2,-3)="a"\ar@[|(2)]@{-}(2,3)
808 \POS?(0)/\intercol/="b"\POS(1,1.5)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0j}}(0,-0.75)}
809 \POS(1,1.5)*{\bullet},*+!R{\vec u_i}
810 \POS(-2,3)="a"\ar@{-}(2,-3)
811 \POS?(0)/\intercol/="b"\POS(-1.5,2.25)
812 *\xybox{"b"-"a":(0,0)\ar_{\vec n_{ji}}^{\vec n_{ij}}(0,+0.75)}
813 \POS(-1.5,2.25)*{\bullet},*+!R{\vec u_0 = \vec w}
814 \POS(0,0)*{\bullet}
815 \POS(3,1.5)*+[o][F]{\scriptstyle 1}
816 \POS(0,2.5)*+[o][F]{\scriptstyle 2}
817 \POS(-3,1.5)*+[o][F]{\scriptstyle 3}
818 \POS(-3,-1.5)*+[o][F]{\scriptstyle 4}
819 \POS(0,-3)*+[o][F]{\scriptstyle 5}
820 \POS(3,-1.5)*+[o][F]{\scriptstyle 6}
821 \end{xy}
822 \end{minipage}
823 \caption{Possible locations of $\vec w$ with respect to $\vec u_i$ and
824 $\vec u_j$, projected onto a plane orthogonal to the other rays, when
825 $\alpha_i \alpha_j < 0$.}
826 \label{fig:w:same}
827 \end{figure}
829 \begin{figure}
830 \intercol=0.7cm
831 \begin{minipage}{0cm}
832 \begin{xy}
833 <\intercol,0pt>:<0pt,\intercol>::
834 \POS(-4,0)="a"\ar@[|(2)]@{-}(4,0)
835 \POS?(0)/\intercol/="b"\POS(2,0)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0i}}(0,0.75)}
836 \POS(2,0)*{\bullet},*+!U{\vec u_j}
837 \POS(-2,3)="a"\ar@[|(2)]@{-}(2,-3)
838 \POS?(0)/\intercol/="b"\POS(-1,1.5)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0j}}(0,+0.75)}
839 \POS(-1,1.5)*{\bullet},*+!R{\vec u_i}
840 \POS(-2,-3)="a"\ar@{-}(2,3)
841 \POS?(0)/\intercol/="b"\POS(1.5,2.25)
842 *\xybox{"b"-"a":(0,0)\ar^{\vec n_{ji}}(0,+0.75)
843 \POS(0,0)\ar_{\vec n_{ij}}(0,-0.75)}
844 \POS(1.5,2.25)*{\bullet},*+!L{\vec u_0 = \vec w}
845 \POS(0,0)*{\bullet}
846 \POS(3,1.5)*+[o][F]{\scriptstyle 1}
847 \POS(0,2.5)*+[o][F]{\scriptstyle 2}
848 \POS(-3,1.5)*+[o][F]{\scriptstyle 3}
849 \POS(-3,-1.5)*+[o][F]{\scriptstyle 4}
850 \POS(0,-3)*+[o][F]{\scriptstyle 5}
851 \POS(3,-1.5)*+[o][F]{\scriptstyle 6}
852 \end{xy}
853 \end{minipage}
854 \begin{minipage}{0cm}
855 \begin{xy}
856 <\intercol,0pt>:<0pt,\intercol>::
857 \POS(-4,0)="a"\ar@[|(2)]@{-}(4,0)
858 \POS?(0)/\intercol/="b"\POS(2,0)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0i}}(0,0.75)}
859 \POS(2,0)*{\bullet},*+!U{\vec u_j}
860 \POS(-2,3)="a"\ar@[|(2)]@{-}(2,-3)
861 \POS?(0)/\intercol/="b"\POS(-1,1.5)*\xybox{"b"-"a":(0,0)\ar^{\vec n_{0j}}(0,+0.75)}
862 \POS(-1,1.5)*{\bullet},*+!R{\vec u_i}
863 \POS(-2,-3)="a"\ar@{-}(2,3)
864 \POS?(0)/\intercol/="b"\POS(-1.5,-2.25)
865 *\xybox{"b"-"a":(0,0)\ar^{\vec n_{ji}}(0,+0.75)
866 \POS(0,0)\ar_{\vec n_{ij}}(0,-0.75)}
867 \POS(-1.5,-2.25)*{\bullet},*+!L{\vec u_0 = \vec w}
868 \POS(0,0)*{\bullet}
869 \POS(3,1.5)*+[o][F]{\scriptstyle 1}
870 \POS(0,2.5)*+[o][F]{\scriptstyle 2}
871 \POS(-3,1.5)*+[o][F]{\scriptstyle 3}
872 \POS(-3,-1.5)*+[o][F]{\scriptstyle 4}
873 \POS(0,-3)*+[o][F]{\scriptstyle 5}
874 \POS(3,-1.5)*+[o][F]{\scriptstyle 6}
875 \end{xy}
876 \end{minipage}
877 \caption{Possible locations of $\vec w$ with respect to $\vec u_i$ and
878 $\vec u_j$, projected onto a plane orthogonal to the other rays, when
879 $\alpha_i \alpha_j > 0$.}
880 \label{fig:w:opposite}
881 \end{figure}
883 The algorithm is summarized in Algorithm~\ref{alg:closed}, where
884 we use the convention that in cone $K_i$, $\vec u_i$ refers to
885 $\vec u_0 = \vec w$.
886 Note that we do not need any of the rays or normals in this code.
887 The only information we need is the closedness of the facets in the
888 original cone and the signs of the $\alpha_i$.
890 \begin{algorithm}
891 \begin{tabbing}
892 next \= next \= next \= \kill
893 if $\alpha_j = 0$ \\
894 \> closed[$K_i$][$\vec u_j$] := closed[$\tilde K$][$\vec u_j$] \\
895 else if $i = j$ \\
896 \> if $\alpha_j > 0$ \\
897 \> \> closed[$K_i$][$\vec u_j$] := closed[$\tilde K$][$\vec u_j$] \\
898 \> else \\
899 \> \> closed[$K_i$][$\vec u_j$] := $\lnot$closed[$\tilde K$][$\vec u_j$] \\
900 else if $\alpha_i \alpha_j > 0$ \\
901 \> if closed[$\tilde K$][$\vec u_i$] = closed[$\tilde K$][$\vec u_j$] \\
902 \> \> closed[$K_i$][$\vec u_j$] := $i < j$ \\
903 \> else \\
904 \> \> closed[$K_i$][$\vec u_j$] := closed[$\tilde K$][$\vec u_j$] \\
905 else \\
906 \> closed[$K_i$][$\vec u_j$] := closed[$\tilde K$][$\vec u_i$] and
907 closed[$\tilde K$][$\vec u_j$]
908 \end{tabbing}
909 \caption{Determine whether the facet opposite $\vec u_j$ is closed in $K_i$.}
910 \label{alg:closed}
911 \end{algorithm}
913 \subsection{Triangulation in primal space}
914 \label{s:triangulation}
916 As in the case for Barvinok's decomposition (Section~\ref{s:decomposition}),
917 we can transform a triangulation of a (closed) cone into closed simple cones
918 into a triangulation of half-open simple cones that fully partitions the
919 original cone, i.e., such that the half-open simple cones do not intersect at their
920 facets.
921 Again, we apply Proposition~\ref{p:inclusion-exclusion} with $\vec y$
922 an interior point of the cone (Section~\ref{s:interior}).
923 Note that the interior point $\vec y$ may still intersect
924 some of the internal facets, so we may need to perturb it slightly.
925 In practice, we apply a lexicographical rule: for such (internal)
926 facets, which always appear in pairs, we close the one with
927 a lexico-positive normal and open the one with a lexico-negative
928 normal.
930 \subsection{Multivariate quasi-polynomials as lists of polynomials}
932 There are many definitions for a (univariate) \ai{quasi-polynomial}.
933 \shortciteN{Ehrhart1977} uses a definition based on {\em periodic number}s.
935 \begin{definition}
936 \label{d:periodic:1}
937 A rational \defindex{periodic number} $U(p)$
938 is a function $\ZZ \to \QQ$,
939 such that there exists a \defindex{period} $q$
940 such that $U(p) = U(p')$ whenever $p \equiv p' \mod q$.
941 \end{definition}
943 \begin{definition}
944 \label{d:qp:1}
945 A (univariate)
946 \defindex{quasi-polynomial}\/ $f$ of degree $d$ is
947 a function
949 f(n) = c_d(n) \, n^d + \cdots + c_1(n) \, n + c_0
952 where $c_i(n)$ are rational periodic numbers.
953 I.e., it is a polynomial expression of degree $d$
954 with rational periodic numbers for coefficients.
955 The \defindex{period} of a quasi-polynomial is the \ac{lcm}
956 of the periods of its coefficients.
957 \end{definition}
959 Other authors (e.g., \shortciteNP{Stanley1986})
960 use the following definition of a quasi-polynomial.
961 \begin{definition}
962 \label{d:qp:1:list}
963 A function $f : \ZZ \to \QQ$ is
964 a (univariate) \defindex{quasi-polynomial} of period $q$ if there
965 exists a list of $q$ polynomials $g_i \in \QQ[T]$ for $0 \le i < q$ such
966 that
968 f (s) = g_i(s) \qquad \hbox{if $s \equiv i \mod {q}$}
971 The functions $g_i$ are called the {\em constituents}.
972 \index{constituent}
973 \end{definition}
975 In our implementation, we use Definition~\ref{d:qp:1},
976 but whereas
977 \shortciteN{Ehrhart1977} uses a list of $q$ rational
978 numbers enclosed in square brackets to represent periodic
979 numbers, our periodic numbers are polynomial expressions
980 in fractional parts (Section~\ref{a:data}).
981 These fractional parts naturally extend to multivariate
982 quasi-polynomials.
983 The bracketed (``explicit'') periodic numbers can
984 be extended to multiple variables by nesting them
985 (e.g., \shortciteNP{Loechner1999}).
987 Definition~\ref{d:qp:1:list} could be extended in a similar way
988 by having a constituent for each residue modulo a vector period $\vec q$.
989 However, as pointed out by \citeN{Woods2006personal}, this may not result
990 in the minimum number of constituents.
991 A vector period can be considered as a lattice with orthogonal generators and
992 the number of constituents is equal to the index or determinant of that lattice.
993 By considering more general lattices, we can potentially reduce the number
994 of constituents.
995 \begin{definition}
996 \label{d:qp}
997 A function $f : \ZZ^n \to \QQ$ is
998 a (multivariate) \defindex{quasi-polynomial} of period $L$ if there
999 exists a list of $\det L$ polynomials $g_{\vec i} \in \QQ[T_1,\ldots,T_n]$
1000 for $\vec i$ in the fundamental parallelepiped of $L$ such
1001 that
1003 f (\vec s) = g_{\vec i}(\vec s) \qquad \hbox{if $\vec s \equiv \vec i \mod L$}
1006 \end{definition}
1008 To compute the period lattice from a fractional representation, we compute
1009 the appropriate lattice for each fractional part and then take their intersection.
1010 Recall that the argument of each fractional part is an affine expression
1011 in the parameters $(\sp a p + c)/m$,
1012 with $\vec a \in \ZZ^n$ and $c, m \in \ZZ$.
1013 Such a fractional part is translation invariant over
1014 any (integer) value of $\vec p$
1015 such that $\sp a p + m t = 0$, for some $\vec t \in \ZZ$.
1016 Solving this homogeneous equation over the integers (in our implementation,
1017 we use \PolyLib/'s \ai[\tt]{SolveDiophantine}) gives the general solution
1019 \begin{bmatrix}
1020 \vec p \\ t
1021 \end{bmatrix}
1023 \begin{bmatrix}
1024 U_1 \\ U_2
1025 \end{bmatrix}
1026 \vec x
1027 \qquad\text{for $\vec x \in \ZZ^n$}
1030 The matrix $U_1 \in \ZZ^{n \times n}$ then has the generators of
1031 the required lattice as columns.
1032 The constituents are computed by plugging in each integer point
1033 in the fundamental parallelepiped of the lattice.
1034 These points themselves are computed as explained in Section~\ref{s:fundamental}.
1035 Note that for computing the constituents, it is sufficient to take any
1036 representative of the residue class. For example, we could take
1037 $\vec w^\T = \vec k^\T W$ in the notations of Lemma~\ref{l:fundamental}.
1039 \begin{example}[\shortciteN{Woods2006personal}]
1040 Consider the parametric polytope
1042 P_{s,t}=\{\, x \mid 0 \le x \le (s+t)/2 \,\}
1045 The enumerator of $P_{s,t}$ is
1047 \begin{cases}
1048 \frac s 2 + \frac t 2 + 1 &
1049 \text{if $\begin{bmatrix}s \\ t \end{bmatrix} \in
1050 \begin{bmatrix}
1051 -1 & -2 \\ 1 & 0
1052 \end{bmatrix}
1053 \ZZ^2 +
1054 \begin{bmatrix}
1055 0 \\ 0
1056 \end{bmatrix}
1059 \frac s 2 + \frac t 2 + \frac 1 2 &
1060 \text{if $\begin{bmatrix}s \\ t \end{bmatrix} \in
1061 \begin{bmatrix}
1062 -1 & -2 \\ 1 & 0
1063 \end{bmatrix}
1064 \ZZ^2 +
1065 \begin{bmatrix}
1066 -1 \\ 0
1067 \end{bmatrix}
1070 \end{cases}
1072 The corresponding output of \ai[\tt]{barvinok\_enumerate} is
1073 \begin{verbatim}
1074 s + t >= 0
1075 1 >= 0
1077 Lattice:
1078 [[-1 1]
1079 [-2 0]
1081 [0 0]
1082 ( 1/2 * s + ( 1/2 * t + 1 )
1084 [-1 0]
1085 ( 1/2 * s + ( 1/2 * t + 1/2 )
1087 \end{verbatim}
1088 \end{example}
1090 \subsection{Left inverse of an affine embedding}
1091 \label{s:inverse}
1093 We often map a polytope onto a lower dimensional space to remove possible
1094 equalities in the polytope. These maps are typically represented
1095 by the inverse, mapping the coordinates $\vec x'$ of the lower-dimensional
1096 space to the coordinates $\vec x$ of (an affine subspace of) the original space,
1097 i.e.,
1099 \begin{bmatrix}
1100 \vec x \\ 1
1101 \end{bmatrix}
1103 \begin{bmatrix}
1104 T & \vec v \\ \vec 0^\T & 1
1105 \end{bmatrix}
1106 \begin{bmatrix}
1107 \vec x' \\ 1
1108 \end{bmatrix}
1111 where, as usual in \PolyLib/, we work with homogeneous coordinates.
1112 To obtain the transformation that maps the coordinates of the original
1113 space to the coordinates of the lower dimensional space,
1114 we need to compute the \ai{left inverse} of the above \ai{affine embedding},
1115 i.e., an $A$, $\vec b$ and $d$ such that
1118 \begin{bmatrix}
1119 \vec x' \\ 1
1120 \end{bmatrix}
1122 \begin{bmatrix}
1123 A & \vec b \\ \vec 0^\T & d
1124 \end{bmatrix}
1125 \begin{bmatrix}
1126 \vec x \\ 1
1127 \end{bmatrix}
1130 To compute this left inverse, we first compute the
1131 (right) \indac{HNF} of T,
1133 \begin{bmatrix}
1134 U_1 \\ U_2
1135 \end{bmatrix}
1138 \begin{bmatrix}
1139 H \\ 0
1140 \end{bmatrix}
1143 The left inverse is then simply
1145 \begin{bmatrix}
1146 d H^{-1}U_1 & -d H^{-1} \vec v \\ \vec 0^\T & d
1147 \end{bmatrix}
1150 We often also want a description of the affine subspace that is the range
1151 of the affine embedding and this is given by
1153 \begin{bmatrix}
1154 U_2 & - U_2 \vec v \\ \vec 0^T & 1
1155 \end{bmatrix}
1156 \begin{bmatrix}
1157 \vec x \\ 1
1158 \end{bmatrix}
1160 \vec 0
1163 This computation is implemented in \ai[\tt]{left\_inverse}.
1165 \subsection{Integral basis of the orthogonal complement of a linear subspace}
1166 \label{s:completion}
1168 Let $M_1 \in \ZZ^{m \times n}$ be a basis of a linear subspace.
1169 We first extend $M_1$ with zero rows to obtain a square matrix $M'$
1170 and then compute the (left) \indac{HNF} of $M'$,
1172 \begin{bmatrix}
1173 M_1 \\ 0
1174 \end{bmatrix}
1176 \begin{bmatrix}
1177 H & 0 \\ 0 & 0
1178 \end{bmatrix}
1179 \begin{bmatrix}
1180 Q_1 \\ Q_2
1181 \end{bmatrix}
1184 The rows of $Q_2$ span the orthogonal complement of the given subspace.
1185 Since $Q_2$ can be extended to a unimodular matrix, these rows form
1186 an integral basis.
1188 If the entries on the diagonal of $H$ are all $1$ then $M_1$
1189 can be extended to a unimodular matrix, by concatenating $M_1$ and $Q_2$.
1190 The resulting matrix is unimodular, since
1192 \begin{bmatrix}
1193 M_1 \\ Q_2
1194 \end{bmatrix}
1196 \begin{bmatrix}
1197 H & 0 \\ 0 & I_{n-m,n-m}
1198 \end{bmatrix}
1199 \begin{bmatrix}
1200 Q_1 \\ Q_2
1201 \end{bmatrix}
1204 This method for extending a matrix of which
1205 only a few lines are known to a \ai{unimodular matrix}
1206 is more general than the method described by \shortciteN{Bik1996PhD},
1207 which only considers extending a matrix given by a single row.
1209 \subsection{Ensuring a polyhedron has only revlex-positive rays}
1210 \label{s:revlexpos}
1212 The \ai[\tt]{barvinok\_series\_with\_options} function and all
1213 further \ai[\tt]{gen\_fun} manipulations assume that the effective
1214 parameter domain has only \ai{revlex-positive} rays.
1215 When used to computer \rgf/s, the \ai[\tt]{barvinok\_enumerate}
1216 application will therefore transform the effective parameter domain
1217 of a problem if it has revlex-negative rays.
1218 It will then not compute the generating function
1220 f(\vec x) = \sum_{\vec p \in \ZZ^m} \#(P_{\vec p} \cap \ZZ^d) \, x^{\vec p}
1225 g(\vec z) = \sum_{\vec p' \in \ZZ^n}
1226 \#(P_{T \vec p' + \vec t} \cap \ZZ^d) \, x^{\vec p'}
1228 instead, where $\vec p = T \vec p' + \vec t$,
1229 with $T \in \ZZ^{m \times n}$ and $\vec t \in \ZZ^m$, is an affine transformation
1230 that maps the transformed parameter space back to the original parameter space.
1232 First assume that the parameter domain does not contain any lines and
1233 that there are no equalities in the description of $P_{\vec p}$ that force
1234 the values of $\vec p$ for which $P_{\vec p}$ contains integer points
1235 to lie on a non-standard lattice.
1236 Let the effective parameter domain be given as
1238 \{\, \vec p \mid A \vec p + \vec c \ge \vec 0 \,\}
1240 where $A \in \ZZ^{s \times d}$ of row rank $d$;
1241 otherwise the effective parameter domain would contain a line.
1242 Let $H$ be the (left) \indac{HNF} of $A$, i.e.,
1244 A = H Q
1247 with $H$ lower-triangular with positive diagonal elements and
1248 $Q$ unimodular.
1249 Let $\tilde Q$ be the matrix obtained from $Q$ by reversing its rows,
1250 and, similarly, $\tilde H$ from $H$ by reversing the columns.
1251 After performing the transformation
1252 $\vec p' = \tilde Q \vec p$, i.e.,
1253 $\vec p = \tilde Q^{-1} \vec p'$, the transformed parameter domain
1254 is given by
1256 \{\, \vec p' \mid A \tilde Q^{-1} \vec p' + \vec c \ge \vec 0 \,\}
1260 \{\, \vec p' \mid \tilde H \vec p' + \vec c \ge \vec 0 \,\}
1263 The first constraint of this domain is
1264 $h_{11} p'_m + c_1 \ge 0$. A ray with non-zero final coordinate
1265 therefore has a positive final coordinate.
1266 Similarly, the second constraint is
1267 $h_{22} p'_{m-1} + h_{21} p'_m + c_2 \ge 0$.
1268 A ray with zero $n$th coordinate, but non-zero $n-1$st coordinate,
1269 will therefore have a positive $n-1$st coordinate.
1270 Continuing this reasoning, we see that all rays in the transformed
1271 domain are revlex-positive.
1273 If the parameter domain does contains lines, but is not restricted
1274 to a non-standard lattice, then the number of points in the parametric
1275 polytope is invariant over a translation along the lines.
1276 It is therefore sufficient to compute the number of points in the
1277 orthogonal complement of the linear subspace spanned by the lines.
1278 That is, we apply a prior transformation that maps a reduced parameter
1279 domain to this subspace,
1281 \vec p = L^\perp \vec p' =
1282 \begin{bmatrix}
1283 L & L^\perp
1284 \end{bmatrix}
1285 \begin{bmatrix}
1286 0 \\ I
1287 \end{bmatrix}
1288 \vec p'
1291 where $L$ has the lines as columns, and $L^\perp$ an integral basis
1292 for the orthogonal complement (Section~\ref{s:completion}).
1293 Note that the inverse transformation
1295 \vec p' =
1296 L^{-\perp}
1297 \vec p =
1298 \begin{bmatrix}
1299 0 & I
1300 \end{bmatrix}
1301 \begin{bmatrix}
1302 L & L^\perp
1303 \end{bmatrix}^{-1}
1304 \vec p
1306 has integral coefficients since $L^\perp$ can be extended to a unimodular matrix.
1308 If the parameter values $\vec p$ for which $P_{\vec p}$ contains integer points
1309 are restricted to a non-standard lattice, we first replace the parameters
1310 by a different set of parameters that lie on the standard lattice
1311 through ``\ai{parameter compression}''\shortcite{Meister2004PhD},
1313 \vec p = C \vec p'
1316 The (left) inverse of $C$ can be computes as explained in
1317 Section~\ref{s:inverse}, giving
1319 \vec p' = C^{-L} \vec p
1322 We have to be careful to only apply this transformation when
1323 both the equalities computed in Section~\ref{s:inverse} are satisfied
1324 and some additional divisibility constraints.
1325 In particular if $\vec a^\T/d$ is a row of $C^{-L}$, with $\vec a \in \ZZ^{n'}$
1326 and $d \in \ZZ$, the transformation can only be applied to parameter values
1327 $\vec p$ such that $d$ divides $\sp a p$.
1329 The complete transformation is given by
1331 \vec p = C L^\perp \hat Q^{-1} \vec p'
1335 \vec p' = \hat Q L^{-\perp} C^{-L} \vec p
1339 \subsection{Parametric Volume Computation}
1341 The \ai{volume} of a (parametric) polytope can serve as an approximation
1342 for the number of integer points in the polytope.
1343 We basically follow the description of~\shortciteN{Rabl2006} here, except that we
1344 focus on volume computation for {\em linearly}
1345 parametrized polytopes, which we exploit to determine the sign
1346 of the determinants we compute, as explained below.
1348 Note first that
1349 the vertices of a linearly parametrized polytope are affine expressions
1350 in the parameters that may be valid only in parts (chambers)
1351 of the parameter domain.
1352 Since the volume computation is based on the (active) vertices, we perform
1353 the computation in each chamber separately.
1354 Also note that since the vertices are affine expressions, it is
1355 easy to check whether they belong to a facet.
1357 The volume of a $d$-simplex, i.e., a $d$-dimensional polytope with
1358 $d+1$ vertices, is relatively easy to compute.
1359 In particular, if $\vec v_i(\vec p)$, for $0 \le i \le d$,
1360 are the (parametric) vertices
1361 of the simplex $P$ then
1362 \begin{equation}
1363 \label{eq:volume}
1364 \vol P =
1365 \frac 1 {d!}
1366 \left|
1367 \det
1368 \begin{bmatrix}
1369 v_{11}(\vec p) - v_{01}(\vec p) &
1370 v_{12}(\vec p) - v_{02}(\vec p) &
1371 \ldots &
1372 v_{1d}(\vec p) - v_{0d}(\vec p)
1374 v_{21}(\vec p) - v_{01}(\vec p) &
1375 v_{22}(\vec p) - v_{02}(\vec p) &
1376 \ldots &
1377 v_{2d}(\vec p) - v_{0d}(\vec p)
1379 \vdots & \vdots & \ddots & \vdots
1381 v_{d1}(\vec p) - v_{01}(\vec p) &
1382 v_{d2}(\vec p) - v_{02}(\vec p) &
1383 \ldots &
1384 v_{dd}(\vec p) - v_{0d}(\vec p)
1385 \end{bmatrix}
1386 \right|.
1387 \end{equation}
1389 If $P$ is not a simplex, i.e., $N > d+1$, with $N$ the number of
1390 vertices of $P$, then the standard way of computing the volume of $P$
1391 is to first {\em triangulate} $P$, i.e., subdivide $P$ into simplices,
1392 and then to compute and sum the volumes of the resulting simplices.
1393 One way of computing a triangulation is to
1394 compute the \ai{barycenter}
1396 \frac 1 N \sum_i \vec v_i(\vec p)
1398 of $P$
1399 and to perform a subdivision by computing the convex hulls
1400 of the barycenter with each of the facets of $P$.
1401 If a given facet of $P$ is itself a simplex, then this convex hull
1402 is also a simplex. Otherwise the facet is further subdivided.
1403 This recursive process terminates as every $1$-dimensional polytope
1404 is a simplex.
1406 The triangulation described above is known as
1407 the boundary triangulation~\shortcite{Bueler2000exact} and is used
1408 by \shortciteN{Rabl2006} in his implementation.
1409 The Cohen-Hickey triangulation~\shortcite{Cohen1979volumes,Bueler2000exact}
1410 is a much more efficient variation and uses one of the vertices
1411 instead of the barycenter. The facets incident on the vertex
1412 do not have to be considered in this case because the resulting subpolytopes
1413 would have zero volume.
1414 Another possibility is to use a
1415 ``lifting'' triangulation~\shortcite{Lee1991,DeLoera1995}.
1416 In this triangulation, each vertex is assigned a (random) ``height'' in
1417 an extra dimension.
1418 The projection of the ``lower envelope'' of the resulting polytope onto
1419 the original space results in a subdivision, which is a triangulation
1420 with very high probability.
1422 A complication with the lifting triangulation is that the constraint system
1423 of the lifted polytope will in general not be linearly parameterized,
1424 even if the original polytope is.
1425 It is, however, sufficient to perform the triangulation for a particular
1426 value of the parameters inside the chamber since the parametric polytope
1427 has the same combinatorial structure throughout the chamber.
1428 The triangulation obtained for the instantiated vertices can then
1429 be carried over to the corresponding parametric vertices.
1430 We only need to be careful to select a value for the parameters that
1431 does not lie on any facet of the chambers. On these chambers, some
1432 of the vertices may coincide.
1433 For linearly parametrized polytopes, it is easy to find a parameter
1434 point in the interior of a chamber, as explained in Section~\ref{s:interior}.
1435 Note that this point need not be integer.
1437 A direct application of the above algorithm, using any of the triangulations,
1438 would yield for each chamber
1439 a volume expressed as the sum of the absolute values of polynomials in
1440 the parameters. To remove the absolute value, we plug in a particular
1441 value of the parameters (not necessarily integer)
1442 belonging to the given chamber for which we know that the volume is non-zero.
1443 Again, it is sufficient to take any point in the interior of the chamber.
1444 The sign of the resulting value then determines the sign of the whole
1445 polynomial since polynomials are continuous functions and will not change
1446 sign without passing through zero.
1448 \subsection{Maclaurin series division}
1449 \label{s:division}
1451 If $P(t)$ and $Q(t)$ are two Maclaurin series
1452 \begin{align*}
1453 P(t) & = a_0 + a_1 t + a_2 t^2 + \cdots \\
1454 Q(t) & = b_0 + b_1 t + b_2 t^2 + \cdots
1456 \end{align*}
1457 then, as outlined by \shortciteN[241--247]{Henrici1974},
1458 we can compute the coefficients $c_l$ in
1460 \frac{P(t)}{Q(t)} =: c_0 + c_1 t + c_2 t^2 + \cdots
1462 by applying the recurrence relation
1464 c_l = \frac 1 {b_0} \left( a_l - \sum_{i=1}^l b_i c_{l-i} \right)
1467 To avoid dealing with denominators, we can also compute
1468 $d_l = b_0^{l+1} c_l$ instead as
1470 d_l = b_0^l a_l - \sum_{i=1}^l b_0^{i-1} b_i c_{l-i}
1473 The coefficients $c_l$ can then be directly read off as
1475 c_l = \frac{d_l}{b_0^{l+1}}
1479 \subsection{Specialization through exponential substitution}
1481 This section draws heavily from \shortciteN{Koeppe2006experiments}.
1483 After computing the \rgf/ of a polytope,
1484 \begin{equation}
1485 \label{eq:rgf}
1486 f(\vec x)=
1487 \sum_{i\in I}\alpha_i
1488 \frac{\sum_{k=1}^{r} \vec x^{\vec w_{ik} }}
1489 {\prod_{j=1}^{d}\left(1-\vec x^{\vec b_{ij}}\right)}
1491 \end{equation}
1492 the number of lattice points in the polytope can be obtained
1493 by evaluating $f(\vec 1)$. Since $\vec 1$ is a pole of each
1494 term, we need to compute the constant term in the Laurent expansions
1495 of each term in~\eqref{eq:rgf} about $\vec 1$.
1496 Since it is easier to work with univariate series, a substitution is usually
1497 applied, either a \ai{polynomial substitution}
1499 \vec x = (1+t)^{\vec \lambda}
1502 as implemented in \LattE/ \shortcite{latte1.1},
1503 or an \ai{exponential substitution} (see, e.g., \shortciteNP{Barvinok1999}),
1505 \vec x = e^{t \vec \lambda}
1508 as implemented in \LattEmk/ \shortcite{latte-macchiato}.
1509 In each case, $\vec \lambda \in \ZZ^d$ is a vector that is not orthogonal
1510 to any of the $\vec b_{ij}$.
1511 Both substitutions also transform the problem of computing the
1512 constant term in the Laurent expansions about $\vec x = \vec 1$
1513 to that of computing the constant term in the
1514 Laurent expansions about $t = 0$.
1516 Consider now one of the terms in~\eqref{eq:rgf},
1518 g(t) =
1519 \frac{\sum_{k=1}^{r} e^{a_k t}}
1520 {\prod_{j=1}^{d}\left(1-e^{c_j t}\right)}
1523 with $a_k = \sp{w_{ik}}{\lambda}$ and $c_j = \sp{b_{ij}}{\lambda}$.
1524 We rewrite this equation as
1526 g(t) =
1527 (-1)^d
1528 \frac{\sum_{k=1}^{r} e^{a_k t}}
1529 {t^d \prod_{j=1}^d c_j}
1530 \prod_{j=1}^d \frac{-c_j t}
1531 {1-e^{c_j t}}
1534 The second factor is analytic in a neighborhood of the origin
1535 $x = c_1 = \cdots = c_d = 0$ and therefore has a Taylor series expansion
1536 \begin{equation}
1537 \label{eq:todd}
1538 \prod_{j=1}^d \frac{-c_j t}
1539 {1-e^{c_j t}}
1541 \sum_{m=0}^{\infty} \todd_m(-c_1, \ldots, -c_d) t^m
1543 \end{equation}
1544 where $\todd_m$ is a homogeneous polynomial of degree $m$ called
1545 the $m$-th \ai{Todd polynomial}~\cite{Barvinok1999}.
1546 Also expanding the numerator in the first factor, we find
1548 g(t) = \frac{(-1)^d}{t^d \prod_{j=1}^d c_j}
1549 \left(
1550 \sum_{n=0}^{\infty}\frac{\sum_{k=1}^{r} a_k^n}{n!}
1551 \right)
1552 \left(
1553 \sum_{m=0}^{\infty} \todd_m(-c_1, \ldots, -c_d) t^m
1554 \right)
1557 with constant term
1558 \begin{multline}
1559 \label{eq:todd:constant}
1560 \frac{(-1)^d}{t^d \prod_{j=1}^d c_j}
1561 \left(\sum_{i=0}^d \frac{\sum_{k=1}^{r} a_k^i}{i!}
1562 \todd_{d-i}(-c_1, \ldots, -c_d)\right)t^d
1563 = \\
1564 \frac{(-1)^d}{\prod_{j=1}^d c_j}
1565 \sum_{i=0}^d \frac{\sum_{k=1}^{r} a_k^i}{i!} \todd_{d-i}(-c_1, \ldots, -c_d)
1567 \end{multline}
1568 To compute the first $d+1$ terms in the Taylor series~\eqref{eq:todd},
1569 we write down the truncated Taylor series
1571 \frac{e^t -1}t \equiv
1572 \sum_{i=0}^d \frac 1{(i+1)!} t^i \equiv
1573 \frac 1 {(d+1)!} \sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i
1574 \mod t^{d+1}
1577 where we have
1579 \frac 1 {(d+1)!} \sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i
1580 \in \frac 1{(d+1)!} \ZZ[t]
1583 Computing the reciprocal as explained in Section~\ref{s:division},
1584 we find
1585 \begin{equation}
1586 \label{eq:t-exp-1}
1587 \frac{t}{e^t-1} = \frac 1{\frac{e^t -1}t}
1588 \equiv (d+1)! \frac 1{\sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i}
1589 =: \sum_{i=0}^d b_i t^i
1591 \end{equation}
1592 Note that the constant term of the denominator is $1/(d+1)!$.
1593 The denominators of the quotient are therefore $((d+1)!)^{i+1}/(d+1)!$.
1594 Also note that the $b_i$ are independent of the generating function
1595 and can be computed in advance.
1596 An alternative way of computing the $b_i$ is to note that
1598 \frac{t}{e^t-1} = \sum_{i=0}^\infty B_i \frac{t^i}{i!}
1601 with $B_i = i! \, b_i$ the \ai{Bernoulli number}s, which can be computed
1602 using the recurrence~\eqref{eq:Bernoulli} (see Section~\ref{s:nested}).
1604 Substituting $t$ by $c_j t$ in~\eqref{eq:t-exp-1}, we have
1606 \frac{-c_j t}{1-e^{c_j t}} = \sum_{i=0}^d b_i c_j^i t^i
1609 Multiplication of these truncated Taylor series for each $c_j$
1610 results in the first $d+1$ terms of~\eqref{eq:todd},
1612 \sum_{m=0}^{d} \todd_m(-c_1, \ldots, -c_d) t^m
1614 \sum_{m=0}^{d} \frac{\beta_m}{((d+1)!)^m} t^m
1617 from which
1618 it is easy to compute the constant term~\eqref{eq:todd:constant}.
1619 Note that this convolution can also be computed without the use
1620 of rational coefficients,
1622 \frac{(-1)^d}{\prod_{j=1}^d c_j}
1623 \sum_{i=0}^d \frac{\alpha_i}{i!} \frac{\beta_{d-i}}{((d+1)!)^{d-i}}
1625 \frac{(-1)^d}{((d+1)!)^d\prod_{j=1}^d c_j}
1626 \sum_{i=0}^d \left(\frac{((d+1)!)^i}{i!}\alpha_i\right) \beta_{d-i}
1629 with $\alpha_i = \sum_{k=1}^{r} a_k^i$.
1631 \begin{example}
1632 Consider the \rgf/
1633 \begin{multline*}
1634 \f T x =
1635 \frac{x_1^2}{(1-x_1^{-1})(1-x_1^{-1}x_2)}
1637 \frac{x_2^2}{(1-x_2^{-1})(1-x_1 x_2^{-1})}
1638 + {} \\
1639 \frac1{(1-x_1)(1-x_2)}
1640 \end{multline*}
1641 from \shortciteN[Example~39]{Verdoolaege2005PhD}.
1642 Since this is a 2-dimensional problem, we first compute the first
1643 3 Todd polynomials (evaluated at $-1$),
1645 \frac{e^t -1}t \equiv
1646 1 + \frac 1 2 t + \frac 1 7 t^2 =
1647 \frac 1 6
1648 \begin{bmatrix}
1649 6 & 3 & 1
1650 \end{bmatrix}
1654 \frac t{e^t -1} \equiv
1655 \begin{bmatrix}
1656 \displaystyle\frac{-1}{1} & \displaystyle\frac{3}{6} & \displaystyle\frac{-3}{36}
1657 \end{bmatrix}
1660 where we represent each truncated power series by a vector of its
1661 coefficients.
1662 The vector $\vec\lambda = (1, -1)$ is not
1663 orthogonal to any of the rays, so we can use the substitution
1664 $\vec x = e^{(1, -1)t}$
1665 and obtain
1667 \frac{e^{2t}}{(1-e^{-t})(1-e^{-2t})}
1669 \frac{e^{-2t}}{(1-e^{t})(1-e^{2t})}
1671 \frac1{(1-e^{t})(1-e^{-t})}
1674 We have
1675 \begin{align*}
1676 \frac{t}{1-e^{- t}} & =
1677 \begin{bmatrix}
1678 \displaystyle\frac{-1}{1} & \displaystyle\frac{-3}{6} & \displaystyle\frac{-3}{36}
1679 \end{bmatrix}
1681 \frac{2t}{1-e^{-2 t}} & =
1682 \begin{bmatrix}
1683 \displaystyle\frac{-1}{1} & \displaystyle\frac{-6}{6} & \displaystyle\frac{-12}{36}
1684 \end{bmatrix}
1686 \frac{-t}{1-e^{t}} & =
1687 \begin{bmatrix}
1688 \displaystyle\frac{-1}{1} & \displaystyle\frac{3}{6} & \displaystyle\frac{-3}{36}
1689 \end{bmatrix}
1691 \frac{-2t}{1-e^{2t}} & =
1692 \begin{bmatrix}
1693 \displaystyle\frac{-1}{1} & \displaystyle\frac{6}{6} & \displaystyle\frac{-12}{36}
1694 \end{bmatrix}
1696 \end{align*}
1697 The first term in the \rgf/ evaluates to
1698 \begin{align*}
1700 \frac 1{-1 \cdot -2}
1701 \begin{bmatrix}
1702 \displaystyle\frac{1}{1} & \displaystyle\frac{2}{1} & \displaystyle\frac{4}{2}
1703 \end{bmatrix}
1705 \left(
1706 \begin{bmatrix}
1707 \displaystyle\frac{-1}{1} & \displaystyle\frac{-3}{6} & \displaystyle\frac{-3}{36}
1708 \end{bmatrix}
1709 \begin{bmatrix}
1710 \displaystyle\frac{-1}{1} & \displaystyle\frac{-6}{6} & \displaystyle\frac{-12}{36}
1711 \end{bmatrix}
1712 \right)
1714 = {} &
1715 \frac 1{2}
1716 \begin{bmatrix}
1717 \displaystyle\frac{1}{1} & \displaystyle\frac{2}{1} & \displaystyle\frac{4}{2}
1718 \end{bmatrix}
1720 \begin{bmatrix}
1721 \displaystyle\frac{1}{1} & \displaystyle\frac{9}{6} & \displaystyle\frac{33}{36}
1722 \end{bmatrix}
1724 = {} &
1725 \frac 1{72}
1726 \begin{bmatrix}
1727 1 & 2 \cdot 6 & 4 \cdot 18
1728 \end{bmatrix}
1730 \begin{bmatrix}
1731 1 & 9 & 33
1732 \end{bmatrix}
1733 = \frac {213}{72} = \frac{71}{24}
1735 \end{align*}
1736 Due to symmetry, the second term evaluates to the same value,
1737 while for the third term we find
1739 \frac{1}{-1\cdot 1 \cdot 36}
1740 \begin{bmatrix}
1741 1 & 0 \cdot 6 & 0 \cdot 18
1742 \end{bmatrix}
1744 \begin{bmatrix}
1745 1 & 0 & -3
1746 \end{bmatrix}
1748 \frac{-3}{-36} = \frac 1{12}
1751 The sum is
1753 \frac{71}{24} + \frac{71}{24} + \frac 1{12} = 6
1756 \end{example}
1758 Note that the run-time complexities of polynomial and exponential
1759 substitution are basically the same. The experiments of
1760 \citeN{Koeppe2006primal} are somewhat misleading in this respect
1761 since the polynomial substitution (unlike the exponential
1762 substitution) had not been optimized to take full
1763 advantage of the stopped Barvinok decomposition.
1764 For comparison, \autoref{t:hickerson} shows running times
1765 for the same experiments of that paper, but using
1766 barvinok version \verb+barvinok-0.23-47-gaa9024e+
1767 on an Athlon MP 1500+ with 512MiB internal memory.
1768 This machine appears to be slightly slower than the
1769 machine used in the experiments of \citeN{Koeppe2006primal}
1770 as computing {\tt hickerson-14} using the dual decomposition
1771 with polynomial substitution an maximal index 1
1772 took 2768 seconds on this machine using \LattEmk/.
1773 At this stage, it is not clear yet why the number of
1774 cones in the dual decomposition of {\tt hickerson-13}
1775 differs from that of \LattE/~\shortcite{latte1.1} and
1776 \LattEmk/~\cite{latte-macchiato}.
1777 We conclude from \autoref{t:hickerson} that (our implementation of)
1778 the exponential substitution is always slightly faster than
1779 (our implementation of) the polynomial substitution.
1780 The optimal maximal index for these examples is about 500,
1781 which agrees with the experiments of \citeN{Koeppe2006primal}.
1783 \begin{table}
1784 \begin{center}
1785 \begin{tabular}{rrrrrrr}
1786 \hline
1788 \multicolumn{3}{c}{Dual decomposition} &
1789 \multicolumn{3}{c}{Primal decomposition}
1792 & \multicolumn{2}{c}{Time (s)} &
1793 & \multicolumn{2}{c}{Time (s)}
1795 \cline{3-4}
1796 \cline{6-7}
1797 Max.\ index & Cones & Poly & Exp & Cones & Poly & Exp \\
1798 \hline
1799 \multicolumn{7}{c}{{\tt hickerson-12}}
1801 \hline
1802 1 & 11625 & 9.24 & 8.90 & 7929 & 4.80 & 4.55
1804 10 & 4251 & 4.32 & 4.19 & 803 & 0.66 & 0.62
1806 100 & 980 & 1.42 & 1.35 & 84 & 0.13 & 0.12
1808 200 & 550 & 1.00 & 0.92 & 76 & 0.12 & 0.12
1810 300 & 474 & 0.93 & 0.86 & 58 & 0.12 & 0.10
1812 500 & 410 & 0.90 & 0.83 & 42 & 0.10 & 0.10
1814 1000 & 130 & 0.42 & 0.38 & 22 & {\bf 0.10} & {\bf 0.07}
1816 2000 & 10 & {\bf 0.10} & {\bf 0.10} & 22 & 0.10 & 0.09
1818 5000 & 7 & 0.12 & 0.11 & 7 & 0.12 & 0.10
1820 \hline
1821 \multicolumn{7}{c}{{\tt hickerson-13}}
1823 \hline
1824 1 & 494836 & 489 & 463 & 483507 & 339 & 315
1826 10 & 296151 & 325 & 309 & 55643 & 51 & 48
1828 100 & 158929 & 203 & 192 & 9158 & 11 & 10
1830 200 & 138296 & 184 & 173 & 6150 & 9 & 8
1832 300 & 110438 & 168 & 157 & 4674 & 8 & 7
1834 500 & 102403 & 163 & 151 & 3381 & {\bf 8} & {\bf 7}
1836 1000 & 83421 & {\bf 163} & {\bf 149} & 2490 & 8 & 7
1838 2000 & 77055 & 170 & 153 & 1857 & 10 & 8
1840 5000 & 57265 & 246 & 211 & 1488 & 13 & 11
1842 10000 & 50963 & 319 & 269 & 1011 & 26 & 21
1844 \hline
1845 \multicolumn{7}{c}{{\tt hickerson-14}}
1847 \hline
1848 1 & 1682743 & 2171 & 2064 & 552065 & 508 & 475
1850 10 & 1027619 & 1453 & 1385 & 49632 & 62 & 59
1852 100 & 455474 & 768 & 730 & 8470 & 14 & 13
1854 200 & 406491 & 699 & 661 & 5554 & 11 & 10
1856 300 & 328340 & 627 & 590 & 4332 & 11 & 9
1858 500 & 303566 & 605 & 565 & 3464 & {\bf 11} & {\bf 9}
1860 1000 & 232626 & {\bf 581} & {\bf 532} & 2384 & 12 & 10
1862 2000 & 195368 & 607 & 545 & 1792 & 14 & 12
1864 5000 & 147496 & 785 & 682 & 1276 & 19 & 16
1866 10000 & 128372 & 966 & 824 & 956 & 29 & 23
1868 \hline
1869 \end{tabular}
1870 \caption{Timing results of dual and primal decomposition with
1871 polynomial or exponential substitution on the Hickerson examples}
1872 \label{t:hickerson}
1873 \end{center}
1874 \end{table}
1876 \subsection{Approximate Enumeration using Nested Sums}
1877 \label{s:nested}
1879 If $P \in \QQ^d$ is a polyhedron and $p(\vec x) \in \QQ[\vec x]$ is a
1880 polynomial and we want to sum $p(\vec x)$ over all integer values
1881 of (a subset of) the variables $\vec x$, then we can do this incrementally
1882 by taking a variable $x_1$ with lower bound $L(\vec{\hat x})$
1883 and upper bound $U(\vec{\hat x})$, with $\vec{\hat x} = (x_2, \ldots, x_d)$,
1884 and computing
1885 \begin{equation}
1886 \label{eq:nested:sum}
1887 Q(\vec{\hat x}) = \sum_{x_1 = L(\vec{\hat x})}^{U(\vec{\hat x})} p(\vec x)
1889 \end{equation}
1890 Since $P$ is a polytope, the lower bound is a maximum of affine expressions
1891 in the remaining variables, while the upper bound is a minimum of such expressions.
1892 If the coefficients in these expressions are all integer, then we can
1893 compute $Q(\vec{\hat x})$ exactly as a piecewise polynomial using formulas
1894 for sums of powers, as proposed by, e.g.,
1895 \shortciteN{Tawbi1994,Sakellariou1997sums,VanEngelen2004}.
1896 If some of the coefficients are not integer, we can apply the same formulas
1897 to obtain an approximation, which can is some cases be shown
1898 to be an overapproximation~\shortcite{VanEngelen2004}.
1899 Note that if we take the initial polynomial to be the constant $1$, then
1900 this gives us a method for computing an approximation of the number
1901 of integer points in a (parametric) polytope.
1903 The first step is to compute the chamber decomposition of $P$ when viewed
1904 as a 1-dimensional parametric polytope. That is, we need to partition
1905 the projection of $P$ onto the remaining variables into polyhedral cells
1906 such that in each cell, both the upper and the lower bound are described
1907 by a single affine expression. Basically, for each pair of lower and upper
1908 bound, we compute the cell where the chosen lower bound is (strictly)
1909 smaller than all other lower bounds and similarly for the upper bound.
1911 For any given pair of lower and upper bound $(l(\vec {\hat x}), u(\vec{\hat x}))$,
1912 the formula~\eqref{eq:nested:sum} is computed for each monomial of $p(\vec x)$
1913 separately. For the constant term $\alpha_0$, we have
1915 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_0(\vec{\hat x})
1916 = \alpha_0(\vec{\hat x}) \left(u(\vec{\hat x}) - l(\vec {\hat x}) + 1\right)
1919 For the higher degree monomials, we use the formula
1920 \begin{equation}
1921 \label{eq:summation}
1922 \sum_{k=0}^{m-1} k^n = {1\over{n+1}}\sum_{k=0}^n{n+1\choose{k}} B_k m^{n+1-k}
1923 =: S_n(m)
1925 \end{equation}
1926 with $B_i$ the \ai{Bernoulli number}s, which can be computed
1927 using the recurrence
1928 \begin{equation}
1929 \label{eq:Bernoulli}
1930 \sum_{j=0}^m{m+1\choose{j}}B_j = 0
1931 \qquad B_0 = 1
1933 \end{equation}
1934 Note that \eqref{eq:summation} is also valid if $m = 0$,
1935 i.e., $S_n(0) = 0$, a fact
1936 that can be easily shown using Newton series~\shortcite{VanEngelen2004}.
1938 \newcounter{saveenumi}
1940 Since we can only directly apply the summation formula when
1941 the lower bound is zero (or one), we need to consider several
1942 cases.
1943 \begin{enumerate}
1944 \item $l(\vec {\hat x}) \ge 1$
1946 \begin{align*}
1947 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1949 \alpha_n(\vec{\hat x})
1950 \left(
1951 \sum_{x_1 = 1}^{u(\vec{\hat x})} x_1^n
1953 \sum_{x_1 = 1}^{l(\vec {\hat x})-1} x_1^n
1954 \right)
1957 \alpha_n(\vec{\hat x})
1958 \left( S_n(u(\vec{\hat x})+1) - S_n(l(\vec {\hat x})) \right)
1959 \end{align*}
1961 \item $u(\vec{\hat x}) \le -1$
1963 \begin{align*}
1964 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1966 \alpha_n(\vec{\hat x}) (-1)^n
1967 \sum_{x_1 = -u(\vec {\hat x})}^{-l(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1970 \alpha_n(\vec{\hat x}) (-1)^n
1971 \left( S_n(-l(\vec{\hat x})+1) - S_n(-u(\vec {\hat x})) \right)
1972 \end{align*}
1974 \item $l(\vec {\hat x}) \le 0$ and $u(\vec{\hat x}) \ge 0$
1976 \begin{align*}
1977 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1979 \alpha_n(\vec{\hat x})
1980 \left(
1981 \sum_{x_1 = 0}^{u(\vec{\hat x})} x_1^n
1983 (-1)^n
1984 \sum_{x_1 = 1}^{-l(\vec {\hat x})} x_1^n
1985 \right)
1988 \alpha_n(\vec{\hat x})
1989 \left(
1990 S_n(u(\vec{\hat x})+1)
1992 (-1)^n
1993 S_n(-l(\vec{\hat x})+1)
1994 \right)
1995 \end{align*}
1997 \setcounter{saveenumi}{\value{enumi}}
1998 \end{enumerate}
2000 If the coefficients in the lower and upper bound are all
2001 integer, then the above 3 cases partition (the integer points in)
2002 the projection of $P$ onto the remaining variables.
2003 However, if some of the coefficients are rational, then the lower
2004 and upper bound can lie in the open interval $(0,1)$ for some
2005 values of $\vec{\hat x}$. We therefore also need to consider
2006 the following two cases.
2007 Note that the results will not be correct in these cases, but
2008 not taking them into account would lead to a greater loss in accuracy.
2010 \begin{enumerate}
2011 \setcounter{enumi}{\value{saveenumi}}
2012 \item $0 < l(\vec {\hat x}) < 1$
2015 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
2017 \alpha_n(\vec{\hat x})
2018 S_n(u(\vec{\hat x})+1)
2021 \item $0 < -u(\vec {\hat x}) < 1$ and $l(\vec {\hat x}) \le 0$
2024 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
2026 \alpha_n(\vec{\hat x})
2027 (-1)^n
2028 S_n(-l(\vec{\hat x})+1)
2031 \end{enumerate}
2033 \subsection{Summation using local Euler-Maclaurin formula}
2034 \label{s:euler}
2036 \sindex{local}{Euler-Maclaurin formula}
2037 In this section we provide some implementation details
2038 on using \ai{local Euler-Maclaurin formula} to compute
2039 the sum of a piecewise polynomial evaluated in all integer
2040 points of a two-dimensional parametric polytope.
2041 For the theory behind these formula and a discussion
2042 of the original implementation (for non-parametric simplices),
2043 we refer to \shortciteN{Berline2006local}.
2045 In particular, consider a parametric piecewise polynomial
2046 in $n$ parameters and $m$ variables
2047 $c : \ZZ^n \to \ZZ^m \to \QQ : \vec p \mapsto c(\vec p)$,
2048 with $c(\vec p) : \ZZ^m \to \QQ : \vec x \mapsto c(\vec p)(\vec x)$
2051 c_{\vec p}(\vec x) =
2052 \begin{cases}
2053 c_1(\vec p)(\vec x) & \text{if $\vec x \in D_1(\vec p)$}
2055 \vdots
2057 c_r(\vec p)(\vec x) & \text{if $\vec x \in D_r(\vec p)$}
2059 \end{cases}
2061 with the $c_i$ polynomials, $c_i \in (\QQ[\vec p])[\vec x]$, and
2062 the $D_i$ disjoint linearly parametric polytopes.
2063 We want to compute
2065 g(\vec p) = \sum_{\vec x \in \ZZ^m} c(\vec p)(\vec x)
2069 \subsubsection{Reduction to the summation of a parametric polynomial
2070 over a parametric polytope with a fixed combinatorial structure}
2072 Since the $D_i$ are disjoint, we can consider each
2073 $(c_i, D_i)$-pair individually and compute
2075 g(\vec p) = \sum_{i=1}^r g_i(\vec p) =
2076 \sum_{i=1}^r \sum_{\vec x \in D_r(\vec p) \cap \ZZ^m} c_r(\vec p)(\vec x)
2079 The second step is to compute the \ai{chamber decomposition}
2080 ~\shortcite[Section 4.2.3]{Verdoolaege2005PhD} of each parametric
2081 polytope $D_i$.
2082 The result is a subdivision of the parameter space into chambers
2083 $C_{ij}$ such that $D_i$ has a fixed combinatorial structure,
2084 in particular a fixed set of parametric vertices,
2085 on (the interior of) each $C_{ij}$. Applying \autoref{p:inclusion-exclusion},
2086 this subdivision can be transformed into a partition
2087 $\{\, \tilde C_{ij} \,\}$ by
2088 making some of the facets of the chambers open%
2089 ~\shortcite[Section~3.2]{Koeppe2007parametric}.
2090 Since we are only interested in integer parameter values,
2091 any of the resulting open facets $\sp a p + c > 0$,
2092 with $\vec a \in \ZZ^n$ and $c \in \ZZ$,
2093 can then be replaced by $\sp a p + c-1 \ge 0$.
2094 Again, we have
2096 g_i(\vec p) = \sum_j g_{ij}(\vec p) =
2097 \sum_j \sum_{\vec x \in C_{ij}(\vec p) \cap \ZZ^m} c_r(\vec p)(\vec x)
2101 After this reduction, the technique of
2102 \shortciteN{Berline2006local} can be applied practically verbatim
2103 to the parametric polytope with a fixed combinatorial structure.
2104 In principle, we could also handle piecewise quasi-polynomials
2105 using the technique of \shortciteN[Section~4.5.4]{Verdoolaege2005PhD},
2106 except that we only need to create an extra variable for each
2107 distinct floor expression in a monomial, rather than for each
2108 occurrence of a floor expression in a monomial.
2109 However, since we currently only support two-dimensional polytopes,
2110 this reduction has not been implemented yet.
2112 \subsubsection{Summation over a one-dimensional parametric polytope}
2114 The basis for the summation technique is the local
2115 Euler-Maclaurin formula~\cite[Theorem~26]{Berline2006local}
2116 \begin{equation}
2117 \label{eq:EML}
2118 \sum_{\vec x \in P(\vec p) \cap \Lambda} h(\vec p)(\vec x)
2119 = \sum_{F(\vec p) \in {\mathcal F}(P(\vec p))}
2120 \int_{F(\vec p)} D_{P(\vec p),F(\vec p)} \cdot h(\vec p)
2122 \end{equation}
2123 where $P(\vec p)$ is a parametric polytope,
2124 $\Lambda$ is a lattice, ${\mathcal F}(P(\vec p))$
2125 are the faces of $P(\vec p)$, $D_{P(\vec p),F(\vec p)}$ is a
2126 specific differential operator associated to the face of a polytope.
2127 The \ai{Lebesgue measure} used in the integral is such that the
2128 integral of the indicator function of a lattice element of
2129 the lattice $\Lambda \cap (\affhull(F(\vec p)) - F(\vec p))$ is 1,
2130 i.e., the intersection of $\Lambda$ with the linear subspace
2131 parallel to the affine hull of the face $F(\vec p)$.
2132 Note that the original theorem is formulated for a non-parametric
2133 polytope and a non-parametric polynomial. However, as we will see,
2134 in each of the steps in the computation, the parameters can be
2135 treated as symbolic constants without affecting the validity of the formula,
2136 see also~\shortciteN[Section 6]{Berline2006local}.
2138 The differential operator $D_{P(\vec p),F(\vec p)}$ is obtained
2139 by plugging in the vector $\vec D=(D_1,\ldots,D_m)$ of first
2140 order differential operators, i.e., $D_k$ is the first order
2141 differential operator in the $k$th variable,
2142 in the function $\mu_{P(\vec p),F(\vec p)}$.
2143 This function is determined by the \defindex{transverse cone}
2144 of the polyhedron $P(\vec p)$ along its face $F(\vec p)$,
2145 which is the \ai{supporting cone} of $P(\vec p)$ along $F(\vec p)$
2146 projected into the linear subspace orthogonal to $F(\vec p)$.
2147 The lattice associated to this space is the projection of
2148 $\Lambda$ into this space.
2150 In particular, for a zero-dimensional affine cone in the zero-dimensional
2151 space, we have $\mu = 1$~\cite[Proposition 12]{Berline2006local},
2152 while for a one-dimensional affine
2153 cone $K = (-t + \RR_+) r$ in the one-dimensional space, where
2154 $r$ is a primitive integer vector and $t \in [0,1)$,
2155 we have~\cite[(13)]{Berline2006local}
2156 \begin{equation}
2157 \label{eq:mu:1}
2158 \mu(K)(\xi) = \frac{e^{t y}}{1-e^y} + \frac 1{y}
2159 = -\sum_{n=0}^\infty \frac{b(n+1, t)}{(n+1)!} y^n
2161 \end{equation}
2162 with $y = \sps \xi r$ and $b(n,t)$ the \ai{Bernoulli polynomial}s
2163 defined by the generating series
2165 \frac{e^{ty} y}{e^y - 1} = \sum_{n=0}^\infty \frac{b(n,t)}{n!} y^n
2168 The constant terms of these Bernoulli polynomials
2169 are the \ai{Bernoulli number}s.
2171 Applying \eqref{eq:EML} to a one-dimensional parametric polytope
2172 $P(\vec p) = [v_1(\vec p), v_2(\vec p)]$, we find
2174 \begin{aligned}
2175 \sum_{x \in P(\vec p) \cap \ZZ} h(\vec p)(x)
2176 = & \int_{P(\vec p)} D_{P(\vec p), P(\vec p)} \cdot h(\vec p)
2178 & + \int_{v_1(\vec p)} D_{P(\vec p), v_1(\vec p)} \cdot h(\vec p)
2180 & + \int_{v_2(\vec p)} D_{P(\vec p), v_2(\vec p)} \cdot h(\vec p)
2182 \end{aligned}
2184 The transverse cone of a polytope along the whole polytope is
2185 a zero-dimensional cone in a zero-dimensional space and so
2186 $D_{P(\vec p), P(\vec p)} = \mu_{P(\vec p), P(\vec p)}(D) = 1$.
2187 The transverse cone along $v_1(\vec p)$ is $v_1(\vec p) + \RR_+$
2188 and so $D_{P(\vec p), v_1(\vec p)} = \mu(v_1(\vec p) + \RR_+)(D)$
2189 as in \eqref{eq:mu:1}, with $y = \sps D 1 = D$ and
2190 $t = \ceil{v_1(\vec p)} - v_1(\vec p) =
2191 \fractional{-v_1(\vec p)}$.
2192 Similarly we find
2193 $D_{P(\vec p), v_2(\vec p)} = \mu(v_2(\vec p) - \RR_+)(D)$
2194 as in \eqref{eq:mu:1}, with $y = \sps D {-1} = -D$ and
2195 $t = v_2(\vec p) - \floor{v_2(\vec p)} =
2196 \fractional{v_2(\vec p)}$.
2197 Summarizing, we find
2199 \begin{aligned}
2200 \sum_{x \in P(\vec p) \cap \ZZ} h(\vec p)(x)
2201 = & \int_{v_1(\vec p)}^{v_2(\vec p)} h(\vec p)(t) \, dt
2203 & -\sum_{n=0}^\infty \frac{b(n+1, \fractional{-v_1(\vec p)})}{(n+1)!}
2204 (D^n h(\vec p))(v_1(\vec p))
2206 & -\sum_{n=0}^\infty (-1)^n \frac{b(n+1, \fractional{v_2(\vec p)})}{(n+1)!}
2207 (D^n h(\vec p))(v_2(\vec p))
2209 \end{aligned}
2212 Note that in order to apply this formula, we need to verify
2213 first that $v_1(\vec p)$ is indeed smaller than (or equal to)
2214 $v_2(\vec p)$. Since the combinatorial structure of $P(\vec p)$
2215 does not change throughout the interior of the chamber, we only
2216 need to check the order of the two vertices for one value
2217 of the parameters from the interior of the chamber, a point
2218 which we may compute as in \autoref{s:interior}.
2220 \subsubsection{Summation over a two-dimensional parametric polytope}
2222 For two-dimensional polytope, formula~\eqref{eq:EML} has three kinds
2223 of contributions: the integral of the polynomial over the polytope,
2224 contributions along edges and contributions along vertices.
2225 As suggested by~\citeN{Berline2007personal}, the integral can be computed
2226 by applying the Green-Stokes theorem:
2228 \iint_{P(\vec p)}
2229 \left(\frac{\partial M}{\partial x} - \frac{\partial L}{\partial y}\right) =
2230 \int_{\partial P(\vec p)} (L\, dx + M\, dy)
2233 In particular, if $M(\vec p)(x,y)$ is such that
2234 $\frac{\partial M}{\partial x}(\vec p)(x,y) = h(\vec p)(x,y)$
2235 then
2237 \iint_{P(\vec p)} h(\vec p)(x,y) =
2238 \int_{\partial P(\vec p)} M(\vec p)(x,y) \, dy
2241 Care must be taken to integrate over the boundary in the positive
2242 direction. Assuming the vertices of the polygon are not given
2243 in a predetermined order, we can check the correct orientation
2244 of the vertices of each edge individually. Let $\vec n = (n_1, n_2)$
2245 be the inner normal of a facet and let $\vec v_1(\vec p)$
2246 and $\vec v_2(\vec p)$ be the two vertices of the facet, then
2247 the vertices are in the correct order if
2249 \begin{vmatrix}
2250 v_{2,1}(\vec p)-v_{1,1}(\vec p) & n_1
2252 v_{2,2}(\vec p)-v_{1,2}(\vec p) & n_2
2253 \end{vmatrix}
2254 \ge 0
2257 Since these two vertices belong to the same edge, their order
2258 will not change within a chamber and so we can again perform
2259 this check for a single value of the parameters.
2260 To integrate $M$ over an edge $F$, let $\vec f$ be a primitive
2261 integer vector in the direction of the edge.
2262 Then $\vec v_2(\vec p) = \vec v_1(\vec p) + k(\vec p) \, \vec f$
2263 and any point on the edge can be written as
2264 $\vec v_1(\vec p) + \lambda \vec f$ with
2265 $0 \le \lambda \le k(\vec p)$.
2266 That is,
2267 \begin{equation}
2268 \label{eq:EML:int}
2269 \int_F M(\vec p)(x,y) \, dy
2271 \int_0^{k(\vec p)}
2272 M(\vec p)(v_{1,1}(\vec p) + \lambda f_1,
2273 v_{1,2}(\vec p) + \lambda f_2)
2274 f_2 \, d\lambda
2276 \end{equation}
2278 For the edges, we can again apply \eqref{eq:mu:1}, but we
2279 must first project the supporting cone at the edge into
2280 the linear subspace orthogonal to the edge.
2281 Let $\vec n = (n_1, n_2)$ be the (primitive integer) inner normal
2282 of this facet $F(\vec p)$, then $\vec f = (-n_2, n_1)$ is parallel
2283 to the facet and we can write one of the vertices $\vec v(\vec p)$
2284 as a linear combination of these two vectors:
2285 \begin{equation}
2286 \label{eq:EML:facet:coordinates}
2287 \vec v(\vec p)
2289 \begin{bmatrix}
2290 \vec f & \vec n
2291 \end{bmatrix}
2292 \vec a(\vec p)
2294 \begin{bmatrix}
2295 -n_2 & n_1 \\
2296 n_1 & n_2
2297 \end{bmatrix}
2298 \vec a(\vec p)
2299 \end{equation}
2301 \begin{equation}
2302 \label{eq:EML:facet:coordinates:2}
2303 \vec a(\vec p)
2305 \begin{bmatrix}
2306 -n_2 & n_1 \\
2307 n_1 & n_2
2308 \end{bmatrix}^{-1}
2309 \vec v(\vec p)
2311 \begin{bmatrix}
2312 -n_2/d & n_1/d \\
2313 n_1/d & n_2/d
2314 \end{bmatrix}
2315 \vec v(\vec p),
2316 \end{equation}
2317 with $d = n_1^2+n_2^2$.
2318 The lattice associated to the linear subspace orthogonal
2319 to the facet is the projection of $\Lambda$ into this space.
2320 Since $\vec n$ is primitive, a basis for this lattice can be
2321 identified with $\vec n/d$.
2322 The coordinate of the whole facet in this space is therefore
2324 d a_2(\vec p) =
2325 \begin{bmatrix}
2326 n_1 & n_2
2327 \end{bmatrix}
2328 \vec v(\vec p)
2329 $, while the transverse cone is $d a_2(\vec p) + \RR_+$.
2330 Similarly, a linear functional $\vec \xi'$ projects onto
2331 a linear functional $\xi = \sp {\xi'} n/d$ in the linear subspace.
2332 Applying \eqref{eq:mu:1}, with $y = \frac{n_1}d D_1 + \frac{n_2}d D_2$
2333 and $t = \fractional{- n_1 v_1(\vec p) - n_2 v_2(\vec p)}$, we therefore
2334 find
2335 \begin{align*}
2336 D_{P(\vec p), F(\vec p)}
2338 -\sum_{n=0}^\infty
2339 \frac{b(n+1, \fractional{-n_1 v_1(\vec p) - n_2 v_2(\vec p)})}{(n+1)!}
2340 \left(\frac{n_1}d D_1 + \frac{n_2}d D_2\right)^n
2343 - \sum_{i=0}^\infty \sum_{j=0}^\infty
2344 \frac{b(i+j+1, \fractional{-n_1 v_1(\vec p) - n_2 v_2(\vec p)})}{(i+j+1)!}
2345 \frac{n_1^i n_2^j}{d^{i+j}} D_1^i D_2^j
2347 \end{align*}
2348 After applying this differential operator to the polynomial
2349 $h(\vec p)(\vec x)$, the resulting polynomial
2351 h'(\vec p)(\vec x) = D_{P(\vec p), F(\vec p)} \cdot h(\vec p)(\vec x)
2353 needs to be integrated over the facet.
2354 The measure to be used is such that the integral of a lattice tile
2355 in the linear space parallel to the facet is 1, i.e.,
2357 \int_{\vec 0}^{\vec f} 1 = \int_0^1 1 dz = 1,
2359 with $z$ the coordinate along $\vec f$.
2360 Referring to \eqref{eq:EML:facet:coordinates} and
2361 \eqref{eq:EML:facet:coordinates:2}, all points of the facet
2362 have the form $\vec x(\vec p) = z \, \vec f + a_2(\vec p) \, \vec n$,
2363 while the $z$-coordinate of the vertices $\vec v_1(\vec p)$
2364 and $\vec v_2(\vec p)$ are
2365 $(-n_2 v_{1,1} + n_1 v_{1,2})/d$
2367 $(-n_2 v_{2,1} + n_1 v_{2,2})/d$, respectively.
2368 That is, the contribution of the facet is equal to
2370 \int_{(-n_2 v_{1,1} + n_1 v_{1,2})/d}^{(-n_2 v_{2,1} + n_1 v_{2,2})/d}
2371 h'(\vec p)\left(z \, \vec f + a_2(\vec p) \, \vec n\right) \, dz
2374 where, again, we need to ensure that the lower limit is smaller
2375 than the upper limit using the usual method of plugging in a
2376 particular value of the parameters.
2378 Finally, we consider the contributions of the vertices.
2379 The \ai{transverse cone}s are in this case simply the supporting cones.
2380 Since $\mu$ is a valuation, we may apply \ai{Barvinok's decomposition}
2381 and assume that the cone is unimodular.
2382 For an affine cone
2383 \begin{align*}
2384 K &= \vec v(\vec p) + \RR_+ \vec r_1 + \RR_+ \vec r_2
2386 &= (a_1(\vec p) + \RR_+) \vec r_1 + (a_2(\vec p) + \RR_+) \vec r_2,
2387 \end{align*}
2388 with
2390 \vec a(\vec p) =
2391 \begin{bmatrix}
2392 \vec r_1 & \vec r_2
2393 \end{bmatrix}^{-1}
2394 \vec v(\vec p)
2397 we have~\cite[Proposition~31]{Berline2006local},
2398 \begin{equation}
2399 \label{eq:mu:2}
2400 \mu(K)(\vec\xi)
2402 \frac{e^{t_1 y_1 + t_2 y_2}}{(1-e^{y_1})(1-e^{y_2})}
2403 + \frac 1{y_1}B(y_2 - C_1 y_1, t_2)
2404 + \frac 1{y_2}B(y_1 - C_2 y_2, t_1)
2405 - \frac 1{y_1 y_2},
2406 \end{equation}
2407 with
2409 B(y,t) =
2410 \frac{e^{t y}}{1-e^y} + \frac 1{y}
2411 = -\sum_{n=0}^\infty \frac{b(n+1, t)}{(n+1)!} y^n
2414 $y_i = \sps{\vec\xi}{\vec r_i}$,
2415 $C_i = \sps{\vec v_1}{\vec v_2}/\sps{\vec v_i}{\vec v_i}$
2417 $t_i = \fractional{-a_i(\vec p)}$.
2418 Expanding \eqref{eq:mu:2}, we find
2419 \begin{align*}
2420 \mu(K)(\vec\xi)
2422 \left(
2423 -\frac{b(0,t1)}{y_1} - \sum_{n=0}^\infty \frac{b(n+1,t_1)}{(n+1)!} y_1^n
2424 \right)
2425 \left(
2426 -\frac{b(0,t2)}{y_2} - \sum_{n=0}^\infty \frac{b(n+1,t_2)}{(n+1)!} y_2^n
2427 \right)
2429 & \phantom{=}
2431 \left(
2432 \sum_{n=0}^\infty \frac{b(n+1,t_2)}{(n+1)!} \frac{y_2^n}{y_1}
2434 \sum_{n=0}^\infty \frac{b(n+1,t_2)}{(n+1)!} \frac{(y_2-C_1 y_1)^n-y_2^n}{y_1}
2435 \right)
2437 & \phantom{=}
2439 \left(
2440 \sum_{n=0}^\infty \frac{b(n+1,t_1)}{(n+1)!} \frac{y_1^n}{y_2}
2442 \sum_{n=0}^\infty \frac{b(n+1,t_1)}{(n+1)!} \frac{(y_1-C_2 y_2)^n-y_1^n}{y_2}
2443 \right)
2445 & \phantom{=}
2446 - \frac 1{y_1 y_2}
2449 \sum_{n_1=0}^\infty
2450 \sum_{n_2=0}^\infty
2451 c(C_1, C_2, t_1, t_2; n_1, n_2) \, y_1^n y_2^n
2453 \end{align*}
2454 with
2455 \begin{align*}
2456 c(C_1, C_2, t_1, t_2; n_1, n_2)
2458 \frac{b(n_1+1,t_1)}{(n_1+1)!} \frac{b(n_2+1,t_2)}{(n_2+1)!}
2462 \frac{b(n_1+n_2+1,t_2)}{(n_1+n_2+1)!} {n_1+n_2+1 \choose n_1+1}
2463 \left(-C_1\right)^{n_1+1}
2467 \frac{b(n_1+n_2+1,t_1)}{(n_1+n_2+1)!} {n_1+n_2+1 \choose n_2+1}
2468 \left(-C_2\right)^{n_2+1}
2470 \end{align*}
2471 For $\vec \xi = \vec D$, we have
2472 \begin{align*}
2473 y_1^n y_2^n
2475 \left( r_{1,1} D_1 + r_{1,2} D_2 \right)^{n_1}
2476 \left( r_{2,1} D_1 + r_{2,2} D_2 \right)^{n_2}
2479 \left(
2480 \sum_{k=0}^{n_1} r_{1,1}^k r_{1,2}^{n_1 - k} { n_1 \choose k} D_1^k D_2^{n_1-k}
2481 \right)
2482 \left(
2483 \sum_{l=0}^{n_2} r_{2,1}^l r_{2,2}^{n_2 - l} { n_2 \choose l} D_1^l D_2^{n_2-l}
2484 \right)
2485 \end{align*}
2486 and so
2488 D_{P(\vec p), \vec v(\vec p)} = \mu(K)(\vec D)
2492 \sum_{i=0}^\infty
2493 \sum_{j=0}^\infty
2494 \sum_{\shortstack{$\scriptstyle i+j = n_1+n_2$\\$\scriptstyle n_1 \ge 0$\\$\scriptstyle n_2 \ge 0$}}
2495 \sum_{\shortstack{$\scriptstyle k+l = i$\\$\scriptstyle 0 \le k \le n_1$\\$\scriptstyle 0 \le l \le n_2$}}
2496 c(C_1, C_2, t_1, t_2; n_1, n_2)
2497 r_{1,1}^k r_{1,2}^{n_1 - k}
2498 r_{2,1}^l r_{2,2}^{n_2 - l}
2499 { n_1 \choose k} { n_2 \choose l} D_1^i D_2^j
2502 The contribution of this vertex is then
2504 h'(\vec p)(\vec v(\vec p))
2507 with $
2508 h'(\vec p)(\vec x) = D_{P(\vec p), \vec v(\vec p)} \cdot h(\vec p)(\vec x)
2511 \begin{example}
2512 As a simple example, consider the (non-parametric) triangle
2513 in \autoref{f:EML:triangle} and assume we want to compute
2515 \sum_{\vec x \in T \cap \ZZ^2} x_1 x_2
2518 Since $T \cap \ZZ^2 = \{\, (2,4), (3,4), (2,5) \, \}$,
2519 the result should be
2521 2 \cdot 4 + 3 \cdot 4 + 2 \cdot 5 = 30
2525 \begin{figure}
2526 \intercol=1.2cm
2527 \begin{xy}
2528 <\intercol,0pt>:<0pt,\intercol>::
2529 \POS@i@={(2,4),(3,4),(2,5),(2,4)},{0*[|(2)]\xypolyline{}}
2530 \POS(2.35,4.25)*{x_1 x_2}
2531 \POS(2,4)*+!U{(2,4)}
2532 \POS(3,4)*+!U{(3,4)}
2533 \POS(2,5)*+!D{(2,5)}
2534 \POS(2,4)*{\cdot}
2535 \POS(3,4)*{\cdot}
2536 \POS(2,5)*{\cdot}
2537 \POS(-1,0)\ar(4,0)
2538 \POS(0,-1)\ar(0,5.5)
2539 \end{xy}
2540 \caption{Sum of polynomial $x_1 x_2$ over the integer points in a triangle $T$}
2541 \label{f:EML:triangle}
2542 \end{figure}
2544 Let us first consider the integral
2546 \iint_T x_1 x_2 = \int_{\partial T} \frac{x_1^2 x_2}2 \, d x_2
2549 Integration along each of the edges of the triangle yields
2550 the following.
2552 \marginpar{%
2553 \intercol=1cm
2554 \begin{xy}
2555 <\intercol,0pt>:<0pt,\intercol>::
2556 \POS(0,-1)*\xybox{
2557 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2558 \POS(0,0)\ar@[|(2)](1,0)
2560 \end{xy}
2562 For the edge in the margin, we have $\vec f = (1,0)$, i.e., $f_2 = 0$.
2563 The contribution of this edge to the integral is therefore zero.
2565 \marginpar{%
2566 \intercol=1cm
2567 \begin{xy}
2568 <\intercol,0pt>:<0pt,\intercol>::
2569 \POS(0,-1)*\xybox{
2570 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2571 \POS(1,0)\ar@[|(2)](0,1)
2573 \end{xy}
2575 For this edge, we have $\vec f = (-1,1)$.
2576 The contribution of this edge to the integral is therefore
2578 \int_0^1 \frac{(3-\lambda)^2(4+\lambda)}2 d\lambda
2579 = \frac{337}{24}
2583 \marginpar{%
2584 \intercol=1cm
2585 \begin{xy}
2586 <\intercol,0pt>:<0pt,\intercol>::
2587 \POS(0,-1)*\xybox{
2588 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2589 \POS(0,1)\ar@[|(2)](0,0)
2591 \end{xy}
2593 For this edge, we have $\vec f = (0,-1)$.
2594 The contribution of this edge to the integral is therefore
2596 \int_0^1 \frac{2^2(5-\lambda)}2 (-1) d\lambda
2597 = -9
2601 The total integral is therefore
2603 \int_{\partial T} \frac{x_1^2 x_2}2 \, d x_2
2604 = 0 + \frac{337}{24} - 9 = \frac{121}{24}
2608 Now let us consider the contributions of the edges.
2609 We will need the following \ai{Bernoulli number}s in our
2610 computations.
2611 \begin{align*}
2612 b(1,0) & = - \frac 1 2
2614 b(2,0) & = \frac 1 6
2616 b(3,0) & = 0
2618 b(4,0) & = -\frac 1 {30}
2619 \end{align*}
2621 \marginpar{%
2622 \intercol=1cm
2623 \begin{xy}
2624 <\intercol,0pt>:<0pt,\intercol>::
2625 \POS(0,-1)*\xybox{
2626 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2627 \POS(0,0)\ar@[|(2)]@{-}(1,0)
2628 \POS(0.5,0)\ar(0.5,1)
2630 \end{xy}
2632 The normal to the facet $F_1$ in the margin is $\vec n = (0,1)$.
2633 The vector $\vec f = (-1,0)$ is parallel to the facet.
2634 We have
2636 \begin{bmatrix}
2637 2 \\ 4
2638 \end{bmatrix}
2641 \begin{bmatrix}
2642 -1 \\ 0
2643 \end{bmatrix}
2645 \begin{bmatrix}
2646 0 \\ 1
2647 \end{bmatrix}
2648 \quad\text{and}\quad
2649 \begin{bmatrix}
2650 3 \\ 4
2651 \end{bmatrix}
2654 \begin{bmatrix}
2655 -1 \\ 0
2656 \end{bmatrix}
2658 \begin{bmatrix}
2659 0 \\ 1
2660 \end{bmatrix}
2663 Therefore $t = \fractional{-4} = 0$, $y = D_2$,
2664 \begin{align*}
2665 D_{T,F_1}
2666 & =
2667 - \sum_{j=0}^\infty \frac{b(j+1, 0)}{(j+1)!} D_2^j
2670 - \frac{b(1,0)}1 - \frac{b(2,0)}2 D_2 + \cdots
2671 \end{align*}
2674 h'(\vec x) =
2675 D_{T,F_1} \cdot x_1 x_2 =
2676 \left(\frac 1 2 - \frac 1{12} D_2\right) \cdot x_1 x_2
2678 \frac 1 2 x_1 x_2 - \frac 1{12} x_1
2681 With $x_1 = - z$ and $x_2 = 4$, the contribution of this facet
2684 \int_{-3}^{-2} - 2 z + \frac 1{12} z \, dz
2686 \frac{115}{24}
2690 \marginpar{%
2691 \intercol=1cm
2692 \begin{xy}
2693 <\intercol,0pt>:<0pt,\intercol>::
2694 \POS(0,-1)*\xybox{
2695 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2696 \POS(0,0)\ar@[|(2)]@{-}(0,1)
2697 \POS(0,0.5)\ar(1,0.5)
2699 \end{xy}
2701 The normal to the facet $F_2$ in the margin is $\vec n = (1,0)$.
2702 The vector $\vec f = (0,1)$ is parallel to the facet.
2703 We have
2705 \begin{bmatrix}
2706 2 \\ 4
2707 \end{bmatrix}
2710 \begin{bmatrix}
2711 0 \\ 1
2712 \end{bmatrix}
2714 \begin{bmatrix}
2715 1 \\ 0
2716 \end{bmatrix}
2717 \quad\text{and}\quad
2718 \begin{bmatrix}
2719 2 \\ 5
2720 \end{bmatrix}
2723 \begin{bmatrix}
2724 0 \\ 1
2725 \end{bmatrix}
2727 \begin{bmatrix}
2728 1 \\ 0
2729 \end{bmatrix}
2732 Therefore $t = \fractional{-2} = 0$, $y = D_1$,
2733 \begin{align*}
2734 D_{T,F_2}
2735 & =
2736 - \sum_{i=0}^\infty \frac{b(i+1, 0)}{(i+1)!} D_1^i
2739 - \frac{b(1,0)}1 - \frac{b(2,0)}2 D_1 + \cdots
2740 \end{align*}
2743 h'(\vec x) =
2744 D_{T,F_2} \cdot x_1 x_2 =
2745 \left(\frac 1 2 - \frac 1{12} D_1\right) \cdot x_1 x_2
2747 \frac 1 2 x_1 x_2 - \frac 1{12} x_2
2750 With $x_1 = 2$ and $x_2 = z$, the contribution of this facet
2753 \int_{4}^{5} z - \frac 1{12} z \, dz
2755 \frac{33}{8}
2759 \marginpar{%
2760 \intercol=1cm
2761 \begin{xy}
2762 <\intercol,0pt>:<0pt,\intercol>::
2763 \POS(0,-1)*\xybox{
2764 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2765 \POS(1,0)\ar@[|(2)]@{-}(0,1)
2766 \POS(0.5,0.5)\ar(-0.5,-0.5)
2768 \end{xy}
2770 The normal to the facet $F_3$ in the margin is $\vec n = (-1,-1)$.
2771 The vector $\vec f = (1,-1)$ is parallel to the facet.
2772 We have
2774 \begin{bmatrix}
2775 3 \\ 4
2776 \end{bmatrix}
2778 -\frac 1 2
2779 \begin{bmatrix}
2780 1 \\ -1
2781 \end{bmatrix}
2782 -\frac 7 2
2783 \begin{bmatrix}
2784 -1 \\ -1
2785 \end{bmatrix}
2786 \quad\text{and}\quad
2787 \begin{bmatrix}
2788 2 \\ 5
2789 \end{bmatrix}
2791 -\frac 3 2
2792 \begin{bmatrix}
2793 1 \\ -1
2794 \end{bmatrix}
2795 -\frac 7 2
2796 \begin{bmatrix}
2797 -1 \\ -1
2798 \end{bmatrix}
2801 Therefore $t = \fractional{7} = 0$, $y = -\frac 1 2 D_1 -\frac 1 2 D_2$,
2802 \begin{align*}
2803 D_{T,F_3}
2804 & =
2805 - \sum_{i=0}^\infty \sum_{j=0}^\infty
2806 \frac{b(i+j+1, 0)}{(i+j+1)!}
2807 \frac{(-1)^{i+j}}{2^{i+j}} D_1^i D_2^j
2810 - \frac{b(1,0)}1
2811 + \frac 1 2 \frac{b(2,0)}2 D_1
2812 + \frac 1 2 \frac{b(2,0)}2 D_2 + \cdots
2813 \end{align*}
2816 h'(\vec x) =
2817 D_{T,F_4} \cdot x_1 x_2 =
2818 \left(\frac 1 2 + \frac 1{24} D_1 + \frac 1{24} D_2\right) \cdot x_1 x_2
2820 \frac 1 2 x_1 x_2 + \frac 1{24} x_2 + \frac 1{24} x_1
2823 With $x_1 = z + \frac 7 2$ and $x_2 = -z + \frac 7 2$,
2824 the contribution of this facet
2827 \int_{-\frac 3 2}^{-\frac 1 2}
2828 \frac 1 2 (z + \frac 7 2)(-z + \frac 7 2)
2829 + \frac 1{24}(-z + \frac 7 2)
2830 + \frac 1{24}(z + \frac 7 2) \, dz
2832 \frac{47}{8}
2836 The total contribution of the edges is therefore
2838 \frac{115}{24}+\frac{33}8+
2839 \frac{47}{8} = \frac{355}{24}
2843 Finally, we consider the contributions of the vertices.
2845 \marginpar{%
2846 \intercol=1cm
2847 \begin{xy}
2848 <\intercol,0pt>:<0pt,\intercol>::
2849 \POS(0,-1)*\xybox{
2850 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2851 \POS(1,0)\ar@[|(2)](0,1)
2852 \POS(1,0)\ar@[|(2)](0,0)
2854 \end{xy}
2856 For the vertex $\vec v = (3,4)$, we have
2857 $\vec r_1 = (-1,0)$ and $\vec r_2 = (-1,1)$.
2858 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
2859 Also, $C_1 = 1$, $C_2 = 1/2$, $y_1 = -D_1$ and $y_2 = -D_1 + D_2$.
2860 Since the total degree of the polynomial $x_1 x_2$ is two,
2861 we only need the coefficients of $\mu(K)(\vec \xi)$ up to
2862 $n_1+n_2 = 2$.
2864 \noindent
2865 \begin{tabular}{c|c|c}
2866 $n_1$ & $n_2$
2868 \hline
2869 0 & 0 &
2871 \left(
2872 \frac{b(1,0)}{1!}
2873 \frac{b(1,0)}{1!}
2875 \frac{b(2,0)}{2!}
2876 {1 \choose 1}(-1)^1
2878 \frac{b(2,0)}{2!}
2879 {1 \choose 1}(-\frac 12)^1
2880 \right)
2883 1 & 0 &
2885 \left(
2886 \frac{b(2,0)}{2!}
2887 \frac{b(1,0)}{1!}
2889 \frac{b(3,0)}{3!}
2890 {2 \choose 2}(-1)^2
2892 \frac{b(3,0)}{3!}
2893 {2 \choose 1}(-\frac 12)^1
2894 \right)
2895 \left(
2896 -D_1
2897 \right)
2900 0 & 1 &
2902 \left(
2903 \frac{b(1,0)}{1!}
2904 \frac{b(2,0)}{2!}
2906 \frac{b(3,0)}{3!}
2907 {2 \choose 1}(-1)^1
2909 \frac{b(3,0)}{3!}
2910 {2 \choose 2}(-\frac 12)^2
2911 \right)
2912 \left(
2913 -D_1 + D_2
2914 \right)
2917 2 & 0 &
2919 \left(
2920 \frac{b(3,0)}{3!}
2921 \frac{b(1,0)}{1!}
2923 \frac{b(4,0)}{4!}
2924 {3 \choose 3}(-1)^3
2926 \frac{b(4,0)}{4!}
2927 {3 \choose 1}(-\frac 12)^1
2928 \right)
2929 \left(
2930 -D_1
2931 \right)^2
2934 1 & 1 &
2936 \left(
2937 \frac{b(2,0)}{2!}
2938 \frac{b(2,0)}{2!}
2940 \frac{b(4,0)}{4!}
2941 {3 \choose 2}(-1)^2
2943 \frac{b(4,0)}{4!}
2944 {3 \choose 2}(-\frac 12)^2
2945 \right)
2946 \left(
2947 -D_1
2948 \right)
2949 \left(
2950 -D_1 + D_2
2951 \right)
2954 0 & 2 &
2956 \left(
2957 \frac{b(1,0)}{1!}
2958 \frac{b(3,0)}{3!}
2960 \frac{b(4,0)}{4!}
2961 {3 \choose 1}(-1)^1
2963 \frac{b(4,0)}{4!}
2964 {3 \choose 3}(-\frac 12)^3
2965 \right)
2966 \left(
2967 -D_1 + D_2
2968 \right)^2
2970 \end{tabular}
2972 We find
2973 \begin{align*}
2974 h'(\vec x)
2976 \left(
2977 \frac 3 8 - \frac 1{24} (-D_1) - \frac 1{24} (-D_1 + D_2)
2978 + \frac 7{576} (-D_1 D_2)
2979 - \frac 5{1152} (-2 D_1 D2)
2980 \right) x_1 x_2
2983 \frac 3 8 x_1 x_2 + \frac 1{24} x_2 - \frac 1{24} (-x_2 + x_1)
2984 + \frac 7{576} (-1)
2985 - \frac 5{1152} (-2)
2987 \end{align*}
2988 The contribution of this vertex is therefore
2990 h'(3,4) = \frac {1355}{288}
2994 \marginpar{%
2995 \intercol=1cm
2996 \begin{xy}
2997 <\intercol,0pt>:<0pt,\intercol>::
2998 \POS(0,-1)*\xybox{
2999 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
3000 \POS(0,1)\ar@[|(2)](1,0)
3001 \POS(0,1)\ar@[|(2)](0,0)
3003 \end{xy}
3005 For the vertex $\vec v = (2,5)$, we have
3006 $\vec r_1 = (0,-1)$ and $\vec r_2 = (1,-1)$.
3007 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
3008 Also, $C_1 = 1$, $C_2 = 1/2$, $y_1 = -D_2$ and $y_2 = D_1 - D_2$.
3009 We similarly find
3011 h'(\vec x)
3013 \frac 3 8 x_1 x_2 + \frac 1{24} x_1 - \frac 1{24} (x_2 - x_1)
3014 + \frac 7{576} (-1)
3015 - \frac 5{1152} (-2)
3018 The contribution of this vertex is therefore
3020 h'(2,5) = \frac {1067}{288}
3024 \marginpar{%
3025 \intercol=1cm
3026 \begin{xy}
3027 <\intercol,0pt>:<0pt,\intercol>::
3028 \POS(0,-1)*\xybox{
3029 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
3030 \POS(0,0)\ar@[|(2)](1,0)
3031 \POS(0,0)\ar@[|(2)](0,1)
3033 \end{xy}
3035 For the vertex $\vec v = (2,4)$, we have
3036 $\vec r_1 = (1,0)$ and $\vec r_2 = (0,1)$.
3037 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
3038 The computations are easier in this case since
3039 $C_1 = C_2 = 0$, $y_1 = D_1$ and $y_2 = D_2$.
3040 We find
3042 h'(\vec x)
3044 \frac 1 4 x_1 x_2 - \frac 1{12} x_2 - \frac 1{12} x_1
3045 + \frac 1{144} (1)
3048 The contribution of this vertex is therefore
3050 h'(2,4) = \frac {253}{144}
3054 The total contribution of the vertices is then
3056 \frac {1355}{288} + \frac {1067}{288} + \frac {253}{144}
3057 = \frac {61}6
3059 and the total sum is
3061 \frac{121}{24}+\frac{355}{24}+\frac{61}6 = 30
3065 \end{example}
3067 \begin{example}
3068 Consider the parametric polytope
3070 P(n) = \{\, \vec x \mid x_1 \ge 2 \wedge 3 x_1 \le n + 9
3071 \wedge 4 \le x_2 \le 5 \,\}
3074 If $n \ge -3$, then the vertices of this polytope are
3075 $(2,4)$, $(2,5)$, $(3+n/3,4)$ and $(3+n/3,5)$.
3076 The contributions of the faces of $P(n)$ to
3078 \sum_{\vec x \in P(n) \cap \ZZ^2} x_1 x_2
3080 for the chamber $n \ge -3$ are shown in \autoref{t:sum:rectangle}.
3081 The final result is
3083 \begin{cases}
3084 \frac{ n^2}{2}
3085 - 3 n \fractional{\frac{ n}{3}}
3086 + \frac{21}{2} n
3087 + \frac{9}{2} \fractional{\frac{ n}{3}}^2
3088 - \frac{63}{2} \fractional{\frac{ n}{3}}
3089 + 45
3090 & \text{if $ n+3 \ge 0$}.
3091 \end{cases}
3094 \begin{table}
3095 \intercol=1cm
3096 \begin{tabular}{lc}
3097 \begin{xy}
3098 <\intercol,0pt>:<0pt,\intercol>::
3099 \POS(-1,-0.5)*\xybox{
3100 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*[|(2)]\xypolyline{}}
3101 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3103 \end{xy}
3106 \displaystyle
3107 \frac{ n^2}{4}
3108 + \frac{9}{2} n
3109 + \frac{45}{4}
3112 \begin{xy}
3113 <\intercol,0pt>:<0pt,\intercol>::
3114 \POS(-1,-0.5)*\xybox{
3115 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3116 \POS(0,0)\ar@[|(2)]@{-}(0,1)
3117 \POS(0,0.5)*+!L{2}
3118 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3120 \end{xy}
3123 \displaystyle
3124 \frac{33}{8}
3127 \begin{xy}
3128 <\intercol,0pt>:<0pt,\intercol>::
3129 \POS(-1,-0.5)*\xybox{
3130 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3131 \POS(1,0)\ar@[|(2)]@{-}(1,1)
3132 \POS(1,0.5)*+!L{3+n/3}
3133 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3135 \end{xy}
3138 \displaystyle
3139 - \frac{3}{2} n \fractional{\frac{ n}{3}}
3140 + \frac{3}{4} n
3141 + \frac{9}{4} \fractional{\frac{ n}{3}}^2
3142 - \frac{63}{4} \fractional{\frac{ n}{3}}
3143 + \frac{57}{8}
3146 \begin{xy}
3147 <\intercol,0pt>:<0pt,\intercol>::
3148 \POS(-1,-0.5)*\xybox{
3149 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3150 \POS(0,0)\ar@[|(2)]@{-}(1,0)
3151 \POS(0.5,0)*+!D{4}
3152 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3154 \end{xy}
3157 \displaystyle
3158 \frac{23}{216} n^2
3159 + \frac{23}{12} n
3160 + \frac{115}{24}
3163 \begin{xy}
3164 <\intercol,0pt>:<0pt,\intercol>::
3165 \POS(-1,-0.5)*\xybox{
3166 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3167 \POS(0,1)\ar@[|(2)]@{-}(1,1)
3168 \POS(0.5,1)*+!U{5}
3169 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3171 \end{xy}
3174 \displaystyle
3175 \frac{31}{216} n^2
3176 + \frac{31}{12} n
3177 + \frac{155}{24}
3180 \begin{xy}
3181 <\intercol,0pt>:<0pt,\intercol>::
3182 \POS(-1,-0.5)*\xybox{
3183 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3184 \POS(1,1)\ar@[|(2)](1,0)
3185 \POS(1,1)\ar@[|(2)](0,1)
3186 \POS(1,1)*+!LU{(3+n/3,5)}
3187 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3189 \end{xy}
3192 \displaystyle
3193 - \frac{31}{36} n \fractional{\frac{ n}{3}}
3194 + \frac{31}{72} n
3195 + \frac{31}{24} \fractional{\frac{ n}{3}}^2
3196 - \frac{217}{24} \fractional{\frac{ n}{3}}
3197 + \frac{589}{144}
3200 \begin{xy}
3201 <\intercol,0pt>:<0pt,\intercol>::
3202 \POS(-1,-0.5)*\xybox{
3203 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3204 \POS(0,1)\ar@[|(2)](1,1)
3205 \POS(0,1)\ar@[|(2)](0,0)
3206 \POS(0,1)*+!LU{(2,5)}
3207 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3209 \end{xy}
3212 \displaystyle
3213 \frac{341}{144}
3216 \begin{xy}
3217 <\intercol,0pt>:<0pt,\intercol>::
3218 \POS(-1,-0.5)*\xybox{
3219 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3220 \POS(0,0)\ar@[|(2)](1,0)
3221 \POS(0,0)\ar@[|(2)](0,1)
3222 \POS(0,0)*+!LD{(2,4)}
3223 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3225 \end{xy}
3228 \displaystyle
3229 \frac{253}{144}
3232 \begin{xy}
3233 <\intercol,0pt>:<0pt,\intercol>::
3234 \POS(-1,-0.5)*\xybox{
3235 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3236 \POS(1,0)\ar@[|(2)](1,1)
3237 \POS(1,0)\ar@[|(2)](0,0)
3238 \POS(1,0)*+!LD{(3+n/3,4)}
3239 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3241 \end{xy}
3244 \displaystyle
3245 - \frac{23}{36} n \fractional{\frac{ n}{3}}
3246 + \frac{23}{72} n
3247 + \frac{23}{24} \fractional{\frac{ n}{3}}^2
3248 - \frac{161}{24} \fractional{\frac{ n}{3}}
3249 + \frac{437}{144}
3251 \end{tabular}
3252 \caption{Contributions of the faces of $P(n)$ to the sum of $x_1 x_2$ over
3253 the integer points of $P(n)$}
3254 \label{t:sum:rectangle}
3255 \end{table}
3257 \end{example}
3260 \subsection{Conversion to ``standard form''}
3261 \label{s:standard}
3263 Some algorithms or tools expect a polyhedron to be
3264 specified in ``\ai{standard form}'', i.e.,
3265 \begin{equation}
3266 \label{eq:standard}
3267 \begin{cases}
3268 \begin{aligned}
3269 A \vec x & = \vec b \\
3270 \vec x & \ge \vec 0
3272 \end{aligned}
3273 \end{cases}
3274 \end{equation}
3275 Given an arbitrary (parametric) polyhedron
3276 \begin{equation}
3277 \label{eq:non-standard}
3278 \{\,
3279 \vec x \mid
3280 A \vec x + \vec b(\vec p) \ge 0
3281 \,\}
3283 \end{equation}
3284 a conversion to standard form requires the introduction
3285 of \ai{slack variable}s and a way of dealing with variables
3286 of \ai{unrestricted sign}.
3287 In this section we will be satisfied with a reduction
3288 to the form
3289 \begin{equation}
3290 \label{eq:standard:2}
3291 \begin{cases}
3292 \begin{aligned}
3293 A \vec x & = \vec b \\
3294 D \vec x & \ge \vec c
3296 \end{aligned}
3297 \end{cases}
3298 \end{equation}
3299 with $D$ a diagonal matrix with positive entries.
3300 That is, we do not necessarily make all variables non-negative,
3301 but we do ensure that they have a lower bound.
3302 If needed, a subsequent reduction can then be performed.
3304 The standard way of dealing with variables of unrestricted
3305 sign is to replace a variable $x$ of unknown sign by the
3306 difference ($x = x' - x''$) of two non-negative variables
3307 ($x', x'' \ge 0$).
3308 However, some algorithms are somewhat sensitive with respect
3309 to the number of variables and so we would prefer to introduce
3310 as few extra variables as possible.
3311 We will therefore apply a \ai{unimodular transformation}
3312 on the variables such that all transformed variables are known
3313 to be non-negative.
3315 The first step is to compute the \indac{HNF} of A,
3316 i.e., a matrix $H = A U$, with $U$ unimodular,
3317 in column echelon form such that the
3318 first entry in each column is positive and the other entries
3319 on the corresponding row are non-negative and strictly smaller
3320 than this first entry.
3321 By reordering the rows we may assume that the top square part
3322 of $H$ is lower-triangular.
3323 By a further unimodular transformation, the entries
3324 below the diagonal can be made non-positive and strictly
3325 smaller (in absolute value) than the diagonal entry of the same row.
3327 For each of the new variables, we can take a positive
3328 combination of the corresponding row and the previous rows
3329 to obtain a positive multiple of the corresponding unit vector,
3330 implying that the variable has a lower bound.
3331 A slack variable can then be introduced for each of the
3332 rows in the top square part of $H'$ that is not already
3333 a positive multiple of a unit vector and for each of
3334 the rows below the top square part of $H'$.
3336 \begin{example}
3337 Consider the cone
3339 \left\{\,
3340 \vec x \mid
3341 \begin{bmatrix}
3342 67 & -13 \\
3343 -52 & 53
3344 \end{bmatrix}
3345 \vec x
3347 \vec 0
3348 \,\right\}
3351 This cone is already situated in the first quadrant,
3352 but this may not be obvious from the constraints.
3353 Furthermore, directly adding slack variables would
3354 lead to a total of 4 variables, whereas we can also
3355 represent this cone in standard form with only 3 variables.
3356 We have
3358 H' =
3359 \begin{bmatrix}
3360 1 & 0 \\
3361 -1331 & 2875
3362 \end{bmatrix}
3364 \begin{bmatrix}
3365 67 & -13 \\
3366 -52 & 53
3367 \end{bmatrix}
3368 \begin{bmatrix}
3369 -6 & 13 \\
3370 -31 & 57
3371 \end{bmatrix}
3372 = A U'
3375 Adding a slack variable for the second row of $H'$, we
3376 obtain the equivalent problem
3378 \begin{cases}
3379 \begin{aligned}
3380 \begin{bmatrix}
3381 -1331 & 2875 & -1
3382 \end{bmatrix}
3383 \vec x'
3385 \vec 0
3387 \vec x' & \ge \vec 0
3388 \end{aligned}
3389 \end{cases}
3391 with
3393 \vec x =
3394 \begin{bmatrix}
3395 -6 & 13 & 0 \\
3396 -31 & 57 & 0
3397 \end{bmatrix}
3398 \vec x'
3401 \end{example}
3403 A similar construction was used by \shortciteN[Lemma~3.10]{Eisenbrand2000PhD}
3404 and \shortciteN{Hung1990}.
3406 \subsection{Using TOPCOM to compute Chamber Decompositions}
3408 In this section, we describe how to use the correspondence
3409 between the \ai{regular triangulation}s of a point set
3410 and the chambers of the \ai{Gale transform}
3411 of the point set~\shortcite{Gelfand1994}
3412 to compute the chamber decomposition of a parametric polytope.
3413 This correspondence was also used by \shortciteN{Pfeifle2003}
3414 \shortciteN{Eisenschmidt2007integrally}.
3416 Let us first assume that the parametric polytope can be written as
3417 \begin{equation}
3418 \label{eq:TOPCOM:polytope}
3419 \begin{cases}
3420 \begin{aligned}
3421 \vec x &\ge 0
3423 A \, \vec x &\le \vec b(\vec p)
3425 \end{aligned}
3426 \end{cases}
3427 \end{equation}
3428 where the right hand side $\vec b(\vec p)$ is arbitrary and
3429 may depend on the parameters.
3430 The first step is to add slack variables $\vec s$ to obtain
3431 the \ai{vector partition} problem
3433 \begin{cases}
3434 \begin{aligned}
3435 A \, \vec x + I \, \vec s & = \vec b(\vec p)
3437 \vec x, \vec s &\ge 0
3439 \end{aligned}
3440 \end{cases}
3442 with $I$ the identity matrix.
3443 Then we compute the (right) kernel $K$ of the matrix
3444 $\begin{bmatrix}
3445 A & I
3446 \end{bmatrix}$, i.e.,
3448 \begin{bmatrix}
3449 A & I
3450 \end{bmatrix}
3455 and use \ai[\tt]{TOPCOM}'s \ai[\tt]{points2triangs} to
3456 compute the \ai{regular triangulation}s of the points specified
3457 by the rows of $K$.
3458 Each of the resulting triangulations corresponds to a chamber
3459 in the chamber complex of the above vector partition problem.
3460 Each simplex in a triangulation corresponds to a parametric
3461 vertex active on the corresponding chamber and
3462 each point in the simplex (i.e., a row of $K$) corresponds
3463 to a variable ($x_j$ or $s_j$) that is set to zero to obtain
3464 this parametric vertex.
3465 In the original formulation of the problem~\eqref{eq:TOPCOM:polytope}
3466 each such variable set to zero reflects the saturation of the
3467 corresponding constraint ($x_j = 0$ for $x_j = 0$ and
3468 $\sps {\vec a_j}{\vec x} = b_j(\vec p)$ for $s_j = 0$).
3469 A description of the chamber can then be obtained by plugging
3470 in the parametric vertices in the remaining constraints.
3472 \begin{example}
3473 Consider the parametric polytope
3475 P(p,q,r) = \{\,
3476 (i,j) \mid 0 \le i \le p \wedge
3477 0 \le j \le 2 i + q \wedge
3478 0 \le k \le i - p + r \wedge
3479 p \ge 0 \wedge
3480 q \ge 0 \wedge
3481 r \ge 0
3482 \,\}
3485 The constraints involving the variables are
3487 \begin{cases}
3488 \begin{aligned}
3489 \begin{bmatrix}
3494 & & 1
3495 \end{bmatrix}
3496 \begin{bmatrix}
3497 i \\ j \\ k
3498 \end{bmatrix}
3500 \begin{matrix}
3506 \end{matrix}
3507 \begin{array}{l}
3513 \end{array}
3515 \begin{bmatrix}
3516 1 & 0 & 0
3518 -1 & 0 & 1
3520 -2 & 1 & 0
3521 \end{bmatrix}
3522 \begin{bmatrix}
3523 i \\ j \\ k
3524 \end{bmatrix}
3526 \begin{matrix}
3532 \end{matrix}
3533 \begin{array}{l}
3538 -p + r
3539 \end{array}
3540 \end{aligned}
3541 \end{cases}
3543 We have
3545 \begin{bmatrix}
3546 1 & 0 & 0 & 1 & 0 & 0 \\
3547 -1 & 0 & 1 & 0 & 1 & 0 \\
3548 -2 & 1 & 0 & 0 & 0 & 1 \\
3549 \end{bmatrix}
3550 \begin{bmatrix}
3551 -1 & 0 & 0 \\
3552 -2 & 0 & -1 \\
3553 -1 & -1 & 0 \\
3554 1 & 0 & 0 \\
3555 0 & 1 & 0 \\
3556 0 & 0 & 1 \\
3557 \end{bmatrix}
3561 Computing the \ai{regular triangulation}s of the rows of $K$
3562 using \ai[\tt]{TOPCOM}, we obtain
3563 \begin{verbatim}
3564 > cat e2.topcom
3566 [ -1 0 0 ]
3567 [ -2 0 -1 ]
3568 [ -1 -1 0 ]
3569 [ 1 0 0 ]
3570 [ 0 1 0 ]
3571 [ 0 0 1 ]
3573 > points2triangs --regular < e2.topcom
3574 T[1]:={{0,1,2},{1,2,3},{0,1,4},{1,3,4},{0,2,5},{2,3,5},{0,4,5},{3,4,5}};
3575 T[2]:={{1,2,3},{1,3,4},{2,3,5},{3,4,5},{1,2,5},{1,4,5}};
3576 T[3]:={{1,2,3},{1,3,4},{2,3,5},{3,4,5},{1,2,4},{2,4,5}};
3577 \end{verbatim}
3579 We see that we have three chambers in the decomposition,
3580 one with 8 vertices and two with 6 vertices.
3581 Take the second vertex (``\verb+{1,2,3}+'') of the first chamber.
3582 This vertex corresponds
3583 to the saturation of the constraints $j \ge 0$, $k \ge 0$
3584 and $i \le p$, i.e., $(i,j,k) = (p,0,0)$. Plugging in this
3585 vertex in the remaining constraints, we see that it is only valid
3586 in case $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$.
3587 For the remaining vertices of the first chamber, we similarly find
3589 \begin{tabular}{ccc}
3590 % e0
3591 \verb+{0,1,2}+ & $(0,0,0)$ & $p \ge 0$, $-q + r \ge 0$ and $q \ge 0$
3593 % 70
3594 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3596 % c8
3597 \verb+{0,1,4}+ & $(0,0,-p+r)$ & $-q + r \ge 0$, $p \ge 0$ and $q \ge 0$
3599 % 58
3600 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3602 % a4
3603 \verb+{0,2,5}+ & $(0,q,0)$ & $q \ge 0$, $p \ge 0$ and $-q + r \ge 0$
3605 % 34
3606 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3608 % 8c
3609 \verb+{0,4,5}+ & $(0, q, -p+r)$ & $q \ge 0$, $-q + r \ge 0$ and $p \ge 0$
3611 % 1c
3612 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3613 \end{tabular}
3615 Combining these constraints with the initial constraints of the problem
3616 on the parameters
3617 $p \ge 0$, $q \ge 0$ and $r \ge 0$, we find the chamber
3619 \{\,
3620 (p,q,r) \mid p \ge 0 \wedge -p + r \ge 0 \wedge q \ge 0
3621 \,\}
3623 For the second chamber, we have
3625 \begin{tabular}{ccc}
3626 % 70
3627 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3629 % 58
3630 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3632 % 34
3633 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3635 % 1c
3636 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3638 % 64
3639 \verb+{1,2,5}+ & $(-\frac q 2,0,0)$ &
3640 $-q \ge 0$, $2p + q \ge 0$ and $-2p -q+2r \ge 0$
3642 % 4c
3643 \verb+{1,4,5}+ & $(-\frac q 2,0,-p-\frac q 2+r)$ &
3644 $-q \ge 0$, $-2p -q+2r \ge 0$ and $2p + q \ge 0$
3645 \end{tabular}
3647 The chamber is therefore
3649 \{\,
3650 (p,q,r) \mid q = 0 \wedge p \ge 0 \wedge -p +r \ge 0
3651 \,\}
3653 Note that by intersecting with the initial constraints this chamber
3654 is no longer full-dimensional and can therefore be discarded.
3655 Finally, for the third chamber, we have
3657 \begin{tabular}{ccc}
3658 % 70
3659 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3661 % 58
3662 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
3664 % 34
3665 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3667 % 1c
3668 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
3670 % 68
3671 \verb+{1,2,4}+ & $(p-r,0,0)$ &
3672 $p -r \ge 0$, $r \ge 0$ and $2p +q -2r \ge 0$
3674 % 2c
3675 \verb+{2,4,5}+ & $(p-r,2p+q-2r, 0)$ &
3676 $p -r \ge 0$, $2p +q -2r \ge 0$ and $r \ge 0$
3677 \end{tabular}
3679 The chamber is therefore
3681 \{\,
3682 (p,q,r) \mid p - r \ge 0 \wedge q \ge 0 \wedge r \ge 0
3683 \,\}
3685 \end{example}
3687 Now let us consider general parametric polytopes.
3688 First note that we can follow the same procedure as above
3689 if we replace $\vec x$ by $\vec x' - \vec c(\vec p)$
3690 in \eqref{eq:TOPCOM:polytope}, i.e.,
3691 if our problem has the form
3692 \begin{equation}
3693 \label{eq:TOPCOM:polytope:2}
3694 \begin{cases}
3695 \begin{aligned}
3696 \vec x' &\ge \vec c(\vec p)
3698 A \, \vec x' &\le \vec b(\vec p) + A \vec c(\vec p)
3700 \end{aligned}
3701 \end{cases}
3702 \end{equation}
3703 as saturating a constraint $x_i = 0$ is equivalent
3704 to saturating the constraint $x_i' = c_i(\vec p)$
3705 and, similarly, $\sps {\vec a_j}{\vec x} = b_j(\vec p)$
3706 is equivalent to
3707 $\sps {\vec a_j}{\vec x'} = b_j(\vec p) + \sps {\vec a_j}{\vec c(\vec p)}$.
3709 In the general case, the problem has the form
3711 A \vec x \ge \vec b(\vec p)
3713 and then we apply the technique of \autoref{s:standard}.
3714 Let $A'$ be a non-singular square submatrix of $A$ with the same number
3715 of columns and compute the (left) \indac{HNF} $H = A' U$ with $U$ unimodular
3716 and $H$ lower-triangular with non-positive elements below the diagonal.
3717 Replacing $\vec x$ by $U \vec x'$, we obtain
3719 \begin{cases}
3720 \begin{aligned}
3721 H \vec x' &\ge \vec b'(\vec p)
3723 -A''U \, \vec x' &\le -\vec b''(\vec p)
3725 \end{aligned}
3726 \end{cases}
3728 with $A''$ the remaining rows of $A$ and $\vec b(\vec p)$ split
3729 in the same way.
3730 If $H$ happens to be the identity matrix, then our problem is
3731 of the form \eqref{eq:TOPCOM:polytope:2} and we already know how
3732 to solve this problem.
3733 Note that, again, saturating any of the transformed constraints
3734 in $\vec x'$ is equivalent to saturating the corresponding constraint
3735 in $\vec x$. We therefore only need to compute $-A'' U$ for the
3736 computation of the kernel $K$. To construct the parametric vertices
3737 in the original coordinate system, we can simply use the original
3738 constraints.
3739 The same reasoning holds if $H$ is any diagonal matrix, since
3740 we can virtually replace $H \vec x$ by $\vec x'$ without affecting
3741 the non-negativity of the variables.
3743 If $H$ is not diagonal, then we can introduce new constraints
3744 $x'_j \ge d(\vec p)$, where $d(\vec p)$ is some symbolic constant.
3745 These constraints do not remove any solutions
3746 since each row in $H$ expresses that the corresponding variable is
3747 greater than or equal to a non-negative combination of the
3748 previous variables plus some constant.
3749 We can then proceed as before. However, to reduce unnecessary computations
3750 we may remove from $K$ the rows that correspond to these new rows.
3751 Any solution saturating the new constraint, would also saturate
3752 the corresponding constraint $\vec h_j^\T$ and all
3753 the constraints corresponding to the non-zero
3754 entries in $\vec h_j^\T$.
3755 If a chamber contains a vertex obtained by saturating such a new
3756 constraint, it would appear multiple times in the same chamber,
3757 each time combined with different constraints from the above set.
3758 Furthermore, there would also be another (as it turns out, identical)
3759 chamber where the vertex is only defined by the other constraints.
3761 \begin{example}
3762 Consider the parametric polytope
3764 P(n) = \{\,
3765 (i,j) \mid
3766 1 \le i \wedge 2 i \le 3 j \wedge j \le n
3767 \,\}
3770 The constraints are
3772 \begin{bmatrix}
3773 1 & 0 \\
3774 -2 & 3 \\
3775 0 & -1
3776 \end{bmatrix}
3777 \begin{bmatrix}
3778 i \\ j
3779 \end{bmatrix}
3781 \begin{bmatrix}
3782 1 \\
3783 0 \\
3785 \end{bmatrix}
3788 The top $2 \times 2$ submatrix is already in \indac{HNF}.
3789 We have $3 j \ge 2i \ge 2$, so we can add a constraint
3790 of the form $j \ge c(n)$ and obtain
3792 \begin{bmatrix}
3793 A & I
3794 \end{bmatrix}
3796 \begin{bmatrix}
3797 0 & 1 & 1 & 0
3799 2 & -3 & 0 & 1
3800 \end{bmatrix}
3803 while $K$ with $\begin{bmatrix}A & I\end{bmatrix} K = 0$ is given
3806 \begin{bmatrix}
3807 0 & 1 & 1 & 0
3809 2 & -3 & 0 & 1
3810 \end{bmatrix}
3811 \begin{bmatrix}
3812 1 & 0 \\
3813 0 & 1 \\
3814 0 & -1 \\
3815 -2 & 3
3816 \end{bmatrix}
3819 The second row of $K$ corresponds to the second variable,
3820 which in turn corresponds to the newly added constraint.
3821 Passing all rows of $K$ to \ai[\tt]{TOPCOM} we would get
3822 \begin{verbatim}
3823 > points2triangs --regular <<EOF
3824 > [[1 0],[0,1],[0,-1],[-2,3]]
3825 > EOF
3826 T[1]:={{0,1},{0,2},{1,3},{2,3}};
3827 T[2]:={{0,2},{2,3},{0,3}};
3828 T[3]:={};
3829 \end{verbatim}
3830 The first vertex in the first chamber saturates the second row
3831 (row 1) and therefore saturates both the first (0) and fourth (3)
3832 and it appears a second time as \verb+{1,3}+. Combining
3833 these ``two'' vertices into one as \verb+{0,3}+ results in the
3834 second (identical) chamber.
3835 Removing the row corresponding to the new constraint from $K$
3836 we remove the duplicates
3837 \begin{verbatim}
3838 > points2triangs --regular <<EOF
3839 > [[1 0],[0,-1],[-2,3]]
3840 > EOF
3841 T[1]:={{0,1},{1,2},{0,2}};
3842 T[2]:={};
3843 \end{verbatim}
3844 Note that in this example, we also could have interchanged
3845 the second and the third constraint and then have replaced $j$ by $-j'$.
3846 \end{example}
3848 In practice, this method of computing a \ai{chamber decomposition}
3849 does not seem to perform very well, mostly because
3850 \ai[\tt]{TOPCOM} can not exploit all available information
3851 about the parametric polytopes and will therefore compute
3852 many redundant triangulations/chambers.
3853 In particular, any chamber that does not intersect with
3854 the parameter domain of the parametric polytope, or only
3855 intersects in a face of this parameter domain, is completely redundant.
3856 Furthermore, if the parametric polytope is not simple, then many
3857 different combinations of the constraints will lead to the same parametric
3858 vertex. Many triangulations will therefore correspond to one and the
3859 same chamber in the chamber complex of the parametric polytope.
3860 For example, for a dilated octahedron, \ai[\tt]{TOPCOM} will
3861 compute 150 triangulations/chambers, 104 of which are empty,
3862 while the remaining 46 refer to the same single chamber.
3865 \subsection{Computing the Hilbert basis of a cone}
3866 \label{s:hilbert}
3868 To compute the \ai{Hilbert basis} of a cone, we use
3869 the \ai[\tt]{zsolve} library from \ai[\tt]{4ti2} \shortcite{4ti2},
3870 which implements the technique of \shortciteN{Hemmecke2002Hilbert}.
3871 We first remove all equalities from the cone through unimodular
3872 transformations and then apply the technique of \autoref{s:standard}
3873 to put the cone in ``standard form''. Note that for a (non-parametric)
3874 cone the constant term $\vec b$ in \eqref{eq:non-standard} is $\vec 0$.
3875 The constraints $D \vec x \ge \vec c = \vec 0$ of \eqref{eq:standard:2}
3876 are therefore equivalent to $\vec x \ge \vec 0$.
3879 \subsection{Computing the integer hull of a truncated cone}
3880 \label{s:hull:cone}
3882 In \autoref{s:width} we will need to compute the \ai{integer hull}
3883 of a cone with the origin removed ($C \setminus \{ \vec 0 \}$).
3885 As proposed by \shortciteN{Koeppe2007personal},
3886 one way of computing this integer hull is to first compute
3887 the \ai{Hilbert basis} of $C$ (see \autoref{s:hilbert})
3888 and to then remove from that Hilbert basis the points that
3889 are not vertices of the integer hull of $C \setminus \{ \vec 0 \}$.
3890 The Hilbert basis of $C$ is the minimal set of points
3891 $\vec b_i \in C \cap \ZZ^d$ such that every integer point
3892 $\vec x \in C \cap \ZZ^d$ can be written as a non-negative
3893 {\em integer} combination of the $\vec b_i$.
3894 The vertices $\vec v_j$ of the integer hull of $C \setminus \{ \vec 0 \}$
3895 are such that every integer point
3896 $\vec x \in (C \cap \ZZ^d) \setminus \{ \vec 0 \}$ can
3897 be written as s non-negative {\em rational} combination of $\vec v_j$.
3898 Clearly, any $\vec v_j$ is also a $\vec b_i$ since $\vec v_j$ can
3899 not be written as the sum of a (rational) convex combination of
3900 other integer points in $(C \cap \ZZ^d) \setminus \{ \vec 0 \}$
3901 and a non-negative combination of the extremal rays $\vec r_k$ of $C$.
3902 A fortiori, it can therefore not be written as an integer combination
3903 of other integer points in $C$.
3904 To obtain the $\vec v_j$ from the $\vec b_i$ we therefore simply
3905 need to remove first $(0,0)$ and then those $\vec b_i$ that are
3906 not an extremal ray and that {\em can} be written as a combination
3908 \vec b_i = \sum_{j \ne i} \vec \alpha_j \vec b_j + \sum_k \beta_k \vec r_k
3909 \qquad\text{with $\alpha_j, \beta_k \ge 0$ and $\sum_{j \ne i} \alpha_j = 1$}
3912 Since the $\vec r_k$ are also among the $\vec b_j$, this can
3913 be simplified to checking whether there exist a rational
3914 solution for $\vec \alpha_j$ to
3916 \vec b_i = \sum_{j \ne i} \vec \alpha_j \vec b_j
3917 \qquad\text{with $\alpha_j \ge 0$ and $\sum_{j \ne i} \alpha_j \ge 1$}
3921 \begin{figure}
3922 \intercol=1.1cm
3923 \begin{xy}
3924 <\intercol,0pt>:<0pt,\intercol>::
3925 \POS@i@={(3,-4.5),(2,-3),(1,-1),(1,1),(3,4),(4.125,5.5),(5.5,5.5),(5.5,-4.5)},{0*[grey]\xypolyline{*}}
3926 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
3927 \POS0,{\xylattice{-0}{5}00}%
3928 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(5.5,0)}%
3929 \POS0,{\xylattice00{-4}5}%
3930 \POS0\ar(2,-3)
3931 \POS0\ar(3,4)
3932 \POS(2,-3)*{\bullet}
3933 \POS(3,4)*{\bullet}
3934 \POS(1,1)*{\bullet}
3935 \POS(1,-1)*{\bullet}
3936 \POS(1,0)*{\bullet}
3937 \POS(2,-3)*{\times}
3938 \POS(3,4)*{\times}
3939 \POS(1,1)*{\times}
3940 \POS(1,-1)*{\times}
3941 \end{xy}
3942 \caption{The Hilbert basis and the integer hull of a truncated cone}
3943 \label{f:hilbert:hull}
3944 \end{figure}
3946 \begin{example}
3947 Consider the cone
3949 C = \poshull \,\{(2,-3), (3,4)\}
3952 shown in Figure~\ref{f:hilbert:hull}.
3953 The Hilbert basis of this cone is
3954 $$\{(0,0),(2,-3),(3,4),(1,1),(1,-1),(1,0)\}.$$
3955 We have $(1,0) = \frac 1 2 (1,1) + \frac 1 2 (1,-1)$,
3956 while $(1,1)$ and $(1,-1)$ can not be written as
3957 overconvex combinations of the other $\vec b_i \ne \vec 0$.
3958 The vertices of the integer hull of $C \setminus \{ \vec 0 \}$
3959 are therefore
3960 $$\{(2,-3),(3,4),(1,1),(1,-1)\}.$$
3961 \end{example}
3964 \subsection{Computing the lattice width of a parametric polytope}
3965 \label{s:width}
3967 To compute the \ai{lattice width} of a \ai{parametric polytope},
3968 we essentially use the technique of \shortciteN{Eisenbrand2007parameterised},
3969 which improves upon the technique of \shortciteN{Kannan1992}.
3970 Given a parametric polytope
3972 P(\vec p) = \{\, \vec x \mid A \vec x + \vec b(\vec p) \ge \vec 0 \,\}
3975 the width along a direction $\vec c$ is defined as
3976 \begin{equation}
3977 \label{eq:width}
3978 \width_{\vec c} P(\vec p)
3980 \max \{\, \sp c x \mid \vec x \in P(\vec p) \,\}
3982 \min \{\, \sp c x \mid \vec x \in P(\vec p) \,\}
3984 \end{equation}
3985 The \defindex{lattice width} is the minimum width over all
3986 non-zero integer directions:
3988 \width P(\vec p) =
3989 \min_{\vec c \in \ZZ^d \setminus \{ \vec 0 \} } \width_{\vec c} P(\vec p)
3992 We assume that the parameter domain $Q$ of $P(\vec p)$, i.e., the
3993 set of parameter values for which $P(\vec p) \ne \emptyset$,
3994 is full-dimensional and that for each $\vec p$ from the interior
3995 of $Q$, $P(\vec p)$ is also full-dimensional.
3997 Clearly, for any given direction $\vec c$, the minimum and
3998 maximum in \eqref{eq:width} are attained at (different)
3999 vertices of $P(\vec p)$.
4000 The idea of the algorithm is then to consider all pairs
4001 of parametric vertices of $P(\vec p)$, to compute all candidate
4002 integer directions for a given pair of vertices and then to
4003 compute the minimum width over all candidate integer directions
4004 found.
4006 For any given parametric vertex $\vec v(\vec p)$, the (rational)
4007 directions for which this vertex is minimal can be found as follows.
4008 Let $\vec v(\vec p) + C$ be the \ai{vertex cone} of $\vec v(\vec p)$.
4009 If $\vec v(\vec p)$ is minimal for $\vec c$, then all other points
4010 in the vertex cone must yield a bigger or equal value, i.e.,
4011 $\sp y c \ge 0$ for all $\vec y \in C$.
4012 The set of directions is therefore the \ai{polar cone} $C^*$ of $C$.
4013 Note that, in principle, we should only do this for pairs
4014 of vertices that have a common activity domain, where the
4015 activity domains have been partially opened using the
4016 technique of \autoref{p:inclusion-exclusion} to avoid
4017 multiple vertices that coincide on a lower-dimensional
4018 chamber to all be considered on this intersection.
4019 However, this optimization has currently not been implemented.
4021 Given a pair of vertices $\vec v_1(\vec p)$ and $\vec v_2(\vec p)$,
4022 we may assume that $\vec v_1(\vec p)$ attains the minimum and
4023 $\vec v_2(\vec p)$ attains the maximum.
4024 If $\vec v_1(\vec p) + C_1$ and $\vec v_2(\vec p) + C_2$ are the
4025 corresponding vertex cones, then the set of (rational) directions for this
4026 pair of vertices is
4028 C_{1,2} = \left( C_1^* \cap -C_2^* \right) \setminus \{ \vec 0 \}
4031 The set of candidate integer directions are therefore
4032 the vertices of the integer hull of $C_{1,2}$, which
4033 can be computed as explained in \autoref{s:hull:cone}.
4034 To see this, note that by construction
4035 $\sps {\vec c}{\vec v_1(\vec p)} \le \sps {\vec c}{\vec v_2(\vec p)}$
4036 and so
4038 w_{\vec c}(\vec p) = \width_{\vec c} P(\vec p)
4039 = \sps {\vec c}{\vec v_2(\vec p)-\vec v_1(\vec p)} \ge 0
4042 Any integer direction in $C_{1,2}$ will therefore yield
4043 a width that is at least as large as that of one
4044 of the vertices of the integer hull.
4046 After computing a list of all possible candidate width directions
4047 $\vec c_i$ and the corresponding widths $w_{\vec c_i}(\vec p)$,
4048 we keep only a single direction of all those that yield
4049 the same width (as an affine function of the parameters).
4050 Then we construct the chambers where each of the widths is minimal,
4051 i.e.,
4053 C_i = \{\, \vec p \in Q \mid \forall j :
4054 w_{\vec c_i}(\vec p) \le w_{\vec c_j}(\vec p) \,\}
4057 Note that many of the $C_i$ may be empty or of lower dimension
4058 than Q and that the other $C_i$ will intersect in common facets.
4059 To obtain a partition of partially-open full-dimensional chambers, we proceed
4060 as in \autoref{s:triangulation}.
4062 \begin{figure}
4063 \intercol=1.1cm
4064 \begin{xy}
4065 <\intercol,0pt>:<0pt,\intercol>::
4066 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
4067 \POS0,{\xylattice{-0}{10}00}%
4068 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(10.5,0)}%
4069 \POS0,{\xylattice00{-0}7}%
4070 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*[|(2)]\xypolyline{}}
4071 \POS(0,0)*{\bullet}
4072 \POS(5,3)*{\bullet}
4073 \POS(5,4)*{\bullet}
4074 \POS(9,6)*{\bullet}
4075 \POS(3,2)*{\bullet}
4076 \POS(4,3)*{\bullet}
4077 \POS(6,4)*{\bullet}
4078 \POS(7,5)*{\bullet}
4079 \POS(9,6);(8.7,6.4)**{}?(0)/1.1cm/="a"\POS(9,6)\ar"a"
4080 \POS(9,6);(9.1,5.8)**{}?(0)/1.1cm/="a"\POS(9,6)\ar"a"
4081 \POS(5,4);(5.4,3.5)**{}?(0)/1.1cm/="a"\POS(5,4)\ar"a"
4082 \POS(5,4);(5.1,3.8)**{}?(0)/1.1cm/="a"\POS(5,4)\ar"a"
4083 \POS(0,0);(0.4,-0.5)**{}?(0)/1.1cm/="a"\POS(0,0)\ar"a"
4084 \POS(0,0);(-0.3,0.5)**{}?(0)/1.1cm/="a"\POS(0,0)\ar"a"
4085 \POS(5,3);(4.7,3.5)**{}?(0)/1.1cm/="a"\POS(5,3)\ar"a"
4086 \POS(5,3);(4.7,3.4)**{}?(0)/1.1cm/="a"\POS(5,3)\ar"a"
4087 \POS(9,6)*+!DL{\vec v_1}
4088 \POS(0,0)*+!UR{\vec v_3}
4089 \POS(5,3)*+!UL{\vec v_2}
4090 \POS(5,4)*+!DR{\vec v_4}
4091 \end{xy}
4092 \caption{A polytope and its candidate width directions}
4093 \label{f:width}
4094 \end{figure}
4096 \begin{example}
4097 Consider the (non-parametric) polytope
4099 P = \left\{\,
4100 \vec x \mid
4101 \begin{aligned}
4102 -3 x_1 +5 x_2 &\ge 0 \\
4103 4 x_1 -5 x_2 &\ge 0 \\
4104 x_1 -2 x_2 + 3 &\ge 0 \\
4105 -3 x_1 +4 x_2 + 3 &\ge 0
4106 \end{aligned}
4107 \,\right\}
4109 shown in \autoref{f:width}. The polytope has four vertices
4111 \begin{aligned}
4112 \vec v_1 & = (9,6) \\
4113 \vec v_2 & = (5,4) \\
4114 \vec v_3 & = (0,0) \\
4115 \vec v_4 & = (5,3)
4117 \end{aligned}
4119 The corresponding cones of directions (for
4120 the given vertex to attain the minimum), also shown
4121 in \autoref{f:width} are
4123 \begin{aligned}
4124 C^*_1 & = \poshull \,\{ (-3,4), (1,-2) \} \\
4125 C^*_2 & = \poshull \,\{ (4,-5), (1,-2) \} \\
4126 C^*_3 & = \poshull \,\{ (4,-5), (-3,5) \} \\
4127 C^*_4 & = \poshull \,\{ (-3,5), (-3,4) \}
4129 \end{aligned}
4132 \begin{figure}
4133 \intercol=0.8cm
4134 \begin{xy}
4135 <\intercol,0pt>:<0pt,\intercol>::
4136 \def\latticebody{\POS="c"+(0,-6.5)\ar@{--}"c"+(0,2.5)}%
4137 \POS0,{\xylattice{-1}{5}00}%
4138 \def\latticebody{\POS="c"+(-1.5,0)\ar@{--}"c"+(5.5,0)}%
4139 \POS0,{\xylattice00{-6}2}%
4140 \POS0\ar@{->}(3,-4)\POS?!{(0,-6.5);(1,-6.5)}="a"
4141 \POS0\ar@{->}(-1,2)
4142 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
4143 \POS0\ar@{->}(1,-2)
4144 \POS@i@={"a",(3,-4),(4,-5),"b"},{0*[grey]\xypolyline{*}}
4145 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
4146 \POS0,{\ellipse(1)(*0;(2,1)*),^,(*0;(5,4)*){-}}
4147 \POS0\ar@{->}(3,-4)\POS?!{(0,-6.5);(1,-6.5)}="a"
4148 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
4149 \POS(4,-5)*{\bullet}
4150 \POS(3,-4)*{\bullet}
4151 \end{xy}
4152 \caption{The cone of directions $C_{2,1}$}
4153 \label{f:C:2:1}
4154 \end{figure}
4156 \begin{figure}
4157 \intercol=0.8cm
4158 \begin{xy}
4159 <\intercol,0pt>:<0pt,\intercol>::
4160 \def\latticebody{\POS="c"+(0,-6.5)\ar@{--}"c"+(0,5.5)}%
4161 \POS0,{\xylattice{-3}{5}00}%
4162 \def\latticebody{\POS="c"+(-3.5,0)\ar@{--}"c"+(5.5,0)}%
4163 \POS0,{\xylattice00{-6}5}%
4164 \POS0\ar@{->}(3,-4)
4165 \POS0\ar@{->}(-1,2)\POS?!{(0,5.5);(1,5.5)}="a"
4166 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
4167 \POS0\ar@{->}(-3,5)
4168 \POS@i@={"b",(4,-5),(1,-1),(-1,2),"a",(5.5,5.5),(5.5,-6.5)},{0*[grey]\xypolyline{*}}
4169 \POS0\ar@{->}(-1,2)\POS?!{(0,5.5);(1,5.5)}="a"
4170 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
4171 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
4172 \POS0,{\ellipse(1)(*0;(5,4)*),^,(*0;(-5,-3)*){-}}
4173 \POS(1,-1)*{\bullet}
4174 \POS(4,-5)*{\bullet}
4175 \POS(-1,2)*{\bullet}
4176 \end{xy}
4177 \caption{The cone of directions $C_{3,1}$}
4178 \label{f:C:3:1}
4179 \end{figure}
4181 \begin{figure}
4182 \intercol=0.8cm
4183 \begin{xy}
4184 <\intercol,0pt>:<0pt,\intercol>::
4185 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
4186 \POS0,{\xylattice{-3}{3}00}%
4187 \def\latticebody{\POS="c"+(-3.5,0)\ar@{--}"c"+(3.5,0)}%
4188 \POS0,{\xylattice00{-4}5}%
4189 \POS0\ar@{->}(3,-4)
4190 \POS0\ar@{->}(-1,2)
4191 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
4192 \POS0\ar@{->}(-3,5)
4193 \POS0\ar@{->}(-3,4)
4194 \POS0,{\ellipse(1)(*0;(-5,-3)*),^,(*0;(-4,-3)*){-}}
4195 \end{xy}
4196 \caption{The cone of directions $C_{4,1}$}
4197 \label{f:C:4:1}
4198 \end{figure}
4200 Let us now consider the directions in which
4201 $\vec v_2$ is minimal while $\vec v_1$ is maximal.
4202 We find
4204 C_{2,1} = \poshull \,\{ (4,-5), (3,-4) \} \setminus \{ \vec 0 \}
4207 as shown in \autoref{f:C:2:1}.
4208 The vertices of the integer hull of $C_{2,1}$ are $(4,-5)$
4209 and $(3,-4)$.
4210 The corresponding width are
4212 \begin{aligned}
4213 \vec c_1 &= (4,-5) & w_{\vec c_1} &= 6 \\
4214 \vec c_2 &= (3,-4) & w_{\vec c_2} &= 4
4216 \end{aligned}
4218 We similarly find
4220 C_{3,1} = \poshull \,\{ (4,-5), (-1,2) \} \setminus \{ \vec 0 \}
4223 with integer hull
4224 $\poshull \,\{ (4,-5), (-1,2), (1,-1) \}$, shown
4225 in \autoref{f:C:3:1}, yielding
4227 \begin{aligned}
4228 \vec c_3 &= (4,-5) & w_{\vec c_3} &= 6 \\
4229 \vec c_4 &= (-1,2) & w_{\vec c_4} &= 3 \\
4230 \vec c_5 &= (1,-1) & w_{\vec c_5} &= 3
4232 \end{aligned}
4234 On the other hand,
4236 C_{4,1} = \emptyset
4239 as shown in \autoref{f:C:4:1} and so this combination
4240 does not yield any width direction candidates.
4241 The other pairs of vertices further yield
4243 \begin{aligned}
4244 \vec c_6 &= (-1,2) & w_{\vec c_6} &= 3 \\
4245 \vec c_7 &= (-3,5) & w_{\vec c_7} &= 5 \\
4246 \vec c_8 &= (-3,4) & w_{\vec c_8} &= 4 \\
4247 \vec c_9 &= (-3,5) & w_{\vec c_9} &= 5 \\
4248 \vec c_{10} &= (-2,3) & w_{\vec c_{10}} &= 3
4250 \end{aligned}
4252 Since the polytope under consideration is not parametric,
4253 there is only one (non-empty, $0$-dimensional) chamber and
4254 it corresponds to one of the directions, say $\vec c_4 = (-1,2)$,
4255 with width $3$ (the other directions with the same width
4256 having been removed).
4258 \begin{figure}
4259 \intercol=1.1cm
4260 \begin{xy}
4261 <\intercol,0pt>:<0pt,\intercol>::
4262 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
4263 \POS0,{\xylattice{-0}{10}00}%
4264 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(10.5,0)}%
4265 \POS0,{\xylattice00{-0}7}%
4266 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*[|(2)]\xypolyline{}}
4267 \POS(-0.5,-0.5)\ar@{.}(7.5,7.5)
4268 \POS(0.5,-0.5)\ar@{.}(8.5,7.5)
4269 \POS(1.5,-0.5)\ar@{.}(9.5,7.5)
4270 \POS(2.5,-0.5)\ar@{.}(10.5,7.5)
4271 \POS(-0.5,-0.25)\ar@{-}(10.5,5.25)
4272 \POS(-0.5,0.25)\ar@{-}(10.5,5.75)
4273 \POS(-0.5,0.75)\ar@{-}(10.5,6.25)
4274 \POS(-0.5,1.25)\ar@{-}(10.5,6.75)
4275 \POS(-0.25,-0.5)\ar@{--}(10.5,6.666)
4276 \POS(-0.5,-0.333)\ar@{--}(10.5,7)
4277 \POS(-0.5,0)\ar@{--}(10.5,7.333)
4278 \POS(-0.5,0.333)\ar@{--}(10.25,7.5)
4279 \POS(0,0)*{\bullet}
4280 \POS(5,3)*{\bullet}
4281 \POS(5,4)*{\bullet}
4282 \POS(9,6)*{\bullet}
4283 \POS(3,2)*{\bullet}
4284 \POS(4,3)*{\bullet}
4285 \POS(6,4)*{\bullet}
4286 \POS(7,5)*{\bullet}
4287 \end{xy}
4288 \caption{A polytope and its lattice width directions}
4289 \label{f:width:2}
4290 \end{figure}
4292 Each of the three directions that yield the minimal
4293 width of 3 is shown in \autoref{f:width:2}.
4294 \end{example}
4296 \begin{example}
4297 Consider the polytope
4299 P(p) = \left\{\,
4300 \vec x \mid
4301 \begin{aligned}
4302 -2 x_1 + p + 5 &\ge 0 \\
4303 2 x_1 + p + 5 &\ge 0 \\
4304 -2 x_2 - p + 5 &\ge 0 \\
4305 2 x_2 - p + 5 &\ge 0
4306 \end{aligned}
4307 \,\right\}
4309 from \shortciteN[Example~2.1.7]{Woods2004PhD}.
4310 The parametric vertices are
4312 \begin{aligned}
4313 \vec v_1(p) & = \left(\frac{p+5}2, \frac{-p+5}2\right) \\
4314 \vec v_2(p) & = \left(\frac{p+5}2, \frac{p-5}2\right) \\
4315 \vec v_3(p) & = \left(\frac{-p-5}2, \frac{-p+5}2\right) \\
4316 \vec v_4(p) & = \left(\frac{-p-5}2, \frac{p-5}2\right)
4318 \end{aligned}
4320 We find two essentially different candidate width directions
4322 \begin{aligned}
4323 \vec c_1 &= (0,1) & w_{\vec c_1}(p) &= 5-p \\
4324 \vec c_2 &= (1,0) & w_{\vec c_2}(p) &= 5+p
4326 \end{aligned}
4328 The first direction can be found by combining, say,
4329 $\vec v_1(p)$ and $\vec v_2(p)$, while the second direction can be
4330 found by combining, say, $\vec v_1(p)$ and $\vec v_3(p)$.
4331 The parameter domain for the parametric polytope $P(p)$ is
4333 Q = \{\, p \mid -5 \le p \le 5 \,\}
4336 The two (closed) chambers are therefore
4338 \begin{aligned}
4339 C_1 &= \{\, p \in Q \mid 5 - p \le 5+p \,\} \\
4340 C_2 &= \{\, p \in Q \mid 5 + p \le 5-p \,\}
4342 \end{aligned}
4344 To obtain a partition, \autoref{s:interior} gives
4345 the internal point $(0,0)$, which happens to meet
4346 the facets $p \ge 0$ and $-p \ge 0$. We therefore
4347 keep the facet with positive (inner) normal closed
4348 and open up the other facet. The result is
4350 \begin{aligned}
4351 \hat C_1 &= \{\, p \mid 0 \le p \le 5 \,\} \\
4352 \hat C_2 &= \{\, p \mid -5 \le p < 0 \,\}
4354 \end{aligned}
4356 Since we are usually only interested in integer parameter
4357 values, the latter chamber would become
4358 $\hat C_2 = \{\, p \mid -5 \le p \le -1 \,\}$.
4359 \end{example}
4361 Our description differs slightly from that of
4362 of \shortciteN{Eisenbrand2007parameterised}.
4363 First, they consider all pairs of basic solutions instead
4364 of all pairs of vertices, which means that they may
4365 consider basic solutions that are never feasible and that,
4366 in case of a non-simple polytope,
4367 they may consider the same parametric vertex more than once.
4368 The set of integer
4369 directions for a pair of vertices is the intersection of
4370 the sets of integer directions they obtain for each of
4371 the corresponding basic solutions.
4372 Second, they use a different method of creating a partition
4373 of partially-open chambers, which may lead to some lower-dimensional
4374 chambers surviving and hence to a larger total number of chambers.