update isl for isl_pw_qpolynomial_bound_range
[barvinok.git] / doc / implementation.tex
blobfab02d08517807336353a54808b83af4b26be952
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 = \vert\det A\vert$, 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 $\vert\det A\vert = \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{Koeppe2008parametric}]
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{Koeppe2008parametric}.
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 compute \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}
1480 \label{s:exponential}
1482 This section draws heavily from \shortciteN{Koeppe2006experiments}.
1484 We define a ``short'' \defindex{\rgf/} to be a function of the form
1485 \begin{equation}
1486 \label{eq:rgf}
1487 f(\vec x)=
1488 \sum_{i\in I}\alpha_i
1489 \frac{\sum_{k=1}^{r} \vec x^{\vec w_{ik} }}
1490 {\prod_{j=1}^{k_i}\left(1-\vec x^{\vec b_{ij}}\right)}
1492 \end{equation}
1493 with $\vec x \in \CC^d$, $\alpha_i \in \QQ$,
1494 $\vec w_{i k} \in \ZZ^d$ and $\vec b_{i j} \in \ZZ^d \setminus \{\vec 0\}$.
1496 After computing the \rgf/~\eqref{eq:rgf} of a polytope
1497 (with $k_i = d$ for all $i$),
1498 the number of lattice points in the polytope can be obtained
1499 by evaluating $f(\vec 1)$. Since $\vec 1$ is a pole of each
1500 term, we need to compute the constant term in the Laurent expansions
1501 of each term in~\eqref{eq:rgf} about $\vec 1$.
1502 Since it is easier to work with univariate series, a substitution is usually
1503 applied, either a \ai{polynomial substitution}
1505 \vec x = (1+t)^{\vec \lambda}
1508 as implemented in \LattE/ \shortcite{latte1.1},
1509 or an \ai{exponential substitution} (see, e.g., \shortciteNP{Barvinok1999}),
1511 \vec x = e^{t \vec \lambda}
1514 as implemented in \LattEmk/ \shortcite{latte-macchiato}.
1515 In each case, $\vec \lambda \in \ZZ^d$ is a vector that is not orthogonal
1516 to any of the $\vec b_{ij}$.
1517 Both substitutions also transform the problem of computing the
1518 constant term in the Laurent expansions about $\vec x = \vec 1$
1519 to that of computing the constant term in the
1520 Laurent expansions about $t = 0$.
1521 Here, we discuss the exponential substitution.
1523 Consider now one of the terms in~\eqref{eq:rgf},
1525 g(t) =
1526 \frac{\sum_{k=1}^{r} e^{a_k t}}
1527 {\prod_{j=1}^{d}\left(1-e^{c_j t}\right)}
1530 with $a_k = \sp{w_{ik}}{\lambda}$ and $c_j = \sp{b_{ij}}{\lambda}$.
1531 We rewrite this equation as
1533 g(t) =
1534 (-1)^d
1535 \frac{\sum_{k=1}^{r} e^{a_k t}}
1536 {t^d \prod_{j=1}^d c_j}
1537 \prod_{j=1}^d \frac{-c_j t}
1538 {1-e^{c_j t}}
1541 The second factor is analytic in a neighborhood of the origin
1542 $t = c_1 = \cdots = c_d = 0$ and therefore has a Taylor series expansion
1543 \begin{equation}
1544 \label{eq:todd}
1545 \prod_{j=1}^d \frac{-c_j t}
1546 {1-e^{c_j t}}
1548 \sum_{m=0}^{\infty} \todd_m(-c_1, \ldots, -c_d) t^m
1550 \end{equation}
1551 where $\todd_m$ is a homogeneous polynomial of degree $m$ called
1552 the $m$-th \ai{Todd polynomial}~\cite{Barvinok1999}.
1553 Also expanding the numerator in the first factor, we find
1555 g(t) = \frac{(-1)^d}{t^d \prod_{j=1}^d c_j}
1556 \left(
1557 \sum_{n=0}^{\infty}\frac{\sum_{k=1}^{r} a_k^n}{n!} t^n
1558 \right)
1559 \left(
1560 \sum_{m=0}^{\infty} \todd_m(-c_1, \ldots, -c_d) t^m
1561 \right)
1564 with constant term
1565 \begin{multline}
1566 \label{eq:todd:constant}
1567 \frac{(-1)^d}{t^d \prod_{j=1}^d c_j}
1568 \left(\sum_{i=0}^d \frac{\sum_{k=1}^{r} a_k^i}{i!}
1569 \todd_{d-i}(-c_1, \ldots, -c_d)\right)t^d
1570 = \\
1571 \frac{(-1)^d}{\prod_{j=1}^d c_j}
1572 \sum_{i=0}^d \frac{\sum_{k=1}^{r} a_k^i}{i!} \todd_{d-i}(-c_1, \ldots, -c_d)
1574 \end{multline}
1575 To compute the first $d+1$ terms in the Taylor series~\eqref{eq:todd},
1576 we write down the truncated Taylor series
1578 \frac{e^t -1}t \equiv
1579 \sum_{i=0}^d \frac 1{(i+1)!} t^i \equiv
1580 \frac 1 {(d+1)!} \sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i
1581 \mod t^{d+1}
1584 where we have
1586 \frac 1 {(d+1)!} \sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i
1587 \in \frac 1{(d+1)!} \ZZ[t]
1590 Computing the reciprocal as explained in Section~\ref{s:division},
1591 we find
1592 \begin{equation}
1593 \label{eq:t-exp-1}
1594 \frac{-t}{1-e^t} =
1595 \frac{t}{e^t-1} = \frac 1{\frac{e^t -1}t}
1596 \equiv (d+1)! \frac 1{\sum_{i=0}^d \frac{(d+1)!}{(i+1)!} t^i}
1597 \eqqcolon \sum_{i=0}^d b_i t^i
1599 \end{equation}
1600 Note that the constant term of the denominator is $1/(d+1)!$.
1601 The denominators of the quotient are therefore $((d+1)!)^{i+1}/(d+1)!$.
1602 Also note that the $b_i$ are independent of the generating function
1603 and can be computed in advance.
1604 An alternative way of computing the $b_i$ is to note that
1606 \frac{t}{e^t-1} = \sum_{i=0}^\infty B_i \frac{t^i}{i!}
1609 with $B_i = i! \, b_i$ the \ai{Bernoulli number}s, which can be computed
1610 using the recurrence~\eqref{eq:Bernoulli} (see Section~\ref{s:nested}).
1612 Substituting $t$ by $c_j t$ in~\eqref{eq:t-exp-1}, we have
1614 \frac{-c_j t}{1-e^{c_j t}} = \sum_{i=0}^d b_i c_j^i t^i
1617 Multiplication of these truncated Taylor series for each $c_j$
1618 results in the first $d+1$ terms of~\eqref{eq:todd},
1620 \sum_{m=0}^{d} \todd_m(-c_1, \ldots, -c_d) t^m
1621 \eqqcolon
1622 \sum_{m=0}^{d} \frac{\beta_m}{((d+1)!)^m} t^m
1625 from which
1626 it is easy to compute the constant term~\eqref{eq:todd:constant}.
1627 Note that this convolution can also be computed without the use
1628 of rational coefficients,
1630 \frac{(-1)^d}{\prod_{j=1}^d c_j}
1631 \sum_{i=0}^d \frac{\alpha_i}{i!} \frac{\beta_{d-i}}{((d+1)!)^{d-i}}
1633 \frac{(-1)^d}{((d+1)!)^d\prod_{j=1}^d c_j}
1634 \sum_{i=0}^d \left(\frac{((d+1)!)^i}{i!}\alpha_i\right) \beta_{d-i}
1637 with $\alpha_i = \sum_{k=1}^{r} a_k^i$.
1639 \begin{example} \label{ex:todd}
1640 Consider the \rgf/
1642 \f T x =
1643 \frac{x_1^2}{(1-x_1^{-1})(1-x_1^{-1}x_2)}
1645 \frac{x_2^2}{(1-x_2^{-1})(1-x_1 x_2^{-1})}
1647 \frac1{(1-x_1)(1-x_2)}
1649 from \shortciteN[Example~39]{Verdoolaege2005PhD}.
1650 Since this is a 2-dimensional problem, we first compute the first
1651 3 Todd polynomials (evaluated at $-1$),
1653 \frac{e^t -1}t \equiv
1654 1 + \frac 1 2 t + \frac 1 6 t^2 =
1655 \frac 1 6
1656 \begin{bmatrix}
1657 6 & 3 & 1
1658 \end{bmatrix}
1662 \frac {-t}{1-e^t} =
1663 \frac t{e^t -1} \equiv
1664 \begin{bmatrix}
1665 \displaystyle\frac{1}{1} & \displaystyle\frac{-3}{6} & \displaystyle\frac{3}{36}
1666 \end{bmatrix}
1669 where we represent each truncated power series by a vector of its
1670 coefficients.
1671 The vector $\vec\lambda = (1, -1)$ is not
1672 orthogonal to any of the rays, so we can use the substitution
1673 $\vec x = e^{(1, -1)t}$
1674 and obtain
1676 \frac{e^{2t}}{(1-e^{-t})(1-e^{-2t})}
1678 \frac{e^{-2t}}{(1-e^{t})(1-e^{2t})}
1680 \frac1{(1-e^{t})(1-e^{-t})}
1683 We have
1684 \begin{align*}
1685 \frac{t}{1-e^{- t}} & =
1686 \begin{bmatrix}
1687 \displaystyle\frac{1}{1} & \displaystyle\frac{3}{6} & \displaystyle\frac{3}{36}
1688 \end{bmatrix}
1690 \frac{2t}{1-e^{-2 t}} & =
1691 \begin{bmatrix}
1692 \displaystyle\frac{1}{1} & \displaystyle\frac{6}{6} & \displaystyle\frac{12}{36}
1693 \end{bmatrix}
1695 \frac{-t}{1-e^{t}} & =
1696 \begin{bmatrix}
1697 \displaystyle\frac{1}{1} & \displaystyle\frac{-3}{6} & \displaystyle\frac{3}{36}
1698 \end{bmatrix}
1700 \frac{-2t}{1-e^{2t}} & =
1701 \begin{bmatrix}
1702 \displaystyle\frac{1}{1} & \displaystyle\frac{-6}{6} & \displaystyle\frac{12}{36}
1703 \end{bmatrix}
1705 \end{align*}
1706 The first term in the \rgf/ evaluates to
1707 \begin{align*}
1709 \frac 1{-1 \cdot -2}
1710 \begin{bmatrix}
1711 \displaystyle\frac{1}{1} & \displaystyle\frac{2}{1} & \displaystyle\frac{4}{2}
1712 \end{bmatrix}
1714 \left(
1715 \begin{bmatrix}
1716 \displaystyle\frac{1}{1} & \displaystyle\frac{3}{6} & \displaystyle\frac{3}{36}
1717 \end{bmatrix}
1718 \begin{bmatrix}
1719 \displaystyle\frac{1}{1} & \displaystyle\frac{6}{6} & \displaystyle\frac{12}{36}
1720 \end{bmatrix}
1721 \right)
1723 = {} &
1724 \frac 1{2}
1725 \begin{bmatrix}
1726 \displaystyle\frac{1}{1} & \displaystyle\frac{2}{1} & \displaystyle\frac{4}{2}
1727 \end{bmatrix}
1729 \begin{bmatrix}
1730 \displaystyle\frac{1}{1} & \displaystyle\frac{9}{6} & \displaystyle\frac{33}{36}
1731 \end{bmatrix}
1733 = {} &
1734 \frac 1{72}
1735 \begin{bmatrix}
1736 1 & 2 \cdot 6 & 4 \cdot 18
1737 \end{bmatrix}
1739 \begin{bmatrix}
1740 1 & 9 & 33
1741 \end{bmatrix}
1742 = \frac {213}{72} = \frac{71}{24}
1744 \end{align*}
1745 Due to symmetry, the second term evaluates to the same value,
1746 while for the third term we find
1748 \frac{1}{-1\cdot 1 \cdot 36}
1749 \begin{bmatrix}
1750 1 & 0 \cdot 6 & 0 \cdot 18
1751 \end{bmatrix}
1753 \begin{bmatrix}
1754 1 & 0 & -3
1755 \end{bmatrix}
1757 \frac{-3}{-36} = \frac 1{12}
1760 The sum is
1762 \frac{71}{24} + \frac{71}{24} + \frac 1{12} = 6
1765 \end{example}
1767 Note that the run-time complexities of polynomial and exponential
1768 substitution are basically the same. The experiments of
1769 \citeN{Koeppe2006primal} are somewhat misleading in this respect
1770 since the polynomial substitution (unlike the exponential
1771 substitution) had not been optimized to take full
1772 advantage of the stopped Barvinok decomposition.
1773 For comparison, \autoref{t:hickerson} shows running times
1774 for the same experiments of that paper, but using
1775 barvinok version \verb+barvinok-0.23-47-gaa9024e+
1776 on an Athlon MP 1500+ with 512MiB internal memory.
1777 This machine appears to be slightly slower than the
1778 machine used in the experiments of \citeN{Koeppe2006primal}
1779 as computing {\tt hickerson-14} using the dual decomposition
1780 with polynomial substitution and maximal index 1
1781 took 2768 seconds on this machine using \LattEmk/.
1782 At this stage, it is not clear yet why the number of
1783 cones in the dual decomposition of {\tt hickerson-13}
1784 differs from that of \LattE/~\shortcite{latte1.1} and
1785 \LattEmk/~\cite{latte-macchiato}.
1786 We conclude from \autoref{t:hickerson} that (our implementation of)
1787 the exponential substitution is always slightly faster than
1788 (our implementation of) the polynomial substitution.
1789 The optimal maximal index for these examples is about 500,
1790 which agrees with the experiments of \citeN{Koeppe2006primal}.
1792 \begin{table}
1793 \begin{center}
1794 \begin{tabular}{rrrrrrr}
1795 \hline
1797 \multicolumn{3}{c}{Dual decomposition} &
1798 \multicolumn{3}{c}{Primal decomposition}
1801 & \multicolumn{2}{c}{Time (s)} &
1802 & \multicolumn{2}{c}{Time (s)}
1804 \cline{3-4}
1805 \cline{6-7}
1806 Max.\ index & Cones & Poly & Exp & Cones & Poly & Exp \\
1807 \hline
1808 \multicolumn{7}{c}{{\tt hickerson-12}}
1810 \hline
1811 1 & 11625 & 9.24 & 8.90 & 7929 & 4.80 & 4.55
1813 10 & 4251 & 4.32 & 4.19 & 803 & 0.66 & 0.62
1815 100 & 980 & 1.42 & 1.35 & 84 & 0.13 & 0.12
1817 200 & 550 & 1.00 & 0.92 & 76 & 0.12 & 0.12
1819 300 & 474 & 0.93 & 0.86 & 58 & 0.12 & 0.10
1821 500 & 410 & 0.90 & 0.83 & 42 & 0.10 & 0.10
1823 1000 & 130 & 0.42 & 0.38 & 22 & {\bf 0.10} & {\bf 0.07}
1825 2000 & 10 & {\bf 0.10} & {\bf 0.10} & 22 & 0.10 & 0.09
1827 5000 & 7 & 0.12 & 0.11 & 7 & 0.12 & 0.10
1829 \hline
1830 \multicolumn{7}{c}{{\tt hickerson-13}}
1832 \hline
1833 1 & 494836 & 489 & 463 & 483507 & 339 & 315
1835 10 & 296151 & 325 & 309 & 55643 & 51 & 48
1837 100 & 158929 & 203 & 192 & 9158 & 11 & 10
1839 200 & 138296 & 184 & 173 & 6150 & 9 & 8
1841 300 & 110438 & 168 & 157 & 4674 & 8 & 7
1843 500 & 102403 & 163 & 151 & 3381 & {\bf 8} & {\bf 7}
1845 1000 & 83421 & {\bf 163} & {\bf 149} & 2490 & 8 & 7
1847 2000 & 77055 & 170 & 153 & 1857 & 10 & 8
1849 5000 & 57265 & 246 & 211 & 1488 & 13 & 11
1851 10000 & 50963 & 319 & 269 & 1011 & 26 & 21
1853 \hline
1854 \multicolumn{7}{c}{{\tt hickerson-14}}
1856 \hline
1857 1 & 1682743 & 2171 & 2064 & 552065 & 508 & 475
1859 10 & 1027619 & 1453 & 1385 & 49632 & 62 & 59
1861 100 & 455474 & 768 & 730 & 8470 & 14 & 13
1863 200 & 406491 & 699 & 661 & 5554 & 11 & 10
1865 300 & 328340 & 627 & 590 & 4332 & 11 & 9
1867 500 & 303566 & 605 & 565 & 3464 & {\bf 11} & {\bf 9}
1869 1000 & 232626 & {\bf 581} & {\bf 532} & 2384 & 12 & 10
1871 2000 & 195368 & 607 & 545 & 1792 & 14 & 12
1873 5000 & 147496 & 785 & 682 & 1276 & 19 & 16
1875 10000 & 128372 & 966 & 824 & 956 & 29 & 23
1877 \hline
1878 \end{tabular}
1879 \caption{Timing results of dual and primal decomposition with
1880 polynomial or exponential substitution on the Hickerson examples}
1881 \label{t:hickerson}
1882 \end{center}
1883 \end{table}
1885 \subsection{Approximate Enumeration using Nested Sums}
1886 \label{s:nested}
1888 If $P \in \QQ^d$ is a polyhedron and $p(\vec x) \in \QQ[\vec x]$ is a
1889 polynomial and we want to sum $p(\vec x)$ over all integer values
1890 of (a subset of) the variables $\vec x$, then we can do this incrementally
1891 by taking a variable $x_1$ with lower bound $L(\vec{\hat x})$
1892 and upper bound $U(\vec{\hat x})$, with $\vec{\hat x} = (x_2, \ldots, x_d)$,
1893 and computing
1894 \begin{equation}
1895 \label{eq:nested:sum}
1896 Q(\vec{\hat x}) = \sum_{x_1 = L(\vec{\hat x})}^{U(\vec{\hat x})} p(\vec x)
1898 \end{equation}
1899 Since $P$ is a polytope, the lower bound is a maximum of affine expressions
1900 in the remaining variables, while the upper bound is a minimum of such expressions.
1901 If the coefficients in these expressions are all integer, then we can
1902 compute $Q(\vec{\hat x})$ exactly as a piecewise polynomial using formulas
1903 for sums of powers, as proposed by, e.g.,
1904 \shortciteN{Tawbi1994,Sakellariou1997sums,VanEngelen2004}.
1905 If some of the coefficients are not integer, we can apply the same formulas
1906 to obtain an approximation, which can is some cases be shown
1907 to be an overapproximation~\shortcite{VanEngelen2004}.
1908 Note that if we take the initial polynomial to be the constant $1$, then
1909 this gives us a method for computing an approximation of the number
1910 of integer points in a (parametric) polytope.
1912 The first step is to compute the chamber decomposition of $P$ when viewed
1913 as a 1-dimensional parametric polytope. That is, we need to partition
1914 the projection of $P$ onto the remaining variables into polyhedral cells
1915 such that in each cell, both the upper and the lower bound are described
1916 by a single affine expression. Basically, for each pair of lower and upper
1917 bound, we compute the cell where the chosen lower bound is (strictly)
1918 smaller than all other lower bounds and similarly for the upper bound.
1920 For any given pair of lower and upper bound $(l(\vec {\hat x}), u(\vec{\hat x}))$,
1921 the formula~\eqref{eq:nested:sum} is computed for each monomial of $p(\vec x)$
1922 separately. For the constant term $\alpha_0$, we have
1923 \begin{equation}
1924 \label{eq:summation:1d}
1925 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_0(\vec{\hat x})
1926 = \alpha_0(\vec{\hat x}) \left(u(\vec{\hat x}) - l(\vec {\hat x}) + 1\right)
1928 \end{equation}
1929 For the higher degree monomials, we use the formula
1930 \begin{equation}
1931 \label{eq:summation}
1932 \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}
1933 =: S_n(m)
1935 \end{equation}
1936 with $B_i$ the \ai{Bernoulli number}s, which can be computed
1937 using the recurrence
1938 \begin{equation}
1939 \label{eq:Bernoulli}
1940 \sum_{j=0}^m{m+1\choose{j}}B_j = 0
1941 \qquad B_0 = 1
1943 \end{equation}
1944 Note that \eqref{eq:summation} is also valid if $m = 0$,
1945 i.e., $S_n(0) = 0$, a fact
1946 that can be easily shown using Newton series~\shortcite{VanEngelen2004}.
1948 \newcounter{saveenumi}
1950 Since we can only directly apply the summation formula when
1951 the lower bound is zero (or one), we need to consider several
1952 cases.
1953 \begin{enumerate}
1954 \item $l(\vec {\hat x}) \ge 1$
1955 \label{i:l}
1957 \begin{align*}
1958 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1960 \alpha_n(\vec{\hat x})
1961 \left(
1962 \sum_{x_1 = 1}^{u(\vec{\hat x})} x_1^n
1964 \sum_{x_1 = 1}^{l(\vec {\hat x})-1} x_1^n
1965 \right)
1968 \alpha_n(\vec{\hat x})
1969 \left( S_n(u(\vec{\hat x})+1) - S_n(l(\vec {\hat x})) \right)
1970 \end{align*}
1972 \item $u(\vec{\hat x}) \le -1$
1973 \label{i:u}
1975 \begin{align*}
1976 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1978 \alpha_n(\vec{\hat x}) (-1)^n
1979 \sum_{x_1 = -u(\vec {\hat x})}^{-l(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1982 \alpha_n(\vec{\hat x}) (-1)^n
1983 \left( S_n(-l(\vec{\hat x})+1) - S_n(-u(\vec {\hat x})) \right)
1984 \end{align*}
1986 \item $l(\vec {\hat x}) \le 0$ and $u(\vec{\hat x}) \ge 0$
1987 \label{i:l:u}
1989 \begin{align*}
1990 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
1992 \alpha_n(\vec{\hat x})
1993 \left(
1994 \sum_{x_1 = 0}^{u(\vec{\hat x})} x_1^n
1996 (-1)^n
1997 \sum_{x_1 = 1}^{-l(\vec {\hat x})} x_1^n
1998 \right)
2001 \alpha_n(\vec{\hat x})
2002 \left(
2003 S_n(u(\vec{\hat x})+1)
2005 (-1)^n
2006 S_n(-l(\vec{\hat x})+1)
2007 \right)
2008 \end{align*}
2010 \setcounter{saveenumi}{\value{enumi}}
2011 \end{enumerate}
2013 If the coefficients in the lower and upper bound are all
2014 integer, then the above 3 cases partition (the integer points in)
2015 the projection of $P$ onto the remaining variables.
2016 However, if some of the coefficients are rational, then the lower
2017 and upper bound can lie in the open interval $(0,1)$ for some
2018 values of $\vec{\hat x}$. We may therefore also want to consider
2019 the following two cases.
2021 \begin{enumerate}
2022 \setcounter{enumi}{\value{saveenumi}}
2023 \item $0 < l(\vec {\hat x}) < 1$
2024 \label{i:l:fractional}
2027 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
2029 \alpha_n(\vec{\hat x})
2030 S_n(u(\vec{\hat x})+1)
2033 \item $0 < -u(\vec {\hat x}) < 1$
2034 \label{i:u:fractional}
2037 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_n(\vec{\hat x}) \, x_1^n
2039 \alpha_n(\vec{\hat x})
2040 (-1)^n
2041 S_n(-l(\vec{\hat x})+1)
2044 \end{enumerate}
2045 Note that we may add the constraint $u \ge 1$ to
2046 case~\ref{i:l:fractional} and the constraint $l \le -1$
2047 to case~\ref{i:u:fractional}, since the correct value for
2048 these two cases would be zero if these extra constraints do not hold.
2050 An alternative to adding the above two cases would be
2051 to simply ignore them, i.e., assume a value of $0$.
2052 Another alternative would be to reduce case~\ref{i:l:u}
2055 l(\vec {\hat x}) \le -1\quad\hbox{and}\quad u(\vec{\hat x}) \ge 1
2058 while extending cases~\ref{i:l:fractional} and~\ref{i:u:fractional}
2061 -1 < l(\vec {\hat x}) < 1\quad\hbox{and}\quad u \ge 1
2065 -1 < u(\vec {\hat x}) < 1\quad\hbox{and}\quad l \le -1
2068 respectively, with the remaining cases
2069 ($-1 < l \le u < 1$) having value $0$.
2070 There does not appear to be a consistently better choice
2071 here, as each of these three approaches seems to yield better
2072 results on some examples.
2073 The last approach has the additional drawback that we
2074 would also have to deal with 5 cases, even if the bounds
2075 are integers.
2077 If at least one of the lower or upper bound is an
2078 integer affine expression, then we can reduce
2079 the 3 (or 5) cases to a single case (case~\ref{i:l:u})
2080 by an affine substitution that ensure that the
2081 new (lower or upper) bound is zero.
2082 In particular, if $l(\vec {\hat x})$ is an integer affine
2083 expression, then we replace $x$ by $x' + l(\vec {\hat x})$
2084 and similarly for an upper bound.
2086 \subsection{Exact Enumeration using Nested Sums}
2087 \label{s:nested:exact}
2089 The exact enumeration using nested sums proceeds in much
2090 the same way as the approximate enumeration from
2091 \autoref{s:nested}, with the notable exception
2092 that we need to take the (greatest or least) integer part
2093 of any fractional bounds that may occur.
2094 This has several consequences, discussed below.
2096 Since we will introduce floors during the recursive application
2097 of the procedure, we may as well allow the weight
2098 $p(\vec x)$ in~\eqref{eq:nested:sum} to be a (piecewise)
2099 quasipolynomial.
2101 For the constant term, \eqref{eq:summation:1d} becomes
2103 \sum_{x_1 = l(\vec {\hat x})}^{u(\vec{\hat x})} \alpha_0(\vec{\hat x})
2104 = \alpha_0(\vec{\hat x})
2105 \left(\floor{u(\vec{\hat x})} - \ceil{l(\vec {\hat x})} + 1\right)
2109 Since we force the lower and upper bounds to be integers,
2110 cases~\ref{i:l:fractional} and~\ref{i:u:fractional} do not occur,
2111 while the conditions for cases~\ref{i:l} and~\ref{i:u} can be simplified
2114 l(\vec {\hat x}) > 0
2118 u(\vec {\hat x}) < 0
2121 respectively.
2123 If the variable $x$ appears in any floor expression, either
2124 because such an expression was present in the original weight function
2125 or because it was introduced when another variable with an affine bound
2126 in $x$ was summed, then the domain has to
2127 be ``splintered'' into $D$ parts, where $D$ is the least common
2128 multiple of the denominators of the coefficients of $x$ in
2129 any of the integer parts.
2130 In particular, the domain is split into $x = D y + i$ for
2131 each $i$ in $[0, D-1]$. Since $D$ is proportional to
2132 the coefficients in the constraints, it is exponential in
2133 the input size. This splintering will therefore
2134 introduce exponential behavior, even if the dimension is fixed.
2136 Splintering is clearly the most expensive step in the algorithm,
2137 so we want to avoid this step as much as possible.
2138 \shortciteN{Pugh94counting} already noted that summation should
2139 proceed over variables with integer bounds first.
2140 This can be extended to choosing a variable with the smallest
2141 coefficient in absolute value. In this way, we can avoid
2142 splintering on the largest denominator.
2144 \shortciteN{Sakellariou1996phd} claims that splintering
2145 can be avoided altogether.
2146 In particular, \shortciteN[Lemma~3.2]{Sakellariou1996phd}
2147 shows that
2149 \sum_{x=0}^a x^m\left(x \bmod b\right)^n
2152 with $a$ and $b$ integers, is equal to
2153 \begin{equation}
2154 \label{eq:3.2}
2155 \begin{cases}
2156 \displaystyle
2157 \sum_{x=0}^a x^{m+n} & \text{if $a<b$}
2159 \displaystyle
2160 \sum_{i=0}^{\floor{a/b}-1} \sum_{x=0}^{b-1} (x+ib)^m x^n +
2161 \sum_{x=0}^{a \bmod b} (x+b\floor{a/b})^m x^n & \text{if $a\ge b$}
2163 \end{cases}
2164 \end{equation}
2165 effectively avoiding splintering if a given monomial contains
2166 a single integer part expression with argument of the form
2167 $x/b$. An argument of the form $(x-c(\vec{\hat x}))/b$ can
2168 be handled through a variable substitution.
2169 If the argument is of the form $c x/b$, with $c \ne 1$,
2170 then \shortciteN[(3.27)]{Sakellariou1996phd} proposes to
2171 rewrite the monomial as
2172 \begin{align*}
2173 \sum_{x=0}^a (c x \bmod b)^n
2175 \sum_{x=0}^a \sum_{y=cx}^{cx} (y \bmod b)^n
2178 \sum_{x=0}^a
2179 \left(\sum_{y=0}^{cx} (y \bmod b)^n - \sum_{y=0}^{cx-1} (y \bmod b)^n\right)
2180 \end{align*}
2181 and applying \eqref{eq:3.2}.
2182 However, such an application results in an expression containing
2184 \sum_{y=0}^{cx \bmod b} y^n
2187 which in turn leads to a polynomial of degree $n+1$ in $(c x \bmod b)$,
2188 i.e., of degree one higher than the original expression.
2189 Furthermore, if the bound on $x$ is rational then $a$ itself contains
2190 a floor, which, on application of \eqref{eq:3.2}, results in
2191 a nested floor expression, blocking the application of the same
2192 rule for the next variable.
2193 Finally, the case where a monomial contains multiple floor
2194 expressions, either occurring in the input quasi-polynomial
2195 or introduced by different variables having a rational
2196 bound with a non-zero coefficient in the same variable, is not handled.
2197 Also note that if we disallow nested floor expressions,
2198 then this rule will rarely be applicable since we try to eliminate
2199 variables with integer bounds first.
2201 \subsection{Summation using local Euler-Maclaurin formula}
2202 \label{s:euler}
2204 \sindex{local}{Euler-Maclaurin formula}
2205 In this section we provide some implementation details
2206 on using \ai{local Euler-Maclaurin formula} to compute
2207 the sum of a piecewise polynomial evaluated in all integer
2208 points of a two-dimensional parametric polytope.
2209 For the theory behind these formula and a discussion
2210 of the original implementation (for non-parametric simplices),
2211 we refer to \shortciteN{Berline2006local}.
2213 In particular, consider a parametric piecewise polynomial
2214 in $n$ parameters and $m$ variables
2215 $c : \ZZ^n \to \ZZ^m \to \QQ : \vec p \mapsto c(\vec p)$,
2216 with $c(\vec p) : \ZZ^m \to \QQ : \vec x \mapsto c(\vec p)(\vec x)$
2219 c_{\vec p}(\vec x) =
2220 \begin{cases}
2221 c_1(\vec p)(\vec x) & \text{if $\vec x \in D_1(\vec p)$}
2223 \vdots
2225 c_r(\vec p)(\vec x) & \text{if $\vec x \in D_r(\vec p)$}
2227 \end{cases}
2229 with the $c_i$ polynomials, $c_i \in (\QQ[\vec p])[\vec x]$, and
2230 the $D_i$ disjoint linearly parametric polytopes.
2231 We want to compute
2233 g(\vec p) = \sum_{\vec x \in \ZZ^m} c(\vec p)(\vec x)
2237 \subsubsection{Reduction to the summation of a parametric polynomial
2238 over a parametric polytope with a fixed combinatorial structure}
2240 Since the $D_i$ are disjoint, we can consider each
2241 $(c_i, D_i)$-pair individually and compute
2243 g(\vec p) = \sum_{i=1}^r g_i(\vec p) =
2244 \sum_{i=1}^r \sum_{\vec x \in D_r(\vec p) \cap \ZZ^m} c_r(\vec p)(\vec x)
2247 The second step is to compute the \ai{chamber decomposition}
2248 ~\shortcite[Section 4.2.3]{Verdoolaege2005PhD} of each parametric
2249 polytope $D_i$.
2250 The result is a subdivision of the parameter space into chambers
2251 $C_{ij}$ such that $D_i$ has a fixed combinatorial structure,
2252 in particular a fixed set of parametric vertices,
2253 on (the interior of) each $C_{ij}$. Applying \autoref{p:inclusion-exclusion},
2254 this subdivision can be transformed into a partition
2255 $\{\, \tilde C_{ij} \,\}$ by
2256 making some of the facets of the chambers open%
2257 ~\shortcite[Section~3.2]{Koeppe2008parametric}.
2258 Since we are only interested in integer parameter values,
2259 any of the resulting open facets $\sp a p + c > 0$,
2260 with $\vec a \in \ZZ^n$ and $c \in \ZZ$,
2261 can then be replaced by $\sp a p + c-1 \ge 0$.
2262 Again, we have
2264 g_i(\vec p) = \sum_j g_{ij}(\vec p) =
2265 \sum_j \sum_{\vec x \in C_{ij}(\vec p) \cap \ZZ^m} c_r(\vec p)(\vec x)
2269 After this reduction, the technique of
2270 \shortciteN{Berline2006local} can be applied practically verbatim
2271 to the parametric polytope with a fixed combinatorial structure.
2272 In principle, we could also handle piecewise quasi-polynomials
2273 using the technique of \shortciteN[Section~4.5.4]{Verdoolaege2005PhD},
2274 except that we only need to create an extra variable for each
2275 distinct floor expression in a monomial, rather than for each
2276 occurrence of a floor expression in a monomial.
2277 However, since we currently only support two-dimensional polytopes,
2278 this reduction has not been implemented yet.
2280 \subsubsection{Summation over a one-dimensional parametric polytope}
2282 The basis for the summation technique is the local
2283 Euler-Maclaurin formula~\cite[Theorem~26]{Berline2006local}
2284 \begin{equation}
2285 \label{eq:EML}
2286 \sum_{\vec x \in P(\vec p) \cap \Lambda} h(\vec p)(\vec x)
2287 = \sum_{F(\vec p) \in {\mathcal F}(P(\vec p))}
2288 \int_{F(\vec p)} D_{P(\vec p),F(\vec p)} \cdot h(\vec p)
2290 \end{equation}
2291 where $P(\vec p)$ is a parametric polytope,
2292 $\Lambda$ is a lattice, ${\mathcal F}(P(\vec p))$
2293 are the faces of $P(\vec p)$, $D_{P(\vec p),F(\vec p)}$ is a
2294 specific differential operator associated to the face of a polytope.
2295 The \ai{Lebesgue measure} used in the integral is such that the
2296 integral of the indicator function of a lattice element of
2297 the lattice $\Lambda \cap (\affhull(F(\vec p)) - F(\vec p))$ is 1,
2298 i.e., the intersection of $\Lambda$ with the linear subspace
2299 parallel to the affine hull of the face $F(\vec p)$.
2300 Note that the original theorem is formulated for a non-parametric
2301 polytope and a non-parametric polynomial. However, as we will see,
2302 in each of the steps in the computation, the parameters can be
2303 treated as symbolic constants without affecting the validity of the formula,
2304 see also~\shortciteN[Section 6]{Berline2006local}.
2306 The differential operator $D_{P(\vec p),F(\vec p)}$ is obtained
2307 by plugging in the vector $\vec D=(D_1,\ldots,D_m)$ of first
2308 order differential operators, i.e., $D_k$ is the first order
2309 differential operator in the $k$th variable,
2310 in the function $\mu_{P(\vec p),F(\vec p)}$.
2311 This function is determined by the \defindex{transverse cone}
2312 of the polyhedron $P(\vec p)$ along its face $F(\vec p)$,
2313 which is the \ai{supporting cone} of $P(\vec p)$ along $F(\vec p)$
2314 projected into the linear subspace orthogonal to $F(\vec p)$.
2315 The lattice associated to this space is the projection of
2316 $\Lambda$ into this space.
2318 In particular, for a zero-dimensional affine cone in the zero-dimensional
2319 space, we have $\mu = 1$~\cite[Proposition 12]{Berline2006local},
2320 while for a one-dimensional affine
2321 cone $K = (-t + \RR_+) r$ in the one-dimensional space, where
2322 $r$ is a primitive integer vector and $t \in [0,1)$,
2323 we have~\cite[(13)]{Berline2006local}
2324 \begin{equation}
2325 \label{eq:mu:1}
2326 \mu(K)(\xi) = \frac{e^{t y}}{1-e^y} + \frac 1{y}
2327 = -\sum_{n=0}^\infty \frac{b(n+1, t)}{(n+1)!} y^n
2329 \end{equation}
2330 with $y = \sps \xi r$ and $b(n,t)$ the \ai{Bernoulli polynomial}s
2331 defined by the generating series
2332 \begin{equation}
2333 \label{eq:bernoulli}
2334 \Todd(t,y) =
2335 \frac{e^{ty} y}{e^y - 1} = \sum_{n=0}^\infty \frac{b(n,t)}{n!} y^n
2337 \end{equation}
2338 The constant terms of these Bernoulli polynomials
2339 are the \ai{Bernoulli number}s.
2341 Applying \eqref{eq:EML} to a one-dimensional parametric polytope
2342 $P(\vec p) = [v_1(\vec p), v_2(\vec p)]$, we find
2344 \begin{aligned}
2345 \sum_{x \in P(\vec p) \cap \ZZ} h(\vec p)(x)
2346 = & \int_{P(\vec p)} D_{P(\vec p), P(\vec p)} \cdot h(\vec p)
2348 & + \int_{v_1(\vec p)} D_{P(\vec p), v_1(\vec p)} \cdot h(\vec p)
2350 & + \int_{v_2(\vec p)} D_{P(\vec p), v_2(\vec p)} \cdot h(\vec p)
2352 \end{aligned}
2354 The transverse cone of a polytope along the whole polytope is
2355 a zero-dimensional cone in a zero-dimensional space and so
2356 $D_{P(\vec p), P(\vec p)} = \mu_{P(\vec p), P(\vec p)}(D) = 1$.
2357 The transverse cone along $v_1(\vec p)$ is $v_1(\vec p) + \RR_+$
2358 and so $D_{P(\vec p), v_1(\vec p)} = \mu(v_1(\vec p) + \RR_+)(D)$
2359 as in \eqref{eq:mu:1}, with $y = \sps D 1 = D$ and
2360 $t = \ceil{v_1(\vec p)} - v_1(\vec p) =
2361 \fractional{-v_1(\vec p)}$.
2362 Similarly we find
2363 $D_{P(\vec p), v_2(\vec p)} = \mu(v_2(\vec p) - \RR_+)(D)$
2364 as in \eqref{eq:mu:1}, with $y = \sps D {-1} = -D$ and
2365 $t = v_2(\vec p) - \floor{v_2(\vec p)} =
2366 \fractional{v_2(\vec p)}$.
2367 Summarizing, we find
2369 \begin{aligned}
2370 \sum_{x \in P(\vec p) \cap \ZZ} h(\vec p)(x)
2371 = & \int_{v_1(\vec p)}^{v_2(\vec p)} h(\vec p)(t) \, dt
2373 & -\sum_{n=0}^\infty \frac{b(n+1, \fractional{-v_1(\vec p)})}{(n+1)!}
2374 (D^n h(\vec p))(v_1(\vec p))
2376 & -\sum_{n=0}^\infty (-1)^n \frac{b(n+1, \fractional{v_2(\vec p)})}{(n+1)!}
2377 (D^n h(\vec p))(v_2(\vec p))
2379 \end{aligned}
2382 Note that in order to apply this formula, we need to verify
2383 first that $v_1(\vec p)$ is indeed smaller than (or equal to)
2384 $v_2(\vec p)$. Since the combinatorial structure of $P(\vec p)$
2385 does not change throughout the interior of the chamber, we only
2386 need to check the order of the two vertices for one value
2387 of the parameters from the interior of the chamber, a point
2388 which we may compute as in \autoref{s:interior}.
2390 \subsubsection{Summation over a two-dimensional parametric polytope}
2392 For two-dimensional polytope, formula~\eqref{eq:EML} has three kinds
2393 of contributions: the integral of the polynomial over the polytope,
2394 contributions along edges and contributions along vertices.
2395 As suggested by~\citeN{Berline2007personal}, the integral can be computed
2396 by applying the Green-Stokes theorem:
2398 \iint_{P(\vec p)}
2399 \left(\frac{\partial M}{\partial x} - \frac{\partial L}{\partial y}\right) =
2400 \int_{\partial P(\vec p)} (L\, dx + M\, dy)
2403 In particular, if $M(\vec p)(x,y)$ is such that
2404 $\frac{\partial M}{\partial x}(\vec p)(x,y) = h(\vec p)(x,y)$
2405 then
2407 \iint_{P(\vec p)} h(\vec p)(x,y) =
2408 \int_{\partial P(\vec p)} M(\vec p)(x,y) \, dy
2411 Care must be taken to integrate over the boundary in the positive
2412 direction. Assuming the vertices of the polygon are not given
2413 in a predetermined order, we can check the correct orientation
2414 of the vertices of each edge individually. Let $\vec n = (n_1, n_2)$
2415 be the inner normal of a facet and let $\vec v_1(\vec p)$
2416 and $\vec v_2(\vec p)$ be the two vertices of the facet, then
2417 the vertices are in the correct order if
2419 \begin{vmatrix}
2420 v_{2,1}(\vec p)-v_{1,1}(\vec p) & n_1
2422 v_{2,2}(\vec p)-v_{1,2}(\vec p) & n_2
2423 \end{vmatrix}
2424 \ge 0
2427 Since these two vertices belong to the same edge, their order
2428 will not change within a chamber and so we can again perform
2429 this check for a single value of the parameters.
2430 To integrate $M$ over an edge $F$, let $\vec f$ be a primitive
2431 integer vector in the direction of the edge.
2432 Then $\vec v_2(\vec p) = \vec v_1(\vec p) + k(\vec p) \, \vec f$
2433 and any point on the edge can be written as
2434 $\vec v_1(\vec p) + \lambda \vec f$ with
2435 $0 \le \lambda \le k(\vec p)$.
2436 That is,
2437 \begin{equation}
2438 \label{eq:EML:int}
2439 \int_F M(\vec p)(x,y) \, dy
2441 \int_0^{k(\vec p)}
2442 M(\vec p)(v_{1,1}(\vec p) + \lambda f_1,
2443 v_{1,2}(\vec p) + \lambda f_2)
2444 f_2 \, d\lambda
2446 \end{equation}
2448 For the edges, we can again apply \eqref{eq:mu:1}, but we
2449 must first project the supporting cone at the edge into
2450 the linear subspace orthogonal to the edge.
2451 Let $\vec n = (n_1, n_2)$ be the (primitive integer) inner normal
2452 of this facet $F(\vec p)$, then $\vec f = (-n_2, n_1)$ is parallel
2453 to the facet and we can write one of the vertices $\vec v(\vec p)$
2454 as a linear combination of these two vectors:
2455 \begin{equation}
2456 \label{eq:EML:facet:coordinates}
2457 \vec v(\vec p)
2459 \begin{bmatrix}
2460 \vec f & \vec n
2461 \end{bmatrix}
2462 \vec a(\vec p)
2464 \begin{bmatrix}
2465 -n_2 & n_1 \\
2466 n_1 & n_2
2467 \end{bmatrix}
2468 \vec a(\vec p)
2469 \end{equation}
2471 \begin{equation}
2472 \label{eq:EML:facet:coordinates:2}
2473 \vec a(\vec p)
2475 \begin{bmatrix}
2476 -n_2 & n_1 \\
2477 n_1 & n_2
2478 \end{bmatrix}^{-1}
2479 \vec v(\vec p)
2481 \begin{bmatrix}
2482 -n_2/d & n_1/d \\
2483 n_1/d & n_2/d
2484 \end{bmatrix}
2485 \vec v(\vec p),
2486 \end{equation}
2487 with $d = n_1^2+n_2^2$.
2488 The lattice associated to the linear subspace orthogonal
2489 to the facet is the projection of $\Lambda$ into this space.
2490 Since $\vec n$ is primitive, a basis for this lattice can be
2491 identified with $\vec n/d$.
2492 The coordinate of the whole facet in this space is therefore
2494 d a_2(\vec p) =
2495 \begin{bmatrix}
2496 n_1 & n_2
2497 \end{bmatrix}
2498 \vec v(\vec p)
2499 $, while the transverse cone is $d a_2(\vec p) + \RR_+$.
2500 Similarly, a linear functional $\vec \xi'$ projects onto
2501 a linear functional $\xi = \sp {\xi'} n/d$ in the linear subspace.
2502 Applying \eqref{eq:mu:1}, with $y = \frac{n_1}d D_1 + \frac{n_2}d D_2$
2503 and $t = \fractional{- n_1 v_1(\vec p) - n_2 v_2(\vec p)}$, we therefore
2504 find
2505 \begin{align*}
2506 D_{P(\vec p), F(\vec p)}
2508 -\sum_{n=0}^\infty
2509 \frac{b(n+1, \fractional{-n_1 v_1(\vec p) - n_2 v_2(\vec p)})}{(n+1)!}
2510 \left(\frac{n_1}d D_1 + \frac{n_2}d D_2\right)^n
2513 - \sum_{i=0}^\infty \sum_{j=0}^\infty
2514 \frac{b(i+j+1, \fractional{-n_1 v_1(\vec p) - n_2 v_2(\vec p)})}{(i+j+1)!}
2515 \frac{n_1^i n_2^j}{d^{i+j}} D_1^i D_2^j
2517 \end{align*}
2518 After applying this differential operator to the polynomial
2519 $h(\vec p)(\vec x)$, the resulting polynomial
2521 h'(\vec p)(\vec x) = D_{P(\vec p), F(\vec p)} \cdot h(\vec p)(\vec x)
2523 needs to be integrated over the facet.
2524 The measure to be used is such that the integral of a lattice tile
2525 in the linear space parallel to the facet is 1, i.e.,
2527 \int_{\vec 0}^{\vec f} 1 = \int_0^1 1 dz = 1,
2529 with $z$ the coordinate along $\vec f$.
2530 Referring to \eqref{eq:EML:facet:coordinates} and
2531 \eqref{eq:EML:facet:coordinates:2}, all points of the facet
2532 have the form $\vec x(\vec p) = z \, \vec f + a_2(\vec p) \, \vec n$,
2533 while the $z$-coordinate of the vertices $\vec v_1(\vec p)$
2534 and $\vec v_2(\vec p)$ are
2535 $(-n_2 v_{1,1} + n_1 v_{1,2})/d$
2537 $(-n_2 v_{2,1} + n_1 v_{2,2})/d$, respectively.
2538 That is, the contribution of the facet is equal to
2540 \int_{(-n_2 v_{1,1} + n_1 v_{1,2})/d}^{(-n_2 v_{2,1} + n_1 v_{2,2})/d}
2541 h'(\vec p)\left(z \, \vec f + a_2(\vec p) \, \vec n\right) \, dz
2544 where, again, we need to ensure that the lower limit is smaller
2545 than the upper limit using the usual method of plugging in a
2546 particular value of the parameters.
2548 Finally, we consider the contributions of the vertices.
2549 The \ai{transverse cone}s are in this case simply the supporting cones.
2550 Since $\mu$ is a valuation, we may apply \ai{Barvinok's decomposition}
2551 and assume that the cone is unimodular.
2552 For an affine cone
2553 \begin{align*}
2554 K &= \vec v(\vec p) + \RR_+ \vec r_1 + \RR_+ \vec r_2
2556 &= (a_1(\vec p) + \RR_+) \vec r_1 + (a_2(\vec p) + \RR_+) \vec r_2,
2557 \end{align*}
2558 with
2560 \vec a(\vec p) =
2561 \begin{bmatrix}
2562 \vec r_1 & \vec r_2
2563 \end{bmatrix}^{-1}
2564 \vec v(\vec p)
2567 we have~\cite[Proposition~31]{Berline2006local},
2568 \begin{equation}
2569 \label{eq:mu:2}
2570 \mu(K)(\vec\xi)
2572 \frac{e^{t_1 y_1 + t_2 y_2}}{(1-e^{y_1})(1-e^{y_2})}
2573 + \frac 1{y_1}B(y_2 - C_1 y_1, t_2)
2574 + \frac 1{y_2}B(y_1 - C_2 y_2, t_1)
2575 - \frac 1{y_1 y_2},
2576 \end{equation}
2577 with
2579 B(y,t) =
2580 \frac{e^{t y}}{1-e^y} + \frac 1{y}
2581 = -\sum_{n=0}^\infty \frac{b(n+1, t)}{(n+1)!} y^n
2584 $y_i = \sps{\vec\xi}{\vec r_i}$,
2585 $C_i = \sps{\vec v_1}{\vec v_2}/\sps{\vec v_i}{\vec v_i}$
2587 $t_i = \fractional{-a_i(\vec p)}$.
2588 Expanding \eqref{eq:mu:2}, we find
2589 \begin{align*}
2590 \mu(K)(\vec\xi)
2592 \left(
2593 -\frac{b(0,t1)}{y_1} - \sum_{n=0}^\infty \frac{b(n+1,t_1)}{(n+1)!} y_1^n
2594 \right)
2595 \left(
2596 -\frac{b(0,t2)}{y_2} - \sum_{n=0}^\infty \frac{b(n+1,t_2)}{(n+1)!} y_2^n
2597 \right)
2599 & \phantom{=}
2601 \left(
2602 \sum_{n=0}^\infty \frac{b(n+1,t_2)}{(n+1)!} \frac{y_2^n}{y_1}
2604 \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}
2605 \right)
2607 & \phantom{=}
2609 \left(
2610 \sum_{n=0}^\infty \frac{b(n+1,t_1)}{(n+1)!} \frac{y_1^n}{y_2}
2612 \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}
2613 \right)
2615 & \phantom{=}
2616 - \frac 1{y_1 y_2}
2619 \sum_{n_1=0}^\infty
2620 \sum_{n_2=0}^\infty
2621 c(C_1, C_2, t_1, t_2; n_1, n_2) \, y_1^n y_2^n
2623 \end{align*}
2624 with
2625 \begin{align*}
2626 c(C_1, C_2, t_1, t_2; n_1, n_2)
2628 \frac{b(n_1+1,t_1)}{(n_1+1)!} \frac{b(n_2+1,t_2)}{(n_2+1)!}
2632 \frac{b(n_1+n_2+1,t_2)}{(n_1+n_2+1)!} {n_1+n_2+1 \choose n_1+1}
2633 \left(-C_1\right)^{n_1+1}
2637 \frac{b(n_1+n_2+1,t_1)}{(n_1+n_2+1)!} {n_1+n_2+1 \choose n_2+1}
2638 \left(-C_2\right)^{n_2+1}
2640 \end{align*}
2641 For $\vec \xi = \vec D$, we have
2642 \begin{align*}
2643 y_1^n y_2^n
2645 \left( r_{1,1} D_1 + r_{1,2} D_2 \right)^{n_1}
2646 \left( r_{2,1} D_1 + r_{2,2} D_2 \right)^{n_2}
2649 \left(
2650 \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}
2651 \right)
2652 \left(
2653 \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}
2654 \right)
2655 \end{align*}
2656 and so
2658 D_{P(\vec p), \vec v(\vec p)} = \mu(K)(\vec D)
2662 \sum_{i=0}^\infty
2663 \sum_{j=0}^\infty
2664 \sum_{\shortstack{$\scriptstyle i+j = n_1+n_2$\\$\scriptstyle n_1 \ge 0$\\$\scriptstyle n_2 \ge 0$}}
2665 \sum_{\shortstack{$\scriptstyle k+l = i$\\$\scriptstyle 0 \le k \le n_1$\\$\scriptstyle 0 \le l \le n_2$}}
2666 c(C_1, C_2, t_1, t_2; n_1, n_2)
2667 r_{1,1}^k r_{1,2}^{n_1 - k}
2668 r_{2,1}^l r_{2,2}^{n_2 - l}
2669 { n_1 \choose k} { n_2 \choose l} D_1^i D_2^j
2672 The contribution of this vertex is then
2674 h'(\vec p)(\vec v(\vec p))
2677 with $
2678 h'(\vec p)(\vec x) = D_{P(\vec p), \vec v(\vec p)} \cdot h(\vec p)(\vec x)
2681 \begin{example}
2682 As a simple example, consider the (non-parametric) triangle
2683 in \autoref{f:EML:triangle} and assume we want to compute
2685 \sum_{\vec x \in T \cap \ZZ^2} x_1 x_2
2688 Since $T \cap \ZZ^2 = \{\, (2,4), (3,4), (2,5) \, \}$,
2689 the result should be
2691 2 \cdot 4 + 3 \cdot 4 + 2 \cdot 5 = 30
2695 \begin{figure}
2696 \intercol=1.2cm
2697 \begin{xy}
2698 <\intercol,0pt>:<0pt,\intercol>::
2699 \POS@i@={(2,4),(3,4),(2,5),(2,4)},{0*[|(2)]\xypolyline{}}
2700 \POS(2.35,4.25)*{x_1 x_2}
2701 \POS(2,4)*+!U{(2,4)}
2702 \POS(3,4)*+!U{(3,4)}
2703 \POS(2,5)*+!D{(2,5)}
2704 \POS(2,4)*{\cdot}
2705 \POS(3,4)*{\cdot}
2706 \POS(2,5)*{\cdot}
2707 \POS(-1,0)\ar(4,0)
2708 \POS(0,-1)\ar(0,5.5)
2709 \end{xy}
2710 \caption{Sum of polynomial $x_1 x_2$ over the integer points in a triangle $T$}
2711 \label{f:EML:triangle}
2712 \end{figure}
2714 Let us first consider the integral
2716 \iint_T x_1 x_2 = \int_{\partial T} \frac{x_1^2 x_2}2 \, d x_2
2719 Integration along each of the edges of the triangle yields
2720 the following.
2722 \marginpar{%
2723 \intercol=1cm
2724 \begin{xy}
2725 <\intercol,0pt>:<0pt,\intercol>::
2726 \POS(0,-1)*\xybox{
2727 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2728 \POS(0,0)\ar@[|(2)](1,0)
2730 \end{xy}
2732 For the edge in the margin, we have $\vec f = (1,0)$, i.e., $f_2 = 0$.
2733 The contribution of this edge to the integral is therefore zero.
2735 \marginpar{%
2736 \intercol=1cm
2737 \begin{xy}
2738 <\intercol,0pt>:<0pt,\intercol>::
2739 \POS(0,-1)*\xybox{
2740 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2741 \POS(1,0)\ar@[|(2)](0,1)
2743 \end{xy}
2745 For this edge, we have $\vec f = (-1,1)$.
2746 The contribution of this edge to the integral is therefore
2748 \int_0^1 \frac{(3-\lambda)^2(4+\lambda)}2 d\lambda
2749 = \frac{337}{24}
2753 \marginpar{%
2754 \intercol=1cm
2755 \begin{xy}
2756 <\intercol,0pt>:<0pt,\intercol>::
2757 \POS(0,-1)*\xybox{
2758 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2759 \POS(0,1)\ar@[|(2)](0,0)
2761 \end{xy}
2763 For this edge, we have $\vec f = (0,-1)$.
2764 The contribution of this edge to the integral is therefore
2766 \int_0^1 \frac{2^2(5-\lambda)}2 (-1) d\lambda
2767 = -9
2771 The total integral is therefore
2773 \int_{\partial T} \frac{x_1^2 x_2}2 \, d x_2
2774 = 0 + \frac{337}{24} - 9 = \frac{121}{24}
2778 Now let us consider the contributions of the edges.
2779 We will need the following \ai{Bernoulli number}s in our
2780 computations.
2781 \begin{align*}
2782 b(1,0) & = - \frac 1 2
2784 b(2,0) & = \frac 1 6
2786 b(3,0) & = 0
2788 b(4,0) & = -\frac 1 {30}
2789 \end{align*}
2791 \marginpar{%
2792 \intercol=1cm
2793 \begin{xy}
2794 <\intercol,0pt>:<0pt,\intercol>::
2795 \POS(0,-1)*\xybox{
2796 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2797 \POS(0,0)\ar@[|(2)]@{-}(1,0)
2798 \POS(0.5,0)\ar(0.5,1)
2800 \end{xy}
2802 The normal to the facet $F_1$ in the margin is $\vec n = (0,1)$.
2803 The vector $\vec f = (-1,0)$ is parallel to the facet.
2804 We have
2806 \begin{bmatrix}
2807 2 \\ 4
2808 \end{bmatrix}
2811 \begin{bmatrix}
2812 -1 \\ 0
2813 \end{bmatrix}
2815 \begin{bmatrix}
2816 0 \\ 1
2817 \end{bmatrix}
2818 \quad\text{and}\quad
2819 \begin{bmatrix}
2820 3 \\ 4
2821 \end{bmatrix}
2824 \begin{bmatrix}
2825 -1 \\ 0
2826 \end{bmatrix}
2828 \begin{bmatrix}
2829 0 \\ 1
2830 \end{bmatrix}
2833 Therefore $t = \fractional{-4} = 0$, $y = D_2$,
2834 \begin{align*}
2835 D_{T,F_1}
2836 & =
2837 - \sum_{j=0}^\infty \frac{b(j+1, 0)}{(j+1)!} D_2^j
2840 - \frac{b(1,0)}1 - \frac{b(2,0)}2 D_2 + \cdots
2841 \end{align*}
2844 h'(\vec x) =
2845 D_{T,F_1} \cdot x_1 x_2 =
2846 \left(\frac 1 2 - \frac 1{12} D_2\right) \cdot x_1 x_2
2848 \frac 1 2 x_1 x_2 - \frac 1{12} x_1
2851 With $x_1 = - z$ and $x_2 = 4$, the contribution of this facet
2854 \int_{-3}^{-2} - 2 z + \frac 1{12} z \, dz
2856 \frac{115}{24}
2860 \marginpar{%
2861 \intercol=1cm
2862 \begin{xy}
2863 <\intercol,0pt>:<0pt,\intercol>::
2864 \POS(0,-1)*\xybox{
2865 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2866 \POS(0,0)\ar@[|(2)]@{-}(0,1)
2867 \POS(0,0.5)\ar(1,0.5)
2869 \end{xy}
2871 The normal to the facet $F_2$ in the margin is $\vec n = (1,0)$.
2872 The vector $\vec f = (0,1)$ is parallel to the facet.
2873 We have
2875 \begin{bmatrix}
2876 2 \\ 4
2877 \end{bmatrix}
2880 \begin{bmatrix}
2881 0 \\ 1
2882 \end{bmatrix}
2884 \begin{bmatrix}
2885 1 \\ 0
2886 \end{bmatrix}
2887 \quad\text{and}\quad
2888 \begin{bmatrix}
2889 2 \\ 5
2890 \end{bmatrix}
2893 \begin{bmatrix}
2894 0 \\ 1
2895 \end{bmatrix}
2897 \begin{bmatrix}
2898 1 \\ 0
2899 \end{bmatrix}
2902 Therefore $t = \fractional{-2} = 0$, $y = D_1$,
2903 \begin{align*}
2904 D_{T,F_2}
2905 & =
2906 - \sum_{i=0}^\infty \frac{b(i+1, 0)}{(i+1)!} D_1^i
2909 - \frac{b(1,0)}1 - \frac{b(2,0)}2 D_1 + \cdots
2910 \end{align*}
2913 h'(\vec x) =
2914 D_{T,F_2} \cdot x_1 x_2 =
2915 \left(\frac 1 2 - \frac 1{12} D_1\right) \cdot x_1 x_2
2917 \frac 1 2 x_1 x_2 - \frac 1{12} x_2
2920 With $x_1 = 2$ and $x_2 = z$, the contribution of this facet
2923 \int_{4}^{5} z - \frac 1{12} z \, dz
2925 \frac{33}{8}
2929 \marginpar{%
2930 \intercol=1cm
2931 \begin{xy}
2932 <\intercol,0pt>:<0pt,\intercol>::
2933 \POS(0,-1)*\xybox{
2934 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
2935 \POS(1,0)\ar@[|(2)]@{-}(0,1)
2936 \POS(0.5,0.5)\ar(-0.5,-0.5)
2938 \end{xy}
2940 The normal to the facet $F_3$ in the margin is $\vec n = (-1,-1)$.
2941 The vector $\vec f = (1,-1)$ is parallel to the facet.
2942 We have
2944 \begin{bmatrix}
2945 3 \\ 4
2946 \end{bmatrix}
2948 -\frac 1 2
2949 \begin{bmatrix}
2950 1 \\ -1
2951 \end{bmatrix}
2952 -\frac 7 2
2953 \begin{bmatrix}
2954 -1 \\ -1
2955 \end{bmatrix}
2956 \quad\text{and}\quad
2957 \begin{bmatrix}
2958 2 \\ 5
2959 \end{bmatrix}
2961 -\frac 3 2
2962 \begin{bmatrix}
2963 1 \\ -1
2964 \end{bmatrix}
2965 -\frac 7 2
2966 \begin{bmatrix}
2967 -1 \\ -1
2968 \end{bmatrix}
2971 Therefore $t = \fractional{7} = 0$, $y = -\frac 1 2 D_1 -\frac 1 2 D_2$,
2972 \begin{align*}
2973 D_{T,F_3}
2974 & =
2975 - \sum_{i=0}^\infty \sum_{j=0}^\infty
2976 \frac{b(i+j+1, 0)}{(i+j+1)!}
2977 \frac{(-1)^{i+j}}{2^{i+j}} D_1^i D_2^j
2980 - \frac{b(1,0)}1
2981 + \frac 1 2 \frac{b(2,0)}2 D_1
2982 + \frac 1 2 \frac{b(2,0)}2 D_2 + \cdots
2983 \end{align*}
2986 h'(\vec x) =
2987 D_{T,F_4} \cdot x_1 x_2 =
2988 \left(\frac 1 2 + \frac 1{24} D_1 + \frac 1{24} D_2\right) \cdot x_1 x_2
2990 \frac 1 2 x_1 x_2 + \frac 1{24} x_2 + \frac 1{24} x_1
2993 With $x_1 = z + \frac 7 2$ and $x_2 = -z + \frac 7 2$,
2994 the contribution of this facet
2997 \int_{-\frac 3 2}^{-\frac 1 2}
2998 \frac 1 2 (z + \frac 7 2)(-z + \frac 7 2)
2999 + \frac 1{24}(-z + \frac 7 2)
3000 + \frac 1{24}(z + \frac 7 2) \, dz
3002 \frac{47}{8}
3006 The total contribution of the edges is therefore
3008 \frac{115}{24}+\frac{33}8+
3009 \frac{47}{8} = \frac{355}{24}
3013 Finally, we consider the contributions of the vertices.
3015 \marginpar{%
3016 \intercol=1cm
3017 \begin{xy}
3018 <\intercol,0pt>:<0pt,\intercol>::
3019 \POS(0,-1)*\xybox{
3020 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
3021 \POS(1,0)\ar@[|(2)](0,1)
3022 \POS(1,0)\ar@[|(2)](0,0)
3024 \end{xy}
3026 For the vertex $\vec v = (3,4)$, we have
3027 $\vec r_1 = (-1,0)$ and $\vec r_2 = (-1,1)$.
3028 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
3029 Also, $C_1 = 1$, $C_2 = 1/2$, $y_1 = -D_1$ and $y_2 = -D_1 + D_2$.
3030 Since the total degree of the polynomial $x_1 x_2$ is two,
3031 we only need the coefficients of $\mu(K)(\vec \xi)$ up to
3032 $n_1+n_2 = 2$.
3034 \noindent
3035 \begin{tabular}{c|c|c}
3036 $n_1$ & $n_2$
3038 \hline
3039 0 & 0 &
3041 \left(
3042 \frac{b(1,0)}{1!}
3043 \frac{b(1,0)}{1!}
3045 \frac{b(2,0)}{2!}
3046 {1 \choose 1}(-1)^1
3048 \frac{b(2,0)}{2!}
3049 {1 \choose 1}(-\frac 12)^1
3050 \right)
3053 1 & 0 &
3055 \left(
3056 \frac{b(2,0)}{2!}
3057 \frac{b(1,0)}{1!}
3059 \frac{b(3,0)}{3!}
3060 {2 \choose 2}(-1)^2
3062 \frac{b(3,0)}{3!}
3063 {2 \choose 1}(-\frac 12)^1
3064 \right)
3065 \left(
3066 -D_1
3067 \right)
3070 0 & 1 &
3072 \left(
3073 \frac{b(1,0)}{1!}
3074 \frac{b(2,0)}{2!}
3076 \frac{b(3,0)}{3!}
3077 {2 \choose 1}(-1)^1
3079 \frac{b(3,0)}{3!}
3080 {2 \choose 2}(-\frac 12)^2
3081 \right)
3082 \left(
3083 -D_1 + D_2
3084 \right)
3087 2 & 0 &
3089 \left(
3090 \frac{b(3,0)}{3!}
3091 \frac{b(1,0)}{1!}
3093 \frac{b(4,0)}{4!}
3094 {3 \choose 3}(-1)^3
3096 \frac{b(4,0)}{4!}
3097 {3 \choose 1}(-\frac 12)^1
3098 \right)
3099 \left(
3100 -D_1
3101 \right)^2
3104 1 & 1 &
3106 \left(
3107 \frac{b(2,0)}{2!}
3108 \frac{b(2,0)}{2!}
3110 \frac{b(4,0)}{4!}
3111 {3 \choose 2}(-1)^2
3113 \frac{b(4,0)}{4!}
3114 {3 \choose 2}(-\frac 12)^2
3115 \right)
3116 \left(
3117 -D_1
3118 \right)
3119 \left(
3120 -D_1 + D_2
3121 \right)
3124 0 & 2 &
3126 \left(
3127 \frac{b(1,0)}{1!}
3128 \frac{b(3,0)}{3!}
3130 \frac{b(4,0)}{4!}
3131 {3 \choose 1}(-1)^1
3133 \frac{b(4,0)}{4!}
3134 {3 \choose 3}(-\frac 12)^3
3135 \right)
3136 \left(
3137 -D_1 + D_2
3138 \right)^2
3140 \end{tabular}
3142 We find
3143 \begin{align*}
3144 h'(\vec x)
3146 \left(
3147 \frac 3 8 - \frac 1{24} (-D_1) - \frac 1{24} (-D_1 + D_2)
3148 + \frac 7{576} (-D_1 D_2)
3149 - \frac 5{1152} (-2 D_1 D2)
3150 \right) x_1 x_2
3153 \frac 3 8 x_1 x_2 + \frac 1{24} x_2 - \frac 1{24} (-x_2 + x_1)
3154 + \frac 7{576} (-1)
3155 - \frac 5{1152} (-2)
3157 \end{align*}
3158 The contribution of this vertex is therefore
3160 h'(3,4) = \frac {1355}{288}
3164 \marginpar{%
3165 \intercol=1cm
3166 \begin{xy}
3167 <\intercol,0pt>:<0pt,\intercol>::
3168 \POS(0,-1)*\xybox{
3169 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
3170 \POS(0,1)\ar@[|(2)](1,0)
3171 \POS(0,1)\ar@[|(2)](0,0)
3173 \end{xy}
3175 For the vertex $\vec v = (2,5)$, we have
3176 $\vec r_1 = (0,-1)$ and $\vec r_2 = (1,-1)$.
3177 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
3178 Also, $C_1 = 1$, $C_2 = 1/2$, $y_1 = -D_2$ and $y_2 = D_1 - D_2$.
3179 We similarly find
3181 h'(\vec x)
3183 \frac 3 8 x_1 x_2 + \frac 1{24} x_1 - \frac 1{24} (x_2 - x_1)
3184 + \frac 7{576} (-1)
3185 - \frac 5{1152} (-2)
3188 The contribution of this vertex is therefore
3190 h'(2,5) = \frac {1067}{288}
3194 \marginpar{%
3195 \intercol=1cm
3196 \begin{xy}
3197 <\intercol,0pt>:<0pt,\intercol>::
3198 \POS(0,-1)*\xybox{
3199 \POS@i@={(0,0),(1,0),(0,1),(0,0)},{0*\xypolyline{--}}
3200 \POS(0,0)\ar@[|(2)](1,0)
3201 \POS(0,0)\ar@[|(2)](0,1)
3203 \end{xy}
3205 For the vertex $\vec v = (2,4)$, we have
3206 $\vec r_1 = (1,0)$ and $\vec r_2 = (0,1)$.
3207 Since $\vec v$ is integer, we have $t_1 = t_2 = 0$.
3208 The computations are easier in this case since
3209 $C_1 = C_2 = 0$, $y_1 = D_1$ and $y_2 = D_2$.
3210 We find
3212 h'(\vec x)
3214 \frac 1 4 x_1 x_2 - \frac 1{12} x_2 - \frac 1{12} x_1
3215 + \frac 1{144} (1)
3218 The contribution of this vertex is therefore
3220 h'(2,4) = \frac {253}{144}
3224 The total contribution of the vertices is then
3226 \frac {1355}{288} + \frac {1067}{288} + \frac {253}{144}
3227 = \frac {61}6
3229 and the total sum is
3231 \frac{121}{24}+\frac{355}{24}+\frac{61}6 = 30
3235 \end{example}
3237 \begin{example}
3238 Consider the parametric polytope
3240 P(n) = \{\, \vec x \mid x_1 \ge 2 \wedge 3 x_1 \le n + 9
3241 \wedge 4 \le x_2 \le 5 \,\}
3244 If $n \ge -3$, then the vertices of this polytope are
3245 $(2,4)$, $(2,5)$, $(3+n/3,4)$ and $(3+n/3,5)$.
3246 The contributions of the faces of $P(n)$ to
3248 \sum_{\vec x \in P(n) \cap \ZZ^2} x_1 x_2
3250 for the chamber $n \ge -3$ are shown in \autoref{t:sum:rectangle}.
3251 The final result is
3253 \begin{cases}
3254 \frac{ n^2}{2}
3255 - 3 n \fractional{\frac{ n}{3}}
3256 + \frac{21}{2} n
3257 + \frac{9}{2} \fractional{\frac{ n}{3}}^2
3258 - \frac{63}{2} \fractional{\frac{ n}{3}}
3259 + 45
3260 & \text{if $ n+3 \ge 0$}.
3261 \end{cases}
3264 \begin{table}
3265 \intercol=1cm
3266 \begin{tabular}{lc}
3267 \begin{xy}
3268 <\intercol,0pt>:<0pt,\intercol>::
3269 \POS(-1,-0.5)*\xybox{
3270 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*[|(2)]\xypolyline{}}
3271 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3273 \end{xy}
3276 \displaystyle
3277 \frac{ n^2}{4}
3278 + \frac{9}{2} n
3279 + \frac{45}{4}
3282 \begin{xy}
3283 <\intercol,0pt>:<0pt,\intercol>::
3284 \POS(-1,-0.5)*\xybox{
3285 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3286 \POS(0,0)\ar@[|(2)]@{-}(0,1)
3287 \POS(0,0.5)*+!L{2}
3288 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3290 \end{xy}
3293 \displaystyle
3294 \frac{33}{8}
3297 \begin{xy}
3298 <\intercol,0pt>:<0pt,\intercol>::
3299 \POS(-1,-0.5)*\xybox{
3300 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3301 \POS(1,0)\ar@[|(2)]@{-}(1,1)
3302 \POS(1,0.5)*+!L{3+n/3}
3303 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3305 \end{xy}
3308 \displaystyle
3309 - \frac{3}{2} n \fractional{\frac{ n}{3}}
3310 + \frac{3}{4} n
3311 + \frac{9}{4} \fractional{\frac{ n}{3}}^2
3312 - \frac{63}{4} \fractional{\frac{ n}{3}}
3313 + \frac{57}{8}
3316 \begin{xy}
3317 <\intercol,0pt>:<0pt,\intercol>::
3318 \POS(-1,-0.5)*\xybox{
3319 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3320 \POS(0,0)\ar@[|(2)]@{-}(1,0)
3321 \POS(0.5,0)*+!D{4}
3322 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3324 \end{xy}
3327 \displaystyle
3328 \frac{23}{216} n^2
3329 + \frac{23}{12} n
3330 + \frac{115}{24}
3333 \begin{xy}
3334 <\intercol,0pt>:<0pt,\intercol>::
3335 \POS(-1,-0.5)*\xybox{
3336 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3337 \POS(0,1)\ar@[|(2)]@{-}(1,1)
3338 \POS(0.5,1)*+!U{5}
3339 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3341 \end{xy}
3344 \displaystyle
3345 \frac{31}{216} n^2
3346 + \frac{31}{12} n
3347 + \frac{155}{24}
3350 \begin{xy}
3351 <\intercol,0pt>:<0pt,\intercol>::
3352 \POS(-1,-0.5)*\xybox{
3353 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3354 \POS(1,1)\ar@[|(2)](1,0)
3355 \POS(1,1)\ar@[|(2)](0,1)
3356 \POS(1,1)*+!LU{(3+n/3,5)}
3357 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3359 \end{xy}
3362 \displaystyle
3363 - \frac{31}{36} n \fractional{\frac{ n}{3}}
3364 + \frac{31}{72} n
3365 + \frac{31}{24} \fractional{\frac{ n}{3}}^2
3366 - \frac{217}{24} \fractional{\frac{ n}{3}}
3367 + \frac{589}{144}
3370 \begin{xy}
3371 <\intercol,0pt>:<0pt,\intercol>::
3372 \POS(-1,-0.5)*\xybox{
3373 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3374 \POS(0,1)\ar@[|(2)](1,1)
3375 \POS(0,1)\ar@[|(2)](0,0)
3376 \POS(0,1)*+!LU{(2,5)}
3377 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3379 \end{xy}
3382 \displaystyle
3383 \frac{341}{144}
3386 \begin{xy}
3387 <\intercol,0pt>:<0pt,\intercol>::
3388 \POS(-1,-0.5)*\xybox{
3389 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3390 \POS(0,0)\ar@[|(2)](1,0)
3391 \POS(0,0)\ar@[|(2)](0,1)
3392 \POS(0,0)*+!LD{(2,4)}
3393 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3395 \end{xy}
3398 \displaystyle
3399 \frac{253}{144}
3402 \begin{xy}
3403 <\intercol,0pt>:<0pt,\intercol>::
3404 \POS(-1,-0.5)*\xybox{
3405 \POS@i@={(0,0),(1,0),(1,1),(0,1),(0,0)},{0*\xypolyline{--}}
3406 \POS(1,0)\ar@[|(2)](1,1)
3407 \POS(1,0)\ar@[|(2)](0,0)
3408 \POS(1,0)*+!LD{(3+n/3,4)}
3409 \POS(0,1.1)*{}\POS(0,-0.1)*{}
3411 \end{xy}
3414 \displaystyle
3415 - \frac{23}{36} n \fractional{\frac{ n}{3}}
3416 + \frac{23}{72} n
3417 + \frac{23}{24} \fractional{\frac{ n}{3}}^2
3418 - \frac{161}{24} \fractional{\frac{ n}{3}}
3419 + \frac{437}{144}
3421 \end{tabular}
3422 \caption{Contributions of the faces of $P(n)$ to the sum of $x_1 x_2$ over
3423 the integer points of $P(n)$}
3424 \label{t:sum:rectangle}
3425 \end{table}
3427 \end{example}
3429 \subsection{Summation through exponential substitution and Laurent expansions (old)}
3430 \label{s:laurent:old}
3432 This section was inspired by \shortciteN{Baldoni2008} and
3433 presents the old implemenation of the \ai[\tt]{laurent}
3434 summation method. The implementation is described in \autoref{s:laurent}.
3436 Let $f(\vec x)$ be the generating function of a polytope $P$,
3437 i.e.,
3439 f(\vec x) = \sum_{\vec t \in P \cap \ZZ^d} \vec x^{\vec t}
3442 Substituting $\vec x = \vec e^{\vec y}$, we obtain
3444 f(\vec e^{\vec y}) = \sum_{\vec t \in P \cap \ZZ^d} e^{\sp t y}
3446 \sum_{\vec t \in P \cap \ZZ^d}
3447 \sum_{\vec n \ge \vec 0} \frac{\vec t^{\vec n} \vec y^{\vec n}}{\vec n!}
3449 \sum_{\vec n \ge \vec 0}
3450 \left(\sum_{\vec t \in P \cap \ZZ^d} \vec t^{\vec n}\right)
3451 \frac{\vec y^{\vec n}}{\vec n!}
3454 with $\vec n! = n_1! n_2! \cdots n_d!$.
3455 We observe that the sum of the monomial $\vec t^{\vec n}$
3456 over the integer points in $P$ is equal to $\vec n!$ times the coefficient
3457 of the $\vec y^{\vec n}$ term in the Taylor expansion of $f(\vec e^{\vec y})$.
3459 As in the case of unweighted counting (see \autoref{s:exponential}),
3460 we have to add the coefficients
3461 of these monomials in the Laurent expansions of the terms in \eqref{eq:rgf}.
3462 However, unlike the case of unweighted counting, we cannot transform
3463 this problem to a univariate problem and computing the coefficient
3464 of a monomial in the Laurent expansions does not reduce to computing
3465 the coefficient of a single higher-degree monomial in a Taylor expansion.
3467 Consider now one of the terms $g(\vec x) = f_{ik}(\vec x)$ in~\eqref{eq:rgf},
3468 \begin{equation}
3469 \label{eq:exp:term}
3470 g(\vec e^{\vec y}) =
3471 \frac{e^{\sum_{j=1}^d s_j(\vec p) \sp{b_j}y}}
3472 {\prod_{j=1}^{d}\left(1-e^{\sp{b_j}y}\right)}
3474 \end{equation}
3475 with $\vec w_{ij}(\vec p) = \sum_{j=1}^d s_j(\vec p) \vec b_j$ written
3476 in terms of the $\vec b_j$, which are assumed to form a basis
3477 and where we have made explicit the only place where the
3478 parameters $\vec p$ appear.
3479 We rewrite this equation as
3480 \begin{equation}
3481 \label{eq:laurent:old}
3482 g(\vec e^{\vec y}) =
3483 \left(\prod_{j=1}^d \frac{-1}{\sp{b_j}y}\right)
3484 \left(\prod_{j=1}^d \frac{-\sp{b_j}y \, e^{s_j(\vec p)\sp{b_j}y}}
3485 {1-e^{\sp{b_j}y}} \right)
3487 \end{equation}
3488 The second factor is analytic and is a product of
3489 generating functions
3490 $\Todd(s_j(\vec p), \sp{b_j}y)$
3491 of \ai{Bernoulli polynomial}s~\eqref{eq:bernoulli}.
3492 Plugging in these expressions, we find
3493 \begin{align}
3494 \Todd(s_j(\vec p), \sp{b_j}y)
3495 &= \frac{-\sp{b_j}y e^{s_j(\vec p)\sp{b_j}y}}
3496 {1-e^{\sp{b_j}y}}
3497 \nonumber
3499 &= \sum_{n=0}^\infty \frac{b(n,s_j(\vec p))}{n!} \sp{b_j}y^n
3500 \nonumber
3502 &= \sum_{\vec k \ge \vec 0}
3503 \frac{b(\sum k_i,s_j(\vec p))}{(\sum k_i)!}
3504 {\sum k_i \choose \vec k} \vec b_j^{\vec k} \vec y^{\vec k}
3505 \nonumber
3507 &= \sum_{\vec k \ge \vec 0}
3508 \frac{b(\sum k_i,s_j(\vec p))}{\prod_i k_i!}
3509 \vec b_j^{\vec k} \vec y^{\vec k}
3510 \label{eq:laurent:todd}
3512 \end{align}
3513 with
3515 {\sum k_i \choose \vec k} =
3516 {\sum k_i \choose k_1, k_2, \ldots k_d} =
3517 \frac{(\sum k_i)!}{\vec k!} =
3518 \prod_{i=1}^d {\sum_{j=1}^i k_j \choose k_i}
3520 the \ai{multinomial coefficient}s.
3521 For the first factor, we compute the Laurent expansion
3522 of each of its factors,
3523 \begin{align}
3524 \frac{-1}{\sp{b_j}y}
3525 &= \frac{-1}{\sum_{k=f}^d b_{jk} y_k}
3526 \nonumber
3528 &= \frac{-1}{b_{jf} y_f\left(1 + \frac{\sum_{k=f+1}^d b_{jk} y_k}
3529 {b_{jf} y_f}\right)}
3530 \nonumber
3532 &= \frac{-1}{b_{jf} y_f}
3533 \sum_{n=0}^\infty (-1)^n \left(\frac{\sum_{k=f+1}^d b_{jk} y_k}
3534 {b_{jf} y_f}\right)^n
3535 \nonumber
3537 &= \sum_{\vec n \ge \vec 0}
3538 {\sum n_k \choose \vec n}
3539 (-1)^{1+\sum n_k}
3540 \frac{{\vec b'_j}^{\vec n}}{b_{jf}^{1+\sum n_k}}
3541 \frac{{\vec y'}^{\vec n}}{y_f^{1+\sum n_k}}
3542 \label{eq:laurent:reciprocal}
3544 \end{align}
3545 where $b_{jf}$ is the first non-zero coefficient of $\vec b_j$
3546 and the vector $\vec b_j'$ contains
3547 the subsequent $d-f$ coefficients of $\vec b_j$.
3549 Given a polynomial
3551 q(\vec y, \vec p) = \sum_{\vec m} \beta_{\vec m}(\vec p) \, \vec y^{\vec m}
3553 that we wish to sum over the integer points of a polytope $P$, we perform
3554 the following operations for each unimodular cone in the decomposition
3555 of each vertex cone.
3556 \begin{itemize}
3557 \item For each $\vec m$ with $\beta_{\vec m}(\vec p) \ne 0$
3558 \begin{itemize}
3559 \item Compute all sums
3560 $\vec N = \sum_{j=1}^d (\vec 0, -\sum_k n_{jk}-1, \vec n_j)$
3561 of exponents from \eqref{eq:laurent:reciprocal} such that
3562 $\vec N \le \vec m$ and compute the corresponding coefficient $\gamma_{\vec N}$
3563 in the product of Laurent series by enumerating all combinations
3564 of $\vec n_j$ leading to the same $\vec N$.
3565 Note that there are only a finite number of $\vec N$ satisfying this constraint
3566 since $\sum N_k = -d$.
3567 By reordering the variables such that the highest exponents occurs
3568 for the first variable, the number of $\vec N$ can be reduced.
3569 \item For each of these $\vec N$
3570 \begin{itemize}
3571 \item Compute the coefficient $\delta_{\vec m - \vec N}(\vec p)$ of
3572 $\vec y^{\vec m - \vec N}$ in the product of
3573 Taylor expansions~\eqref{eq:laurent:todd}.
3574 \end{itemize}
3575 \end{itemize}
3576 \item The contribution of this cone is the sum of
3578 \vec m! \, \alpha \, \beta_{\vec m}(\vec p) \, \gamma_{\vec N} \,
3579 \delta_{\vec m - \vec N}(\vec p)
3581 over all considered $\vec m$ and $\vec N$.
3582 \end{itemize}
3583 Within each vertex cone computation, the coefficients
3584 $\gamma_{\vec N}$ and $\delta_{\vec m - \vec N}(\vec p)$
3585 only need to be computed once.
3587 \begin{example}
3588 \label{ex:laurent:old}
3589 Consider once more the \rgf/
3591 \f T x =
3592 \frac{x_1^2}{(1-x_1^{-1})(1-x_1^{-1}x_2)}
3594 \frac{x_2^2}{(1-x_2^{-1})(1-x_1 x_2^{-1})}
3596 \frac1{(1-x_1)(1-x_2)}
3598 from \shortciteN[Example~39]{Verdoolaege2005PhD}
3599 and Example~\ref{ex:todd}.
3600 Assume we want to compute
3602 \sum_{\vec y \in T\cap \ZZ^2} y_1^2 + y_2^2
3605 We will need the following \ai{Bernoulli polynomials}
3606 \begin{align*}
3607 b(0,s) & = 1
3609 b(1,s) &= \frac 1 2 \left(-1 + 2 s \right)
3611 b(2,s) &= \frac 1 6 \left(1 -6 s + 6 s^2 \right)
3613 b(3,s) &= \frac 1 2 \left(s -3 s^2 + 2 s^3\right)
3615 b(4,s) & = \frac 1{30} \left(-1 + 30 s^2 -60 s^3 + 30 s^4\right)
3616 \end{align*}
3617 For the first term, we have $(2,0) = -2 \, (-1,0) + 0 \, (-1, 1)$
3618 and substitution yields
3619 \begin{align*}
3620 h(\vec y)
3622 \frac 1{y_1}
3623 \frac 1{y_1-y_2}
3624 \frac {y_1 e^{(-2)(-y_1)}}{1-e^{-y_1}}
3625 \frac {(y_1-y2) e^{0(-y_1+y_2)}}{1-e^{-y_1+y_2}}
3628 \frac 1{y_1}
3629 \left(
3630 \frac 1{y_1} \left(
3631 1 + \frac{y_2}{y_1} + \frac{y_2^2}{y_1^2} + \cdots
3632 \right)
3633 \right)
3636 \left(
3637 1 + \frac{b(1,-2)}1 (-y_1) + \frac{b(2,-2)}2 (-y_1)^2
3638 + \frac{b(3,-2)}{3!} (-y_1)^3 + \frac{b(4,-2)}{4!} (-y_1)^4 + \cdots
3639 \right)
3642 \left(
3643 1 + \frac{-1}2 (-y_1+y_2) + \frac{1}{12} (-y_1+y_2)^2
3644 + 0 (-y_1+y_2)^3
3645 + \frac{1}{720} (-y_1+y_2)^4 + \cdots
3646 \right)
3647 \end{align*}
3648 We obtain the following results:
3649 {\renewcommand\arraystretch{2}
3651 \begin{array}{rrr@{}lrr@{}lc}
3652 \vec m & \vec N & \gamma_{\vec N} & \vec y^{\vec N} &
3653 \vec m - \vec N & \delta_{\vec m - \vec N} & \vec y^{\vec m - \vec N} &
3654 \vec m! \alpha \beta_{\vec m} \gamma_{\vec N} \delta_{\vec m - \vec N}
3656 (2,0) & (-2,0) & 1 & y_1^{-2} & (4,0)
3657 & \displaystyle\frac{721}{240} & y_1^4
3658 & \displaystyle\frac{721}{120}
3660 (0,2) & (-2,0) & 1 & y_1^{-2} & (2,2)
3661 & \displaystyle\frac{179}{720} & y_1^2 y_2^2
3662 & \displaystyle\frac{179}{360}
3664 & (-3,1) & 1 & y_1^{-3} y_2 & (3,1)
3665 & \displaystyle-\frac{211}{120} & y_1^3 y_1
3666 & \displaystyle-\frac{211}{60}
3668 & (-4,2) & 1 & y_1^{-4} y_2^2 & (4,0)
3669 & \displaystyle\frac{721}{240} & y_1^4
3670 & \displaystyle\frac{721}{120}
3671 \end{array}
3674 For the second term, we similarly obtain
3675 {\renewcommand\arraystretch{2}
3677 \begin{array}{rrr@{}lrr@{}lc}
3678 \vec m & \vec N & \gamma_{\vec N} & \vec y^{\vec N} &
3679 \vec m - \vec N & \delta_{\vec m - \vec N} & \vec y^{\vec m - \vec N} &
3680 \vec m! \alpha \beta_{\vec m} \gamma_{\vec N} \delta_{\vec m - \vec N}
3682 (2,0) & (-1,-1) & -1 & y_1^{-1} y_2^{-1} & (3,1)
3683 & \displaystyle\frac{1}{180} & y_1^3 y_1
3684 & \displaystyle-\frac{1}{90}
3686 & (-2,0) & -1 & y_1^{-2} & (4,0)
3687 & \displaystyle-\frac{1}{720} & y_1^4
3688 & \displaystyle\frac{1}{360}
3690 (0,2) & (-1,-1) & -1 & y_1^{-1} y_2^{-1} & (1,3)
3691 & \displaystyle-\frac{211}{120} & y_1 y_2^3
3692 & \displaystyle\frac{211}{60}
3694 & (-2,0) & -1 & y_1^{-3} y_2 & (2,2)
3695 & \displaystyle\frac{179}{720} & y_1^3 y_2
3696 & \displaystyle-\frac{179}{360}
3698 & (-3,1) & -1 & y_1^{-3} y_2 & (3,1)
3699 & \displaystyle\frac{1}{180} & y_1^3 y_1
3700 & \displaystyle-\frac{1}{90}
3702 & (-4,2) & -1 & y_1^{-4} y_2^2 & (4,0)
3703 & \displaystyle-\frac{1}{720} & y_1^4
3704 & \displaystyle\frac{1}{360}
3705 \end{array}
3708 Finally, for the third term, we obtain
3710 \begin{array}{rrr@{}lrr@{}lc}
3711 \vec m & \vec N & \gamma_{\vec N} & \vec y^{\vec N} &
3712 \vec m - \vec N & \delta_{\vec m - \vec N} & \vec y^{\vec m - \vec N} &
3713 \vec m! \alpha \beta_{\vec m} \gamma_{\vec N} \delta_{\vec m - \vec N}
3715 (2,0) & (-1,-1) & -1 & y_1^{-1} y_2^{-1} & (3,1)
3716 & 0 & y_1^3 y_1
3719 (0,2) & (-1,-1) & -1 & y_1^{-1} y_2^{-1} & (1,3)
3720 & 0 & y_1 y_2^3
3722 \end{array}
3724 Adding up all contributions in the final columns of these tables,
3725 we obtain a grand total of
3729 \end{example}
3731 \subsection{Summation through exponential substitution and Laurent expansions}
3732 \label{s:laurent}
3734 This section was inspired by \shortciteN{Baldoni2009}.
3736 As in \autoref{s:laurent:old}, we want to compute
3737 $\vec n!$ times the coefficient of the $\vec y^{\vec n}$ term
3738 in the Taylor expansion of $f(\vec e^{\vec y})$.
3739 However, we do not write \eqref{eq:exp:term}, i.e.,
3741 g(\vec e^{\vec y}) =
3742 \frac{e^{\sum_{j=1}^d s_j(\vec p) \sp{b_j}y}}
3743 {\prod_{j=1}^{d}\left(1-e^{\sp{b_j}y}\right)}
3745 as in \eqref{eq:laurent:old},
3746 but as
3748 g(\vec e^{\vec y}) =
3749 \prod_{j=1}^d \left(-\frac 1 {\sp{b_j}y} +
3750 \left(\frac 1 {\sp{b_j}y} +
3751 \frac{e^{s_j(\vec p)\sp{b_j}y}}
3752 {1-e^{\sp{b_j}y}} \right)\right)
3754 instead.
3755 The second term in each factor is of the form
3756 \begin{align*}
3757 \frac 1 x +
3758 \frac{e^{ux}}{1-e^x}
3760 \frac 1 x +
3761 \frac 1 x \frac{x \, e^{ux}}{1-e^x}
3764 \frac 1 x
3765 - \sum_{k=0}^{\infty} \frac{b(k,u)}{k!} \, x^{k-1}
3768 - \sum_{k=1}^{\infty} \frac{b(k,u)}{k!} \, x^{k-1}
3771 - \sum_{k=0}^{\infty} \frac{b(k+1,u)}{(k+1)!} \, x^{k}
3773 \end{align*}
3774 with $b(k,u)$ the \ai{Bernoulli polynomial}s.
3775 The second line follows from \eqref{eq:bernoulli}
3776 and the third line follows from $b(0,u) = 1$.
3777 We therefore have
3778 \begin{align*}
3779 g(\vec e^{\vec y})
3781 \prod_{j=1}^d \left(
3782 - \frac 1 {\sp{b_j}y}
3783 - \sum_{k=0}^{\infty}
3784 \frac{b(k+1,s_j(\vec p))}{(k+1)!} \, {\sp{b_j}y}^{k}
3785 \right)
3788 \prod_{j=1}^d \left(
3789 \left(
3790 \sum_{\vec n \ge \vec 0}
3791 (-1)^{1+\sum n_k}
3792 {\sum n_k \choose \vec n}
3793 \frac{{\vec b'_j}^{\vec n}}{b_{jf_j}^{1+\sum n_k}}
3794 \frac{{\vec y'}^{\vec n}}{y_{f_j}^{1+\sum n_k}}
3795 \right)
3796 - \sum_{\vec n \ge \vec 0}
3797 \frac{b(1+\sum n_k,s_j(\vec p))}{(1+\sum n_k)\prod n_k!} \,
3798 \vec b_j^{\vec n} \vec y^{\vec n}
3799 \right)
3801 \end{align*}
3802 where $b_{jf_j}$ is the first non-zero coefficient of $\vec b_j$
3803 and the vector $\vec b_j'$ contains
3804 the subsequent $d-f_j$ coefficients of $\vec b_j$.
3805 The expansion of the first term follows from \eqref{eq:laurent:reciprocal},
3806 while the expansion of the second term follows from \eqref{eq:laurent:todd}.
3807 Note, however, that unlike \autoref{s:laurent:old}, each factor is
3808 now a {\em sum} of two series instead of a product of two series.
3809 In particular, there are two kinds of (non-overlapping) terms.
3810 In the first kind of terms, there is exactly one variable $y_{f_j}$
3811 with a negative exponent, where $f_j$ is such that $b_{jf_j}$ is the first
3812 non-zero coefficient of $\vec b_j$, and the sum of all exponents is $-1$.
3813 Let $\vec n$ contain the non-negative exponents, then the coefficient
3814 of such a term is
3815 \begin{equation}
3816 \label{eq:laurent:term:1}
3817 (-1)^{1+\sum n_k}
3818 {\sum n_k \choose \vec n}
3819 \frac{{\vec b'_j}^{\vec n}}{b_{jf}^{1+\sum n_k}}
3821 \end{equation}
3822 In the second kind of terms, all exponents are non-negative and
3823 the coefficient is given by
3824 \begin{equation}
3825 \label{eq:laurent:term:2}
3826 - \sum_{\vec n \ge \vec 0}
3827 \frac{b(1+\sum n_k,s_j(\vec p))}{(1+\sum n_k)\prod n_k!} \,
3828 \vec b_j^{\vec n}
3830 \end{equation}
3832 Given, as before, a polynomial
3834 q(\vec y, \vec p) = \sum_{\vec m} \beta_{\vec m}(\vec p) \, \vec y^{\vec m}
3836 that we wish to sum over the integer points of a polytope $P$, we perform
3837 the following operations for each unimodular cone in the decomposition
3838 of each vertex cone.
3839 \begin{itemize}
3840 \item For each $\vec m$ with $\beta_{\vec m}(\vec p) \ne 0$
3841 \begin{itemize}
3842 \item Consider all decomposition $\vec m = \sum_j {\vec n_j}$
3843 such that each $\vec n_j$ corresponds to one of the two kinds of terms,
3844 i.e., either $n_{jf_j} < 0$ and $\sum_k n_{jk} = -1$ or $\vec n_j \ge \vec 0$.
3845 \item For each such decomposition, compute the coefficient
3846 $\alpha_{\vec m}(\vec p)$ of
3847 $\vec y^{\vec m}$ as the product of the corresponding
3848 coefficients from \eqref{eq:laurent:term:1}
3849 and \eqref{eq:laurent:term:2}.
3850 \end{itemize}
3851 \item The contribution of the cone is the sum of
3853 \vec m! \, \alpha(\vec m)
3855 over all these $\vec m$.
3856 \end{itemize}
3858 \begin{example}
3859 As in Example~\ref{ex:laurent:old}, let us compute
3861 \sum_{\vec y \in T\cap \ZZ^2} y_1^2 + y_2^2
3864 with $T$ a triangle with generating function
3866 \f T x =
3867 \frac{x_1^2}{(1-x_1^{-1})(1-x_1^{-1}x_2)}
3869 \frac{x_2^2}{(1-x_2^{-1})(1-x_1 x_2^{-1})}
3871 \frac1{(1-x_1)(1-x_2)}
3874 Consider the first term. As before, we write the exponent of
3875 the numerator of this term as
3876 $(2,0) = -2 \, (-1,0) + 0 \, (-1, 1)$ and so we obtain
3877 \begin{align*}
3878 h(\vec y)
3880 \left(
3881 \frac 1{y_1}
3882 + \left(
3883 \frac 1{-y_1}
3885 \frac {e^{(-2)(-y_1)}}{1-e^{-y_1}}
3886 \right)
3887 \right)
3888 \left(
3889 \frac 1{y_1-y_2}
3890 + \left(
3891 \frac 1{-y_1+y_2}
3893 \frac {e^{0(-y_1+y_2)}}{1-e^{-y_1+y_2}}
3894 \right)
3895 \right)
3898 \left(
3899 \frac 1 {y_1} + \sum_{n=0}^{\infty} \frac{b(n+1,-2)}{(n+1)n!} (-1)^{n+1} y_1^n
3900 \right)
3903 \left(
3904 \sum_{n\ge 0} (-1)^{n+1} {n \choose n} \frac {1^n}{{-1}^{1+n}}
3905 \frac {y_2^{n}}{y_1^{1+n}}
3906 + \sum_{\vec n \ge 0} \frac{b(1+n_1+n_2,0)}{(1+n_1+n_2)n_1!n_2!}
3907 (-1)^{n_1} 1^{n_2} y_1^{n_1} y_2^{n_2}
3908 \right)
3911 \left(
3912 \frac 1 {y_1} + \frac 5 2 + \frac {37}{12} y_1 + \frac 5 2 y_1^2
3913 + \frac {1079}{702} y_1^3 + \ldots
3914 \right)
3917 \left(
3918 \frac 1 {y_1} + \frac {y_2}{y_1^2} + \frac {y_2^2}{y_1^3} + \ldots
3920 \frac 1 2
3921 + \frac 1 {12} y_1
3922 - \frac 1 {12} y_2
3923 + 0 y_1^2
3924 + \frac 1 6 y_1 y_2
3925 - \frac 1 {12} y_2^2
3926 - \frac 1 {720} y_1^3
3927 + \frac 1 {240} y_1^2 y_2
3928 % - \frac 1 {240} y_1 y_2^2
3929 + \ldots
3930 \right)
3932 \end{align*}
3933 The coefficient of $y_1^2$ is then
3935 1(-\frac 1 {720}) + 0 + \frac{37}{12}\frac 1{12} + \frac 5 2\frac 1 2
3936 + \frac{1079}{720} 1 = \frac{721}{240}
3939 which is the same value as the one we found in
3940 Example~\ref{ex:laurent:old}.
3941 \end{example}
3943 To compare the difference between the old implementation described
3944 in \autoref{s:laurent:old} and the new implementation described here,
3945 we repeat the experiments of \shortciteN{Verdoolaege2008weighted}.
3946 The new experiments were performed on the same hardware (Intel Core2)
3947 as the old experiments, but using barvinok version
3948 {\tt barvinok-0.28-45-ga380232}.
3949 It should be noted that the running times reported by
3950 \shortciteN{Verdoolaege2008weighted} had been mistakenly scaled down
3951 by a factor of $0.6$.
3952 The experiments were cut off at 10 minutes (600 seconds).
3953 The new results are shown in Figures~\ref{f:sum} and~\ref{f:sum:p}.
3954 The time measuring resolution is 0.01s, so very short execution times are not
3955 measured very accurately, resulting in some anomalies in the graphs.
3956 In the non-parametric triangle experiment in \autoref{f:sum},
3957 the new Laurent methods is by far the best.
3958 For the parametric triangle, Euler-Maclaurin still beats Laurent,
3959 but the new version is getting much closer than the old version.
3961 \begin{figure}
3962 \includegraphics[width=0.9\textwidth]{sum}
3963 \caption{Execution times for summing a monomial over a diffiuclt
3964 non-parametric triangle}
3965 \label{f:sum}
3966 \end{figure}
3968 \begin{figure}
3969 \includegraphics[width=0.9\textwidth]{sum_p}
3970 \caption{Execution times for summing a monomial over a difficult
3971 parametric triangle}
3972 \label{f:sum:p}
3973 \end{figure}
3975 \subsection{Conversion to ``standard form''}
3976 \label{s:standard}
3978 Some algorithms or tools expect a polyhedron to be
3979 specified in ``\ai{standard form}'', i.e.,
3980 \begin{equation}
3981 \label{eq:standard}
3982 \begin{cases}
3983 \begin{aligned}
3984 A \vec x & = \vec b \\
3985 \vec x & \ge \vec 0
3987 \end{aligned}
3988 \end{cases}
3989 \end{equation}
3990 Given an arbitrary (parametric) polyhedron
3991 \begin{equation}
3992 \label{eq:non-standard}
3993 \{\,
3994 \vec x \mid
3995 A \vec x + \vec b(\vec p) \ge 0
3996 \,\}
3998 \end{equation}
3999 a conversion to standard form requires the introduction
4000 of \ai{slack variable}s and a way of dealing with variables
4001 of \ai{unrestricted sign}.
4002 In this section we will be satisfied with a reduction
4003 to the form
4004 \begin{equation}
4005 \label{eq:standard:2}
4006 \begin{cases}
4007 \begin{aligned}
4008 A \vec x & = \vec b \\
4009 D \vec x & \ge \vec c
4011 \end{aligned}
4012 \end{cases}
4013 \end{equation}
4014 with $D$ a diagonal matrix with positive entries.
4015 That is, we do not necessarily make all variables non-negative,
4016 but we do ensure that they have a lower bound.
4017 If needed, a subsequent reduction can then be performed.
4019 The standard way of dealing with variables of unrestricted
4020 sign is to replace a variable $x$ of unknown sign by the
4021 difference ($x = x' - x''$) of two non-negative variables
4022 ($x', x'' \ge 0$).
4023 However, some algorithms are somewhat sensitive with respect
4024 to the number of variables and so we would prefer to introduce
4025 as few extra variables as possible.
4026 We will therefore apply a \ai{unimodular transformation}
4027 on the variables such that all transformed variables are known
4028 to be non-negative.
4030 The first step is to compute the \indac{HNF} of A,
4031 i.e., a matrix $H = A U$, with $U$ unimodular,
4032 in column echelon form such that the
4033 first entry in each column is positive and the other entries
4034 on the corresponding row are non-negative and strictly smaller
4035 than this first entry.
4036 By reordering the rows we may assume that the top square part
4037 of $H$ is lower-triangular.
4038 By a further unimodular transformation, the entries
4039 below the diagonal can be made non-positive and strictly
4040 smaller (in absolute value) than the diagonal entry of the same row.
4042 For each of the new variables, we can take a positive
4043 combination of the corresponding row and the previous rows
4044 to obtain a positive multiple of the corresponding unit vector,
4045 implying that the variable has a lower bound.
4046 A slack variable can then be introduced for each of the
4047 rows in the top square part of $H'$ that is not already
4048 a positive multiple of a unit vector and for each of
4049 the rows below the top square part of $H'$.
4051 \begin{example}
4052 Consider the cone
4054 \left\{\,
4055 \vec x \mid
4056 \begin{bmatrix}
4057 67 & -13 \\
4058 -52 & 53
4059 \end{bmatrix}
4060 \vec x
4062 \vec 0
4063 \,\right\}
4066 This cone is already situated in the first quadrant,
4067 but this may not be obvious from the constraints.
4068 Furthermore, directly adding slack variables would
4069 lead to a total of 4 variables, whereas we can also
4070 represent this cone in standard form with only 3 variables.
4071 We have
4073 H' =
4074 \begin{bmatrix}
4075 1 & 0 \\
4076 -1331 & 2875
4077 \end{bmatrix}
4079 \begin{bmatrix}
4080 67 & -13 \\
4081 -52 & 53
4082 \end{bmatrix}
4083 \begin{bmatrix}
4084 -6 & 13 \\
4085 -31 & 57
4086 \end{bmatrix}
4087 = A U'
4090 Adding a slack variable for the second row of $H'$, we
4091 obtain the equivalent problem
4093 \begin{cases}
4094 \begin{aligned}
4095 \begin{bmatrix}
4096 -1331 & 2875 & -1
4097 \end{bmatrix}
4098 \vec x'
4100 \vec 0
4102 \vec x' & \ge \vec 0
4103 \end{aligned}
4104 \end{cases}
4106 with
4108 \vec x =
4109 \begin{bmatrix}
4110 -6 & 13 & 0 \\
4111 -31 & 57 & 0
4112 \end{bmatrix}
4113 \vec x'
4116 \end{example}
4118 A similar construction was used by \shortciteN[Lemma~3.10]{Eisenbrand2000PhD}
4119 and \shortciteN{Hung1990}.
4121 \subsection{Using TOPCOM to compute Chamber Decompositions}
4123 In this section, we describe how to use the correspondence
4124 between the \ai{regular triangulation}s of a point set
4125 and the chambers of the \ai{Gale transform}
4126 of the point set~\shortcite{Gelfand1994}
4127 to compute the chamber decomposition of a parametric polytope.
4128 This correspondence was also used by \shortciteN{Pfeifle2003}
4129 \shortciteN{Eisenschmidt2007integrally}.
4131 Let us first assume that the parametric polytope can be written as
4132 \begin{equation}
4133 \label{eq:TOPCOM:polytope}
4134 \begin{cases}
4135 \begin{aligned}
4136 \vec x &\ge 0
4138 A \, \vec x &\le \vec b(\vec p)
4140 \end{aligned}
4141 \end{cases}
4142 \end{equation}
4143 where the right hand side $\vec b(\vec p)$ is arbitrary and
4144 may depend on the parameters.
4145 The first step is to add slack variables $\vec s$ to obtain
4146 the \ai{vector partition} problem
4148 \begin{cases}
4149 \begin{aligned}
4150 A \, \vec x + I \, \vec s & = \vec b(\vec p)
4152 \vec x, \vec s &\ge 0
4154 \end{aligned}
4155 \end{cases}
4157 with $I$ the identity matrix.
4158 Then we compute the (right) kernel $K$ of the matrix
4159 $\begin{bmatrix}
4160 A & I
4161 \end{bmatrix}$, i.e.,
4163 \begin{bmatrix}
4164 A & I
4165 \end{bmatrix}
4170 and use \ai[\tt]{TOPCOM}'s \ai[\tt]{points2triangs} to
4171 compute the \ai{regular triangulation}s of the points specified
4172 by the rows of $K$.
4173 Each of the resulting triangulations corresponds to a chamber
4174 in the chamber complex of the above vector partition problem.
4175 Each simplex in a triangulation corresponds to a parametric
4176 vertex active on the corresponding chamber and
4177 each point in the simplex (i.e., a row of $K$) corresponds
4178 to a variable ($x_j$ or $s_j$) that is set to zero to obtain
4179 this parametric vertex.
4180 In the original formulation of the problem~\eqref{eq:TOPCOM:polytope}
4181 each such variable set to zero reflects the saturation of the
4182 corresponding constraint ($x_j = 0$ for $x_j = 0$ and
4183 $\sps {\vec a_j}{\vec x} = b_j(\vec p)$ for $s_j = 0$).
4184 A description of the chamber can then be obtained by plugging
4185 in the parametric vertices in the remaining constraints.
4187 \begin{example}
4188 Consider the parametric polytope
4190 P(p,q,r) = \{\,
4191 (i,j) \mid 0 \le i \le p \wedge
4192 0 \le j \le 2 i + q \wedge
4193 0 \le k \le i - p + r \wedge
4194 p \ge 0 \wedge
4195 q \ge 0 \wedge
4196 r \ge 0
4197 \,\}
4200 The constraints involving the variables are
4202 \begin{cases}
4203 \begin{aligned}
4204 \begin{bmatrix}
4209 & & 1
4210 \end{bmatrix}
4211 \begin{bmatrix}
4212 i \\ j \\ k
4213 \end{bmatrix}
4215 \begin{matrix}
4221 \end{matrix}
4222 \begin{array}{l}
4228 \end{array}
4230 \begin{bmatrix}
4231 1 & 0 & 0
4233 -1 & 0 & 1
4235 -2 & 1 & 0
4236 \end{bmatrix}
4237 \begin{bmatrix}
4238 i \\ j \\ k
4239 \end{bmatrix}
4241 \begin{matrix}
4247 \end{matrix}
4248 \begin{array}{l}
4253 -p + r
4254 \end{array}
4255 \end{aligned}
4256 \end{cases}
4258 We have
4260 \begin{bmatrix}
4261 1 & 0 & 0 & 1 & 0 & 0 \\
4262 -1 & 0 & 1 & 0 & 1 & 0 \\
4263 -2 & 1 & 0 & 0 & 0 & 1 \\
4264 \end{bmatrix}
4265 \begin{bmatrix}
4266 -1 & 0 & 0 \\
4267 -2 & 0 & -1 \\
4268 -1 & -1 & 0 \\
4269 1 & 0 & 0 \\
4270 0 & 1 & 0 \\
4271 0 & 0 & 1 \\
4272 \end{bmatrix}
4276 Computing the \ai{regular triangulation}s of the rows of $K$
4277 using \ai[\tt]{TOPCOM}, we obtain
4278 \begin{verbatim}
4279 > cat e2.topcom
4281 [ -1 0 0 ]
4282 [ -2 0 -1 ]
4283 [ -1 -1 0 ]
4284 [ 1 0 0 ]
4285 [ 0 1 0 ]
4286 [ 0 0 1 ]
4288 > points2triangs --regular < e2.topcom
4289 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}};
4290 T[2]:={{1,2,3},{1,3,4},{2,3,5},{3,4,5},{1,2,5},{1,4,5}};
4291 T[3]:={{1,2,3},{1,3,4},{2,3,5},{3,4,5},{1,2,4},{2,4,5}};
4292 \end{verbatim}
4294 We see that we have three chambers in the decomposition,
4295 one with 8 vertices and two with 6 vertices.
4296 Take the second vertex (``\verb+{1,2,3}+'') of the first chamber.
4297 This vertex corresponds
4298 to the saturation of the constraints $j \ge 0$, $k \ge 0$
4299 and $i \le p$, i.e., $(i,j,k) = (p,0,0)$. Plugging in this
4300 vertex in the remaining constraints, we see that it is only valid
4301 in case $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$.
4302 For the remaining vertices of the first chamber, we similarly find
4304 \begin{tabular}{ccc}
4305 % e0
4306 \verb+{0,1,2}+ & $(0,0,0)$ & $p \ge 0$, $-q + r \ge 0$ and $q \ge 0$
4308 % 70
4309 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4311 % c8
4312 \verb+{0,1,4}+ & $(0,0,-p+r)$ & $-q + r \ge 0$, $p \ge 0$ and $q \ge 0$
4314 % 58
4315 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4317 % a4
4318 \verb+{0,2,5}+ & $(0,q,0)$ & $q \ge 0$, $p \ge 0$ and $-q + r \ge 0$
4320 % 34
4321 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4323 % 8c
4324 \verb+{0,4,5}+ & $(0, q, -p+r)$ & $q \ge 0$, $-q + r \ge 0$ and $p \ge 0$
4326 % 1c
4327 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4328 \end{tabular}
4330 Combining these constraints with the initial constraints of the problem
4331 on the parameters
4332 $p \ge 0$, $q \ge 0$ and $r \ge 0$, we find the chamber
4334 \{\,
4335 (p,q,r) \mid p \ge 0 \wedge -p + r \ge 0 \wedge q \ge 0
4336 \,\}
4338 For the second chamber, we have
4340 \begin{tabular}{ccc}
4341 % 70
4342 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4344 % 58
4345 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4347 % 34
4348 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4350 % 1c
4351 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4353 % 64
4354 \verb+{1,2,5}+ & $(-\frac q 2,0,0)$ &
4355 $-q \ge 0$, $2p + q \ge 0$ and $-2p -q+2r \ge 0$
4357 % 4c
4358 \verb+{1,4,5}+ & $(-\frac q 2,0,-p-\frac q 2+r)$ &
4359 $-q \ge 0$, $-2p -q+2r \ge 0$ and $2p + q \ge 0$
4360 \end{tabular}
4362 The chamber is therefore
4364 \{\,
4365 (p,q,r) \mid q = 0 \wedge p \ge 0 \wedge -p +r \ge 0
4366 \,\}
4368 Note that by intersecting with the initial constraints this chamber
4369 is no longer full-dimensional and can therefore be discarded.
4370 Finally, for the third chamber, we have
4372 \begin{tabular}{ccc}
4373 % 70
4374 \verb+{1,2,3}+ & $(p,0,0)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4376 % 58
4377 \verb+{1,3,4}+ & $(p,0,r)$ & $p \ge 0$, $r \ge 0$ and $2p + q \ge 0$
4379 % 34
4380 \verb+{2,3,5}+ & $(p, 2p+q, 0)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4382 % 1c
4383 \verb+{3,4,5}+ & $(p, 2p+q, r)$ & $p \ge 0$, $2p + q \ge 0$ and $r \ge 0$
4385 % 68
4386 \verb+{1,2,4}+ & $(p-r,0,0)$ &
4387 $p -r \ge 0$, $r \ge 0$ and $2p +q -2r \ge 0$
4389 % 2c
4390 \verb+{2,4,5}+ & $(p-r,2p+q-2r, 0)$ &
4391 $p -r \ge 0$, $2p +q -2r \ge 0$ and $r \ge 0$
4392 \end{tabular}
4394 The chamber is therefore
4396 \{\,
4397 (p,q,r) \mid p - r \ge 0 \wedge q \ge 0 \wedge r \ge 0
4398 \,\}
4400 \end{example}
4402 Now let us consider general parametric polytopes.
4403 First note that we can follow the same procedure as above
4404 if we replace $\vec x$ by $\vec x' - \vec c(\vec p)$
4405 in \eqref{eq:TOPCOM:polytope}, i.e.,
4406 if our problem has the form
4407 \begin{equation}
4408 \label{eq:TOPCOM:polytope:2}
4409 \begin{cases}
4410 \begin{aligned}
4411 \vec x' &\ge \vec c(\vec p)
4413 A \, \vec x' &\le \vec b(\vec p) + A \vec c(\vec p)
4415 \end{aligned}
4416 \end{cases}
4417 \end{equation}
4418 as saturating a constraint $x_i = 0$ is equivalent
4419 to saturating the constraint $x_i' = c_i(\vec p)$
4420 and, similarly, $\sps {\vec a_j}{\vec x} = b_j(\vec p)$
4421 is equivalent to
4422 $\sps {\vec a_j}{\vec x'} = b_j(\vec p) + \sps {\vec a_j}{\vec c(\vec p)}$.
4424 In the general case, the problem has the form
4426 A \vec x \ge \vec b(\vec p)
4428 and then we apply the technique of \autoref{s:standard}.
4429 Let $A'$ be a non-singular square submatrix of $A$ with the same number
4430 of columns and compute the (left) \indac{HNF} $H = A' U$ with $U$ unimodular
4431 and $H$ lower-triangular with non-positive elements below the diagonal.
4432 Replacing $\vec x$ by $U \vec x'$, we obtain
4434 \begin{cases}
4435 \begin{aligned}
4436 H \vec x' &\ge \vec b'(\vec p)
4438 -A''U \, \vec x' &\le -\vec b''(\vec p)
4440 \end{aligned}
4441 \end{cases}
4443 with $A''$ the remaining rows of $A$ and $\vec b(\vec p)$ split
4444 in the same way.
4445 If $H$ happens to be the identity matrix, then our problem is
4446 of the form \eqref{eq:TOPCOM:polytope:2} and we already know how
4447 to solve this problem.
4448 Note that, again, saturating any of the transformed constraints
4449 in $\vec x'$ is equivalent to saturating the corresponding constraint
4450 in $\vec x$. We therefore only need to compute $-A'' U$ for the
4451 computation of the kernel $K$. To construct the parametric vertices
4452 in the original coordinate system, we can simply use the original
4453 constraints.
4454 The same reasoning holds if $H$ is any diagonal matrix, since
4455 we can virtually replace $H \vec x$ by $\vec x'$ without affecting
4456 the non-negativity of the variables.
4458 If $H$ is not diagonal, then we can introduce new constraints
4459 $x'_j \ge d(\vec p)$, where $d(\vec p)$ is some symbolic constant.
4460 These constraints do not remove any solutions
4461 since each row in $H$ expresses that the corresponding variable is
4462 greater than or equal to a non-negative combination of the
4463 previous variables plus some constant.
4464 We can then proceed as before. However, to reduce unnecessary computations
4465 we may remove from $K$ the rows that correspond to these new rows.
4466 Any solution saturating the new constraint, would also saturate
4467 the corresponding constraint $\vec h_j^\T$ and all
4468 the constraints corresponding to the non-zero
4469 entries in $\vec h_j^\T$.
4470 If a chamber contains a vertex obtained by saturating such a new
4471 constraint, it would appear multiple times in the same chamber,
4472 each time combined with different constraints from the above set.
4473 Furthermore, there would also be another (as it turns out, identical)
4474 chamber where the vertex is only defined by the other constraints.
4476 \begin{example}
4477 Consider the parametric polytope
4479 P(n) = \{\,
4480 (i,j) \mid
4481 1 \le i \wedge 2 i \le 3 j \wedge j \le n
4482 \,\}
4485 The constraints are
4487 \begin{bmatrix}
4488 1 & 0 \\
4489 -2 & 3 \\
4490 0 & -1
4491 \end{bmatrix}
4492 \begin{bmatrix}
4493 i \\ j
4494 \end{bmatrix}
4496 \begin{bmatrix}
4497 1 \\
4498 0 \\
4500 \end{bmatrix}
4503 The top $2 \times 2$ submatrix is already in \indac{HNF}.
4504 We have $3 j \ge 2i \ge 2$, so we can add a constraint
4505 of the form $j \ge c(n)$ and obtain
4507 \begin{bmatrix}
4508 A & I
4509 \end{bmatrix}
4511 \begin{bmatrix}
4512 0 & 1 & 1 & 0
4514 2 & -3 & 0 & 1
4515 \end{bmatrix}
4518 while $K$ with $\begin{bmatrix}A & I\end{bmatrix} K = 0$ is given
4521 \begin{bmatrix}
4522 0 & 1 & 1 & 0
4524 2 & -3 & 0 & 1
4525 \end{bmatrix}
4526 \begin{bmatrix}
4527 1 & 0 \\
4528 0 & 1 \\
4529 0 & -1 \\
4530 -2 & 3
4531 \end{bmatrix}
4534 The second row of $K$ corresponds to the second variable,
4535 which in turn corresponds to the newly added constraint.
4536 Passing all rows of $K$ to \ai[\tt]{TOPCOM} we would get
4537 \begin{verbatim}
4538 > points2triangs --regular <<EOF
4539 > [[1 0],[0,1],[0,-1],[-2,3]]
4540 > EOF
4541 T[1]:={{0,1},{0,2},{1,3},{2,3}};
4542 T[2]:={{0,2},{2,3},{0,3}};
4543 T[3]:={};
4544 \end{verbatim}
4545 The first vertex in the first chamber saturates the second row
4546 (row 1) and therefore saturates both the first (0) and fourth (3)
4547 and it appears a second time as \verb+{1,3}+. Combining
4548 these ``two'' vertices into one as \verb+{0,3}+ results in the
4549 second (identical) chamber.
4550 Removing the row corresponding to the new constraint from $K$
4551 we remove the duplicates
4552 \begin{verbatim}
4553 > points2triangs --regular <<EOF
4554 > [[1 0],[0,-1],[-2,3]]
4555 > EOF
4556 T[1]:={{0,1},{1,2},{0,2}};
4557 T[2]:={};
4558 \end{verbatim}
4559 Note that in this example, we also could have interchanged
4560 the second and the third constraint and then have replaced $j$ by $-j'$.
4561 \end{example}
4563 In practice, this method of computing a \ai{chamber decomposition}
4564 does not seem to perform very well, mostly because
4565 \ai[\tt]{TOPCOM} can not exploit all available information
4566 about the parametric polytopes and will therefore compute
4567 many redundant triangulations/chambers.
4568 In particular, any chamber that does not intersect with
4569 the parameter domain of the parametric polytope, or only
4570 intersects in a face of this parameter domain, is completely redundant.
4571 Furthermore, if the parametric polytope is not simple, then many
4572 different combinations of the constraints will lead to the same parametric
4573 vertex. Many triangulations will therefore correspond to one and the
4574 same chamber in the chamber complex of the parametric polytope.
4575 For example, for a dilated octahedron, \ai[\tt]{TOPCOM} will
4576 compute 150 triangulations/chambers, 104 of which are empty,
4577 while the remaining 46 refer to the same single chamber.
4580 \subsection{Computing the Hilbert basis of a cone}
4581 \label{s:hilbert}
4583 To compute the \ai{Hilbert basis} of a cone, we use
4584 the \ai[\tt]{zsolve} library from \ai[\tt]{4ti2} \shortcite{4ti2},
4585 which implements the technique of \shortciteN{Hemmecke2002Hilbert}.
4586 We first remove all equalities from the cone through unimodular
4587 transformations and then apply the technique of \autoref{s:standard}
4588 to put the cone in ``standard form''. Note that for a (non-parametric)
4589 cone the constant term $\vec b$ in \eqref{eq:non-standard} is $\vec 0$.
4590 The constraints $D \vec x \ge \vec c = \vec 0$ of \eqref{eq:standard:2}
4591 are therefore equivalent to $\vec x \ge \vec 0$.
4594 \subsection{Integer Feasibility}
4595 \label{s:feasibility}
4597 For testing whether a polytope $P \subset \QQ^d$ contains any integer points,
4598 we use the technique of~\shortciteN{Cook1993implementation},
4599 based on \ai{generalized basis reduction}.
4601 The technique basically looks for a ``short vector'' $\vec c$ in the
4602 lattice $\ZZ^d$, where shortness is measured in terms of
4603 the \ai{width} of the polytope $P$ along that direction,
4604 \begin{align*}
4605 \width_{\vec c} P
4607 \max \{\, \sp c x \mid \vec x \in P \,\}
4609 \min \{\, \sp c x \mid \vec x \in P \,\}
4612 \max \{\, \sps {\vec c} {\vec x - \vec y} \mid \vec x, \vec y \in P \,\}
4614 \end{align*}
4615 The \defindex{lattice width} is the minimum width over all
4616 non-zero integer directions:
4618 \width P =
4619 \min_{\vec c \in \ZZ^d \setminus \{ \vec 0 \} } \width_{\vec c} P
4622 If the dimension $d$ is fixed then
4623 the lattice width of any polytope $P \subset \QQ^d$
4624 containing no integer points is bounded by a constant%
4625 ~\shortcite{Lagarias90,Barvinok02,Banaszczyk1999flatness}.
4626 If we slice the polytope using hyperplanes orthogonal
4627 to a short direction, i.e., a direction where the width
4628 is small, we will therefore only need to inspect
4629 ``few'' of them before either finding one with an integer point,
4630 or running out of hyperplanes, meaning that the
4631 polytope did not contain any integer points.
4632 Each slice is checked for integer points by applying
4633 the above method recursively.
4635 A nice feature of this technique is that it will
4636 not only tell you if there is any integer point
4637 in the given polytope, but it will actually compute
4638 one if there is any.
4640 The short vector is obtained as the first vector
4641 of a ``reduced basis'' of the lattice $\ZZ^d$ with respect
4642 to the polytope.
4643 In particular, the first vector $\vec b_1$ of this reduced basis
4644 will satisfy
4646 \width_{\vec b_1} P
4648 \frac{\width P}
4649 {\left(\frac 1 2 - \varepsilon\right)^{d-1}}
4652 with $0 < \varepsilon < 1/2$ a fixed constant.
4653 That is, the width in direction $\vec b_1$ is no more than a constant
4654 factor bigger than the lattice width.
4655 See~\shortcite{Cook1993implementation} for details.
4656 In our implementation we use $\varepsilon = 1/4$.
4657 When used in the above integer feasibility testing algorithm,
4658 we will also terminate the reduced basis computation
4659 as soon as the width along the first basis vector is smaller than 2.
4660 This means that there will be at most 2 slices orthogonal to the chosen
4661 direction.
4663 The computation of the above reduced basis requires the solution
4664 of many linear programs, for which we use any of the following
4665 external solvers:
4666 \begin{itemize}
4667 \item \ai[\tt]{GLPK}~\shortcite{GLPK}
4669 This solver is based on double precision floating point arithmetic and
4670 may therefore not be suitable if the coefficients of the constraints
4671 describing the polytope are large.
4673 \item \ai[\tt]{cdd}~\shortcite{cdd}
4675 This solver is based on exact integer arithmetic.
4676 Note that you need version \verb+cddlib 0.94e+ or newer.
4677 Earlier versions (\verb+0.93+--\verb+0.94d+) have
4678 a bug that may sometimes result in a polytope being
4679 reported as (rationally) empty even though it is not.
4681 \item \piplib/~\shortcite{Feautrier:PIP}
4683 This solver is also based on exact integer arithmetic
4684 and uses the \ai{dual simplex} method to solve a linear program.
4685 Two versions are available, \ai[\tt]{pip} will present the
4686 original program to \piplib/, while \ai[\tt]{pip-dual} will present
4687 the dual program to \piplib/, effectively having it apply the primal
4688 simplex method to the original problem.
4689 The latter may seem more appropriate since the computation
4690 of the reduced basis only requires the dual solution of
4691 any linear program. However, in practice, it appears
4692 that \ai[\tt]{pip} is often faster than \ai[\tt]{pip-dual}.
4693 \end{itemize}
4694 The LP solver to use can be selected with the \ai[\tt]{--gbr} option.
4697 \subsection{Computing the integer hull of a polyhedron}
4698 \label{s:integer:hull}
4700 For computing the \ai{integer hull} of a polyhedron,
4701 we first describe how to compute the convex hull of a set
4702 given as an oracle for optimizing a linear objective
4703 function over the set and then
4704 we explain how to optimize a linear objective function over
4705 the integer points of a polyhedron.
4706 Applying the first with the second as \ai{optimization oracle}
4707 yields a method for computing the requested integer hull.
4709 \subsubsection{Computing the convex hull based on an optimization oracle}
4711 The algorithm described below is presented by
4712 \shortciteN[Remark~2.5]{Cook1992} as an extension of the
4713 algorithm by \shortciteN[Section~3]{Edmonds82} for computing
4714 the {\em dimension} of a polytope for which only an optimization oracle
4715 is available. The algorithm is described in a bit more detail
4716 by \shortciteN{Eisenbrand2000PhD} and reportedly stems from
4717 \shortciteN{Hartmann1989PhD}.
4718 Essentially the same algorithm has also been implemented
4719 by \shortciteN{Huggins06}, citing
4720 \ai{beneath/beyond}~\shortcite{Preparata1985} as his inspiration.
4722 The algorithm start out from an initial set of points from
4723 the set $S$. After computing the convex hull of this set
4724 of points, we take one of its bounding constraints and use
4725 the optimization oracle
4726 to compute an optimal point in $S$ (but on the other side
4727 of the bounding hyperplane) along the
4728 outer normal of this bounding constraint.
4729 If a new point is found, it is added to the set of points
4730 and a new convex hull is computed, or the old one is adapted
4731 in a beneath/beyond fashion. Otherwise, the chosen bounding constraint
4732 is also a bounding constraint of $S$ and need not be considered anymore.
4733 The process continues until all bounding constraints in the
4734 description of the current convex hull have been considered.
4736 In principle, the initial set of points in the above algorithm
4737 may be empty, with a ``convex hull'' described by a set of
4738 conflicting constraints and each equality in the description of any
4739 intermediate lower-dimensional convex hull being considered
4740 as a pair of bounding constraints with opposite outer normals.
4741 However, in our implementation, we have chosen to first compute
4742 a maximal set of affinely independent points by first taking any
4743 point from $S$ and then adding points from $S$ not on one of
4744 the equalities satisfied by all points found so far.
4745 This allows us to not have to worry about equalities in the
4746 main algorithm.
4747 In the case of the computation of the integer hull, finding
4748 these affinely independent points can be accomplished using the technique of
4749 \autoref{s:feasibility}.
4751 \begin{figure}
4752 \intercol=0.58cm
4753 \begin{xy}
4754 <\intercol,0pt>:<0pt,\intercol>::
4755 \POS(-1,0)*\xybox{
4756 \def\latticebody{\POS="c"+(0,0.5)\ar@{--}"c"+(0,6.5)}%
4757 \POS0,{\xylattice{1}{6}00}%
4758 \def\latticebody{\POS="c"+(0.5,0)\ar@{--}"c"+(6.5,0)}%
4759 \POS0,{\xylattice00{1}6}%
4760 \POS@i@={(1.5,2.75),(5.75,2.25),(5.5,5.25),(2.75,4.75),(1.5,2.75)},
4761 {0*\xypolyline{}}
4762 \POS@i@={(2,3),(3,3),(3,4),(2,3)},{0*[|(3)]\xypolyline{}}
4763 \POS(2,3)*{\bullet}
4764 \POS(3,3)*{\bullet}
4765 \POS(3,4)*{\bullet}
4766 \POS(3,3.5)\ar(3.5,3.5)
4767 \POS(5,3)*{\circ}
4768 \POS(5,4)*{\circ}
4769 \POS(5,5)*{\circ}
4771 \POS(6,0)*\xybox{
4772 \def\latticebody{\POS="c"+(0,0.5)\ar@{--}"c"+(0,6.5)}%
4773 \POS0,{\xylattice{1}{6}00}%
4774 \def\latticebody{\POS="c"+(0.5,0)\ar@{--}"c"+(6.5,0)}%
4775 \POS0,{\xylattice00{1}6}%
4776 \POS@i@={(1.5,2.75),(5.75,2.25),(5.5,5.25),(2.75,4.75),(1.5,2.75)},
4777 {0*\xypolyline{}}
4778 \POS@i@={(2,3),(5,3),(3,4),(2,3)},{0*[|(3)]\xypolyline{}}
4779 \POS(2,3)*{\bullet}
4780 \POS(5,3)*{\bullet}
4781 \POS(3,4)*{\bullet}
4782 \POS(4,3.5)\ar(4.25,4)
4783 \POS(5,5)*{\circ}
4785 \POS(13,0)*\xybox{
4786 \def\latticebody{\POS="c"+(0,0.5)\ar@{--}"c"+(0,6.5)}%
4787 \POS0,{\xylattice{1}{6}00}%
4788 \def\latticebody{\POS="c"+(0.5,0)\ar@{--}"c"+(6.5,0)}%
4789 \POS0,{\xylattice00{1}6}%
4790 \POS@i@={(1.5,2.75),(5.75,2.25),(5.5,5.25),(2.75,4.75),(1.5,2.75)},
4791 {0*\xypolyline{}}
4792 \POS@i@={(2,3),(5,3),(5,5),(3,4),(2,3)},{0*[|(3)]\xypolyline{}}
4793 \POS(2,3)*{\bullet}
4794 \POS(5,3)*{\bullet}
4795 \POS(5,5)*{\bullet}
4796 \POS(3,4)*{\bullet}
4798 \end{xy}
4799 \caption{The integer hull of a polytope}
4800 \label{f:integer:hull}
4801 \end{figure}
4803 \begin{example}
4804 Assume we want to compute the integer hull of the polytope in the left part
4805 of \autoref{f:integer:hull}.
4806 We first compute a set of three affinely independent points,
4807 shown in the same part of the figure.
4808 Of the three facets of the corresponding convex hull,
4809 optimization along the outer normal (depicted by an arrow in the figure)
4810 of only one facet will yield any additional points. The other two
4811 are therefore facets of the integer hull.
4812 Optimization along the above outer normal may yield any of the
4813 points marked by a $\circ$.
4814 Assuming it is the bottom one, we end up with the updated
4815 convex hull in the middle of the figure. This convex hull
4816 has only one new facet. Adding the point found by optimizing
4817 over this facet's outer normal, we obtain the convex hull
4818 on the right of the figure.
4819 There are two new facets, but neither of them yields any
4820 further points. We have therefore found the integer hull
4821 of the polytope.
4822 \end{example}
4824 \subsubsection{Optimization over the integer points of a polyhedron}
4825 \label{s:optimization}
4827 We assume that we want to find the {\em minimum} of
4828 some linear objective function. When used in the computation
4829 of the integer hull of some polytope, the objective function
4830 will therefore correspond to the inner normal of some facet.
4832 During our search for an optimal integer point with respect
4833 to some objective function, we will keep track of the best
4834 point so far as well as a lower bound $l$
4835 and an upper bound $u$ such that the value at the optimal point
4836 (if it is better than the current best) lies between those
4837 two bounds.
4838 Initially, there is no best point yet and values for $l$ and $u$
4839 may be obtained from optimization over the linear relaxation.
4840 When used in the computation of the integer hull of some polytope,
4841 the upper bound $u$ is one less than the value attained on
4842 the given facet of the current approximation.
4844 As long as $l \le u$, we perform the following steps
4845 \begin{itemize}
4846 \item use the integer feasibility technique of \autoref{s:feasibility}
4847 to test whether there is any integer point with value in
4848 $[l,u']$, where $u'$ is
4849 \begin{itemize}
4850 \item $u$ if the previous test for an integer point did not produce a point
4851 \item $l+\floor{\frac{u-l-1}2}$
4852 if the previous test for an integer point {\em did\/} produce a point
4853 \end{itemize}
4854 \item if a point is found, then remember it as the current best
4855 and replace $u$ by the value at this point minus one,
4856 \item otherwise, replace $l$ by $u'+1$.
4857 \end{itemize}
4858 When used in the computation of the integer hull of some polytope,
4859 it is useful to not only keep track of the best point so far,
4860 but of all points found.
4861 These points will all lie outside of the current approximation
4862 of the integer hull and adding them all instead of just one,
4863 will typically get us to the complete integer hull quicker.
4865 \begin{figure}
4866 \intercol=0.7cm
4867 \begin{xy}
4868 <\intercol,0pt>:<0pt,\intercol>::
4869 \POS(0.5,0)\ar@{-}(16.5,0)
4870 \def\latticebody{\POS="c"+(0,-0.2)\ar@{--}"c"+(0,0.2)\POS"c"*++!D{\the\latticeA}}%
4871 \POS0,{\xylattice{1}{16}00}%
4872 \POS(6,0)*!C{\bullet}
4873 \POS(7,0)*{\bullet}
4874 \POS(8,0)*{\bullet}
4875 \POS(12,0)*{\bullet}
4876 \POS(13,0)*{\bullet}
4877 \POS(14,0)*{\bullet}
4878 \POS(15,0)*{\bullet}
4879 \POS(16,0)*{\bullet}
4880 \POS(1,-1)\ar@{-}(16,-1)
4881 \POS(8,-1)*{\bullet}
4882 \POS(1,-2)\ar@{-}(4,-2)
4883 \POS(5,-3)\ar@{-}(7,-3)
4884 \POS(6,-3)*{\bullet}
4885 \POS(4.9,-4)\ar@{-}(5.1,-4)
4886 \end{xy}
4887 \caption{The integer points of a polytope projected on an objective function}
4888 \label{f:hull:projected}
4889 \end{figure}
4891 \begin{example}
4892 \label{ex:hull:projected}
4893 Assume that the values of some objective function attained
4894 by the integer points of some polytope are as shown in
4895 \autoref{f:hull:projected} and assume we know that the optimal
4896 value lies between 1 and 16.
4897 In the first step we would look for a point attaining a value
4898 in the interval $[1,16]$. Suppose this yields a point attaining
4899 the value $8$ (second line of the figure). We record this point
4900 as the current best and update the search interval to $[1,7]$.
4901 In the second step, we look for a point attaining a value
4902 in the interval $[1,4]$, but find nothing and set the search interval
4903 to $[5,7]$.
4904 In the third step, we consider the interval $[5,7]$ and find
4905 a point attaining the value 6. We update the current best value
4906 and set the search interval to $[5,5]$.
4907 In the fourth step, we consider the interval $[5,5]$, find no
4908 points and update the interval to ``$[6,5]$''.
4909 Since the lower bound is now larger than the upper bound, the
4910 algorithm terminates, returning the best or all point(s) found.
4911 \end{example}
4914 \subsection{Computing the integer hull of a truncated cone}
4915 \label{s:hull:cone}
4917 In \autoref{s:width} we will need to compute the \ai{integer hull}
4918 of a cone with the origin removed ($C \setminus \{ \vec 0 \}$).
4920 \subsubsection{Using the Hilbert basis of the cone}
4922 As proposed by \shortciteN{Koeppe2007personal},
4923 one way of computing this integer hull is to first compute
4924 the \ai{Hilbert basis} of $C$ (see \autoref{s:hilbert})
4925 and to then remove from that Hilbert basis the points that
4926 are not vertices of the integer hull of $C \setminus \{ \vec 0 \}$.
4927 The Hilbert basis of $C$ is the minimal set of points
4928 $\vec b_i \in C \cap \ZZ^d$ such that every integer point
4929 $\vec x \in C \cap \ZZ^d$ can be written as a non-negative
4930 {\em integer} combination of the $\vec b_i$.
4931 The vertices $\vec v_j$ of the integer hull of $C \setminus \{ \vec 0 \}$
4932 are such that every integer point
4933 $\vec x \in (C \cap \ZZ^d) \setminus \{ \vec 0 \}$ can
4934 be written as s non-negative {\em rational} combination of $\vec v_j$.
4935 Clearly, any $\vec v_j$ is also a $\vec b_i$ since $\vec v_j$ can
4936 not be written as the sum of a (rational) convex combination of
4937 other integer points in $(C \cap \ZZ^d) \setminus \{ \vec 0 \}$
4938 and a non-negative combination of the extremal rays $\vec r_k$ of $C$.
4939 A fortiori, it can therefore not be written as an integer combination
4940 of other integer points in $C$.
4941 To obtain the $\vec v_j$ from the $\vec b_i$ we therefore simply
4942 need to remove first $(0,0)$ and then those $\vec b_i$ that are
4943 not an extremal ray and that {\em can} be written as a combination
4945 \vec b_i = \sum_{j \ne i} \vec \alpha_j \vec b_j + \sum_k \beta_k \vec r_k
4946 \qquad\text{with $\alpha_j, \beta_k \ge 0$ and $\sum_{j \ne i} \alpha_j = 1$}
4949 Since the $\vec r_k$ are also among the $\vec b_j$, this can
4950 be simplified to checking whether there exists a rational
4951 solution for $\vec \alpha_j$ to
4953 \vec b_i = \sum_{j \ne i} \vec \alpha_j \vec b_j
4954 \qquad\text{with $\alpha_j \ge 0$ and $\sum_{j \ne i} \alpha_j \ge 1$}
4958 \begin{figure}
4959 \intercol=1.1cm
4960 \begin{xy}
4961 <\intercol,0pt>:<0pt,\intercol>::
4962 \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{*}}
4963 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
4964 \POS0,{\xylattice{-0}{5}00}%
4965 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(5.5,0)}%
4966 \POS0,{\xylattice00{-4}5}%
4967 \POS0\ar(2,-3)
4968 \POS0\ar(3,4)
4969 \POS(2,-3)*{\bullet}
4970 \POS(3,4)*{\bullet}
4971 \POS(1,1)*{\bullet}
4972 \POS(1,-1)*{\bullet}
4973 \POS(1,0)*{\bullet}
4974 \POS(2,-3)*{\times}
4975 \POS(3,4)*{\times}
4976 \POS(1,1)*{\times}
4977 \POS(1,-1)*{\times}
4978 \end{xy}
4979 \caption{The Hilbert basis and the integer hull of a truncated cone}
4980 \label{f:hilbert:hull}
4981 \end{figure}
4983 \begin{example} \label{ex:hilbert:hull}
4984 Consider the cone
4986 C = \poshull \,\{(2,-3), (3,4)\}
4989 shown in Figure~\ref{f:hilbert:hull}.
4990 The Hilbert basis of this cone is
4991 $$\{(0,0),(2,-3),(3,4),(1,1),(1,-1),(1,0)\}.$$
4992 We have $(1,0) = \frac 1 2 (1,1) + \frac 1 2 (1,-1)$,
4993 while $(1,1)$ and $(1,-1)$ can not be written as
4994 overconvex combinations of the other $\vec b_i \ne \vec 0$.
4995 The vertices of the integer hull of $C \setminus \{ \vec 0 \}$
4996 are therefore
4997 $$\{(2,-3),(3,4),(1,1),(1,-1)\}.$$
4998 \end{example}
5000 \subsubsection{Using generalized basis reduction}
5001 \label{s:hull:cone:gbr}
5003 Another way of computing the integer hull of a truncated cone is to apply
5004 the method of \autoref{s:integer:hull}.
5005 In this case, the initial set of points will consist
5006 of (the smallest integer representatives of) the extremal rays
5007 of the cone, together with the extremal rays themselves.
5008 That is, if $C = \poshull \, \{ \vec r_j \}$ with
5009 $\vec r_j \in \ZZ^d$, then our initial approximation of the
5010 integer hull of $C \setminus \{ \vec 0 \}$ is
5012 \convhull \, \{ \vec r_j \} + \poshull \, \{ \vec r_j \}
5015 Furthermore, we need never consider any
5016 of the bounding constraints that are also bounding constraints
5017 of the original cone.
5018 When optimizing along the normal of any of the other facets, we can
5019 take the lower bound to be $1$. This will ensure that
5020 the origin is excluded, without excluding any other integer points.
5022 \begin{figure}
5023 \intercol=0.5cm
5024 \begin{xy}
5025 <\intercol,0pt>:<0pt,\intercol>::
5026 \POS(0,0)*\xybox{
5027 \POS@i@={(3,-4.5),(2,-3),(3,4),(4.125,5.5),(5.5,5.5),(5.5,-4.5)},{0*[grey]\xypolyline{*}}
5028 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
5029 \POS0,{\xylattice{-0}{5}00}%
5030 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(5.5,0)}%
5031 \POS0,{\xylattice00{-4}5}%
5032 \POS0\ar(2,-3)
5033 \POS0\ar(3,4)
5034 \POS(2,-3)*{\bullet}
5035 \POS(3,4)*{\bullet}
5036 \POS(1,1)*{\circ}
5038 \POS(8,0)*\xybox{
5039 \POS@i@={(3,-4.5),(2,-3),(1,1),(3,4),(4.125,5.5),(5.5,5.5),(5.5,-4.5)},{0*[grey]\xypolyline{*}}
5040 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
5041 \POS0,{\xylattice{-0}{5}00}%
5042 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(5.5,0)}%
5043 \POS0,{\xylattice00{-4}5}%
5044 \POS0\ar(2,-3)
5045 \POS0\ar(3,4)
5046 \POS(2,-3)*{\bullet}
5047 \POS(3,4)*{\bullet}
5048 \POS(1,1)*{\bullet}
5049 \POS(1,-1)*{\circ}
5051 \POS(16,0)*\xybox{
5052 \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{*}}
5053 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
5054 \POS0,{\xylattice{-0}{5}00}%
5055 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(5.5,0)}%
5056 \POS0,{\xylattice00{-4}5}%
5057 \POS0\ar(2,-3)
5058 \POS0\ar(3,4)
5059 \POS(2,-3)*{\bullet}
5060 \POS(3,4)*{\bullet}
5061 \POS(1,1)*{\bullet}
5062 \POS(1,-1)*{\bullet}
5064 \end{xy}
5065 \caption{The integer hull of a truncated cone}
5066 \label{f:cone:integer:hull}
5067 \end{figure}
5069 \begin{example}
5070 Consider once more the cone
5072 C = \poshull \,\{(2,-3), (3,4)\}
5074 from Example~\ref{ex:hilbert:hull}.
5075 The initial approximation is
5077 C = \convhull \,\{(2,-3), (3,4)\} + \poshull \,\{(2,-3), (3,4)\}
5080 which is shown on the left of \autoref{f:cone:integer:hull}.
5081 The only bounding constraint that does not correspond to a
5082 bounding constraint of $C$ is $7 x - y \ge 17$.
5083 In the first step, we will therefore look for a point
5084 minimizing $7 x - y$ with values in the interval $[1,16]$.
5085 All values of this objective function in the given interval
5086 attained by points in $C$ are shown in \autoref{f:hull:projected}.
5087 From Example~\ref{ex:hull:projected}, we know that the optimal
5088 value is $6$ and this corresponds to the point $(1,1)$.
5089 Adding this point to our hull, we obtain the approximation
5090 in the middle of \autoref{f:cone:integer:hull}.
5091 This approximation has two new facets.
5092 The bounding constraint $3x - 2 y \ge 1$ will not produce
5093 any new points since we would be looking for one in the
5094 interval ``$[1,0]$''.
5095 The other new bounding constraint is $4x + y \ge 5$.
5096 Minimizing $4 x+ y$ with values in the interval $[1,4]$,
5097 we find the minimal value $3$ corresponding to the point $(1,-1)$.
5098 Adding this point, we obtain the complete integer hull
5099 shown on the right of \autoref{f:cone:integer:hull}.
5100 Note that if in the first step we would have added not only
5101 the point corresponding to the optimal value, but instead
5102 all points found in Example~\ref{ex:hull:projected},
5103 then we would have obtained the complete integer hull directly.
5104 \end{example}
5107 \subsection{Computing the lattice width of a parametric polytope}
5108 \label{s:width}
5110 To compute the \ai{lattice width} of a \ai{parametric polytope},
5111 we essentially use the technique of \shortciteN{Eisenbrand2007parameterised},
5112 which improves upon the technique of \shortciteN{Kannan1992}.
5113 Given a parametric polytope
5115 P(\vec p) = \{\, \vec x \mid A \vec x + \vec b(\vec p) \ge \vec 0 \,\}
5118 the width along a direction $\vec c$ is defined in the same
5119 way as for non-parametric polytopes (see \autoref{s:feasibility}),
5120 \begin{equation}
5121 \label{eq:width}
5122 \width_{\vec c} P(\vec p)
5124 \max \{\, \sp c x \mid \vec x \in P(\vec p) \,\}
5126 \min \{\, \sp c x \mid \vec x \in P(\vec p) \,\}
5128 \end{equation}
5129 The \defindex{lattice width} is the minimum width over all
5130 non-zero integer directions:
5132 \width P(\vec p) =
5133 \min_{\vec c \in \ZZ^d \setminus \{ \vec 0 \} } \width_{\vec c} P(\vec p)
5136 We assume that the parameter domain $Q$ of $P(\vec p)$, i.e., the
5137 set of parameter values for which $P(\vec p) \ne \emptyset$,
5138 is full-dimensional and that for each $\vec p$ from the interior
5139 of $Q$, $P(\vec p)$ is also full-dimensional.
5141 Clearly, for any given direction $\vec c$, the minimum and
5142 maximum in \eqref{eq:width} are attained at (different)
5143 vertices of $P(\vec p)$.
5144 The idea of the algorithm is then to consider all pairs
5145 of parametric vertices of $P(\vec p)$, to compute all candidate
5146 integer directions for a given pair of vertices and then to
5147 compute the minimum width over all candidate integer directions
5148 found.
5150 For any given parametric vertex $\vec v(\vec p)$, the (rational)
5151 directions for which this vertex is minimal can be found as follows.
5152 Let $\vec v(\vec p) + C$ be the \ai{vertex cone} of $\vec v(\vec p)$.
5153 If $\vec v(\vec p)$ is minimal for $\vec c$, then all other points
5154 in the vertex cone must yield a bigger or equal value, i.e.,
5155 $\sp y c \ge 0$ for all $\vec y \in C$.
5156 The set of directions is therefore the \ai{polar cone} $C^*$ of $C$.
5157 Note that, in principle, we should only do this for pairs
5158 of vertices that have a common activity domain, where the
5159 activity domains have been partially opened using the
5160 technique of \autoref{p:inclusion-exclusion} to avoid
5161 multiple vertices that coincide on a lower-dimensional
5162 chamber to all be considered on this intersection.
5163 However, this optimization has currently not been implemented.
5165 Given a pair of vertices $\vec v_1(\vec p)$ and $\vec v_2(\vec p)$,
5166 we may assume that $\vec v_1(\vec p)$ attains the minimum and
5167 $\vec v_2(\vec p)$ attains the maximum.
5168 If $\vec v_1(\vec p) + C_1$ and $\vec v_2(\vec p) + C_2$ are the
5169 corresponding vertex cones, then the set of (rational) directions for this
5170 pair of vertices is
5172 C_{1,2} = \left( C_1^* \cap -C_2^* \right) \setminus \{ \vec 0 \}
5175 The set of candidate integer directions are therefore
5176 the vertices of the integer hull of $C_{1,2}$, which
5177 can be computed as explained in \autoref{s:hull:cone}.
5178 To see this, note that by construction
5179 $\sps {\vec c}{\vec v_1(\vec p)} \le \sps {\vec c}{\vec v_2(\vec p)}$
5180 and so
5182 w_{\vec c}(\vec p) = \width_{\vec c} P(\vec p)
5183 = \sps {\vec c}{\vec v_2(\vec p)-\vec v_1(\vec p)} \ge 0
5186 Any integer direction in $C_{1,2}$ will therefore yield
5187 a width that is at least as large as that of one
5188 of the vertices of the integer hull.
5189 Note that when using generalized basis reduction
5190 to compute the integer hull of these cones as in \autoref{s:hull:cone:gbr},
5191 it can be helpful to use as vertices for the initial approximation
5192 not only the extremal rays of the cone, but also those vertices
5193 of previously computed integer hulls that are elements of the current cone.
5195 After computing a list of all possible candidate width directions
5196 $\vec c_i$ and the corresponding widths $w_{\vec c_i}(\vec p)$,
5197 we keep only a single direction of all those that yield
5198 the same width (as an affine function of the parameters).
5199 Then we construct the chambers where each of the widths is minimal,
5200 i.e.,
5202 C_i = \{\, \vec p \in Q \mid \forall j :
5203 w_{\vec c_i}(\vec p) \le w_{\vec c_j}(\vec p) \,\}
5206 Note that many of the $C_i$ may be empty or of lower dimension
5207 than Q and that the other $C_i$ will intersect in common facets.
5208 To obtain a partition of partially-open full-dimensional chambers, we proceed
5209 as in \autoref{s:triangulation}.
5211 \begin{figure}
5212 \intercol=1.1cm
5213 \begin{xy}
5214 <\intercol,0pt>:<0pt,\intercol>::
5215 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
5216 \POS0,{\xylattice{-0}{10}00}%
5217 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(10.5,0)}%
5218 \POS0,{\xylattice00{-0}7}%
5219 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*[|(2)]\xypolyline{}}
5220 \POS(0,0)*{\bullet}
5221 \POS(5,3)*{\bullet}
5222 \POS(5,4)*{\bullet}
5223 \POS(9,6)*{\bullet}
5224 \POS(3,2)*{\bullet}
5225 \POS(4,3)*{\bullet}
5226 \POS(6,4)*{\bullet}
5227 \POS(7,5)*{\bullet}
5228 \POS(9,6);(8.7,6.4)**{}?(0)/1.1cm/="a"\POS(9,6)\ar"a"
5229 \POS(9,6);(9.1,5.8)**{}?(0)/1.1cm/="a"\POS(9,6)\ar"a"
5230 \POS(5,4);(5.4,3.5)**{}?(0)/1.1cm/="a"\POS(5,4)\ar"a"
5231 \POS(5,4);(5.1,3.8)**{}?(0)/1.1cm/="a"\POS(5,4)\ar"a"
5232 \POS(0,0);(0.4,-0.5)**{}?(0)/1.1cm/="a"\POS(0,0)\ar"a"
5233 \POS(0,0);(-0.3,0.5)**{}?(0)/1.1cm/="a"\POS(0,0)\ar"a"
5234 \POS(5,3);(4.7,3.5)**{}?(0)/1.1cm/="a"\POS(5,3)\ar"a"
5235 \POS(5,3);(4.7,3.4)**{}?(0)/1.1cm/="a"\POS(5,3)\ar"a"
5236 \POS(9,6)*+!DL{\vec v_1}
5237 \POS(0,0)*+!UR{\vec v_3}
5238 \POS(5,3)*+!UL{\vec v_4}
5239 \POS(5,4)*+!DR{\vec v_2}
5240 \end{xy}
5241 \caption{A polytope and its candidate width directions}
5242 \label{f:width}
5243 \end{figure}
5245 \begin{example} \label{ex:width}
5246 Consider the (non-parametric) polytope
5248 P = \left\{\,
5249 \vec x \mid
5250 \begin{aligned}
5251 -3 x_1 +5 x_2 &\ge 0 \\
5252 4 x_1 -5 x_2 &\ge 0 \\
5253 x_1 -2 x_2 + 3 &\ge 0 \\
5254 -3 x_1 +4 x_2 + 3 &\ge 0
5255 \end{aligned}
5256 \,\right\}
5258 shown in \autoref{f:width}. The polytope has four vertices
5260 \begin{aligned}
5261 \vec v_1 & = (9,6) \\
5262 \vec v_2 & = (5,4) \\
5263 \vec v_3 & = (0,0) \\
5264 \vec v_4 & = (5,3)
5266 \end{aligned}
5268 The corresponding cones of directions (for
5269 the given vertex to attain the minimum), also shown
5270 in \autoref{f:width} are
5272 \begin{aligned}
5273 C^*_1 & = \poshull \,\{ (-3,4), (1,-2) \} \\
5274 C^*_2 & = \poshull \,\{ (4,-5), (1,-2) \} \\
5275 C^*_3 & = \poshull \,\{ (4,-5), (-3,5) \} \\
5276 C^*_4 & = \poshull \,\{ (-3,5), (-3,4) \}
5278 \end{aligned}
5281 \begin{figure}
5282 \intercol=0.8cm
5283 \begin{xy}
5284 <\intercol,0pt>:<0pt,\intercol>::
5285 \def\latticebody{\POS="c"+(0,-6.5)\ar@{--}"c"+(0,2.5)}%
5286 \POS0,{\xylattice{-1}{5}00}%
5287 \def\latticebody{\POS="c"+(-1.5,0)\ar@{--}"c"+(5.5,0)}%
5288 \POS0,{\xylattice00{-6}2}%
5289 \POS0\ar@{->}(3,-4)\POS?!{(0,-6.5);(1,-6.5)}="a"
5290 \POS0\ar@{->}(-1,2)
5291 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
5292 \POS0\ar@{->}(1,-2)
5293 \POS@i@={"a",(3,-4),(4,-5),"b"},{0*[grey]\xypolyline{*}}
5294 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
5295 \POS0,{\ellipse(1)(*0;(2,1)*),^,(*0;(5,4)*){-}}
5296 \POS0\ar@{->}(3,-4)\POS?!{(0,-6.5);(1,-6.5)}="a"
5297 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
5298 \POS(4,-5)*{\bullet}
5299 \POS(3,-4)*{\bullet}
5300 \end{xy}
5301 \caption{The cone of directions $C_{2,1}$}
5302 \label{f:C:2:1}
5303 \end{figure}
5305 \begin{figure}
5306 \intercol=0.8cm
5307 \begin{xy}
5308 <\intercol,0pt>:<0pt,\intercol>::
5309 \def\latticebody{\POS="c"+(0,-6.5)\ar@{--}"c"+(0,5.5)}%
5310 \POS0,{\xylattice{-3}{5}00}%
5311 \def\latticebody{\POS="c"+(-3.5,0)\ar@{--}"c"+(5.5,0)}%
5312 \POS0,{\xylattice00{-6}5}%
5313 \POS0\ar@{->}(3,-4)
5314 \POS0\ar@{->}(-1,2)\POS?!{(0,5.5);(1,5.5)}="a"
5315 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
5316 \POS0\ar@{->}(-3,5)
5317 \POS@i@={"b",(4,-5),(1,-1),(-1,2),"a",(5.5,5.5),(5.5,-6.5)},{0*[grey]\xypolyline{*}}
5318 \POS0\ar@{->}(-1,2)\POS?!{(0,5.5);(1,5.5)}="a"
5319 \POS0\ar@{->}(4,-5)\POS?!{(0,-6.5);(1,-6.5)}="b"
5320 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
5321 \POS0,{\ellipse(1)(*0;(5,4)*),^,(*0;(-5,-3)*){-}}
5322 \POS(1,-1)*{\bullet}
5323 \POS(4,-5)*{\bullet}
5324 \POS(-1,2)*{\bullet}
5325 \end{xy}
5326 \caption{The cone of directions $C_{3,1}$}
5327 \label{f:C:3:1}
5328 \end{figure}
5330 \begin{figure}
5331 \intercol=0.8cm
5332 \begin{xy}
5333 <\intercol,0pt>:<0pt,\intercol>::
5334 \def\latticebody{\POS="c"+(0,-4.5)\ar@{--}"c"+(0,5.5)}%
5335 \POS0,{\xylattice{-3}{3}00}%
5336 \def\latticebody{\POS="c"+(-3.5,0)\ar@{--}"c"+(3.5,0)}%
5337 \POS0,{\xylattice00{-4}5}%
5338 \POS0\ar@{->}(3,-4)
5339 \POS0\ar@{->}(-1,2)
5340 \POS0,{\ellipse(1.1)(*0;(4,3)*),^,(*0;(-2,-1)*){-}}
5341 \POS0\ar@{->}(-3,5)
5342 \POS0\ar@{->}(-3,4)
5343 \POS0,{\ellipse(1)(*0;(-5,-3)*),^,(*0;(-4,-3)*){-}}
5344 \end{xy}
5345 \caption{The cone of directions $C_{4,1}$}
5346 \label{f:C:4:1}
5347 \end{figure}
5349 Let us now consider the directions in which
5350 $\vec v_2$ is minimal while $\vec v_1$ is maximal.
5351 We find
5353 C_{2,1} = \poshull \,\{ (4,-5), (3,-4) \} \setminus \{ \vec 0 \}
5356 as shown in \autoref{f:C:2:1}.
5357 The vertices of the integer hull of $C_{2,1}$ are $(4,-5)$
5358 and $(3,-4)$.
5359 The corresponding widths are
5361 \begin{aligned}
5362 \vec c_1 &= (4,-5) & w_{\vec c_1} &= 6 \\
5363 \vec c_2 &= (3,-4) & w_{\vec c_2} &= 4
5365 \end{aligned}
5367 We similarly find
5369 C_{3,1} = \poshull \,\{ (4,-5), (-1,2) \} \setminus \{ \vec 0 \}
5372 with integer hull
5373 $\poshull \,\{ (4,-5), (-1,2), (1,-1) \}$, shown
5374 in \autoref{f:C:3:1}, yielding
5376 \begin{aligned}
5377 \vec c_3 &= (4,-5) & w_{\vec c_3} &= 6 \\
5378 \vec c_4 &= (-1,2) & w_{\vec c_4} &= 3 \\
5379 \vec c_5 &= (1,-1) & w_{\vec c_5} &= 3
5381 \end{aligned}
5383 On the other hand,
5385 C_{4,1} = \emptyset
5388 as shown in \autoref{f:C:4:1} and so this combination
5389 does not yield any width direction candidates.
5390 The other pairs of vertices further yield
5392 \begin{aligned}
5393 \vec c_6 &= (-1,2) & w_{\vec c_6} &= 3 \\
5394 \vec c_7 &= (-3,5) & w_{\vec c_7} &= 5 \\
5395 \vec c_8 &= (-3,4) & w_{\vec c_8} &= 4 \\
5396 \vec c_9 &= (-3,5) & w_{\vec c_9} &= 5 \\
5397 \vec c_{10} &= (-2,3) & w_{\vec c_{10}} &= 3
5399 \end{aligned}
5401 Since the polytope under consideration is not parametric,
5402 there is only one (non-empty, $0$-dimensional) chamber and
5403 it corresponds to one of the directions, say $\vec c_4 = (-1,2)$,
5404 with width $3$ (the other directions with the same width
5405 having been removed).
5407 \begin{figure}
5408 \intercol=1.1cm
5409 \begin{xy}
5410 <\intercol,0pt>:<0pt,\intercol>::
5411 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
5412 \POS0,{\xylattice{-0}{10}00}%
5413 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(10.5,0)}%
5414 \POS0,{\xylattice00{-0}7}%
5415 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*[|(2)]\xypolyline{}}
5416 \POS(-0.5,-0.5)\ar@{.}(7.5,7.5)
5417 \POS(0.5,-0.5)\ar@{.}(8.5,7.5)
5418 \POS(1.5,-0.5)\ar@{.}(9.5,7.5)
5419 \POS(2.5,-0.5)\ar@{.}(10.5,7.5)
5420 \POS(-0.5,-0.25)\ar@{-}(10.5,5.25)
5421 \POS(-0.5,0.25)\ar@{-}(10.5,5.75)
5422 \POS(-0.5,0.75)\ar@{-}(10.5,6.25)
5423 \POS(-0.5,1.25)\ar@{-}(10.5,6.75)
5424 \POS(-0.25,-0.5)\ar@{--}(10.5,6.666)
5425 \POS(-0.5,-0.333)\ar@{--}(10.5,7)
5426 \POS(-0.5,0)\ar@{--}(10.5,7.333)
5427 \POS(-0.5,0.333)\ar@{--}(10.25,7.5)
5428 \POS(0,0)*{\bullet}
5429 \POS(5,3)*{\bullet}
5430 \POS(5,4)*{\bullet}
5431 \POS(9,6)*{\bullet}
5432 \POS(3,2)*{\bullet}
5433 \POS(4,3)*{\bullet}
5434 \POS(6,4)*{\bullet}
5435 \POS(7,5)*{\bullet}
5436 \end{xy}
5437 \caption{A polytope and its lattice width directions}
5438 \label{f:width:2}
5439 \end{figure}
5441 Each of the three directions that yield the minimal
5442 width of 3 is shown in \autoref{f:width:2}.
5443 \end{example}
5445 \begin{example} \label{ex:width:2}
5446 Consider the polytope
5448 P(p) = \left\{\,
5449 \vec x \mid
5450 \begin{aligned}
5451 -2 x_1 + p + 5 &\ge 0 \\
5452 2 x_1 + p + 5 &\ge 0 \\
5453 -2 x_2 - p + 5 &\ge 0 \\
5454 2 x_2 - p + 5 &\ge 0
5455 \end{aligned}
5456 \,\right\}
5458 from \shortciteN[Example~2.1.7]{Woods2004PhD}.
5459 The parametric vertices are
5461 \begin{aligned}
5462 \vec v_1(p) & = \left(\frac{p+5}2, \frac{-p+5}2\right) \\
5463 \vec v_2(p) & = \left(\frac{p+5}2, \frac{p-5}2\right) \\
5464 \vec v_3(p) & = \left(\frac{-p-5}2, \frac{-p+5}2\right) \\
5465 \vec v_4(p) & = \left(\frac{-p-5}2, \frac{p-5}2\right)
5467 \end{aligned}
5469 We find two essentially different candidate width directions
5471 \begin{aligned}
5472 \vec c_1 &= (0,1) & w_{\vec c_1}(p) &= 5-p \\
5473 \vec c_2 &= (1,0) & w_{\vec c_2}(p) &= 5+p
5475 \end{aligned}
5477 The first direction can be found by combining, say,
5478 $\vec v_1(p)$ and $\vec v_2(p)$, while the second direction can be
5479 found by combining, say, $\vec v_1(p)$ and $\vec v_3(p)$.
5480 The parameter domain for the parametric polytope $P(p)$ is
5482 Q = \{\, p \mid -5 \le p \le 5 \,\}
5485 The two (closed) chambers are therefore
5487 \begin{aligned}
5488 C_1 &= \{\, p \in Q \mid 5 - p \le 5+p \,\} \\
5489 C_2 &= \{\, p \in Q \mid 5 + p \le 5-p \,\}
5491 \end{aligned}
5493 To obtain a partition, \autoref{s:interior} gives
5494 the internal point $(0,0)$, which happens to meet
5495 the facets $p \ge 0$ and $-p \ge 0$. We therefore
5496 keep the facet with positive (inner) normal closed
5497 and open up the other facet. The result is
5499 \begin{aligned}
5500 \hat C_1 &= \{\, p \mid 0 \le p \le 5 \,\} \\
5501 \hat C_2 &= \{\, p \mid -5 \le p < 0 \,\}
5503 \end{aligned}
5505 Since we are usually only interested in integer parameter
5506 values, the latter chamber would become
5507 $\hat C_2 = \{\, p \mid -5 \le p \le -1 \,\}$.
5508 \end{example}
5510 Our description differs slightly from that of
5511 of \shortciteN{Eisenbrand2007parameterised}.
5512 First, they consider all pairs of basic solutions instead
5513 of all pairs of vertices, which means that they may
5514 consider basic solutions that are never feasible and that,
5515 in case of a non-simple polytope,
5516 they may consider the same parametric vertex more than once.
5517 The set of integer
5518 directions for a pair of vertices is the intersection of
5519 the sets of integer directions they obtain for each of
5520 the corresponding basic solutions.
5521 Second, they use a different method of creating a partition
5522 of partially-open chambers, which may lead to some lower-dimensional
5523 chambers surviving and hence to a larger total number of chambers.
5526 \subsection{Testing whether a set has an infinite number of points}
5527 \label{s:infinite}
5529 In some situations we are given the generating function of
5530 some integer set and we would like to know if the set is
5531 infinite or not. Typically, we want to know if the set
5532 is empty or not, but we cannot simply count the number of elements
5533 in the standard way since we may not have any guarantee that
5534 the set has only a finite number of elements.
5535 We will consider the slightly more general case where we are
5536 given a rational generating function $f(\vec x)$ of the form~\eqref{eq:rgf}
5537 such that
5538 \begin{equation}
5539 \label{eq:rgf:psp}
5540 f(\vec x) = \sum_{\vec s \in Q \cap \ZZ^d} c(\vec s)\, \vec x^{\vec s}
5541 \end{equation}
5542 converges on some nonempty open subset of $\CC^d$, $Q$ is a pointed
5543 polyhedron and $c(\vec s) \ge 0$,
5544 and we want to compute
5545 \begin{equation}
5546 \label{eq:psp:sum}
5547 S = \sum_{\vec s \in Q \cap \ZZ^d} c(\vec s)
5549 \end{equation}
5550 where the sum may diverge, i.e., ``$S = \infty$''.
5551 The following proposition shows that we can determine $S$
5552 in polynomial time.
5553 For a sketch of an alternative technique, see
5554 \shortciteN[Proof of Lemma~16]{Woods2005period}.
5556 \begin{proposition}
5557 Fix $d$ and $k$.
5558 Given a \rgf/ of the form~\eqref{eq:rgf} with $k_i \le k$
5559 and a pointed polyhedron $Q \subset \QQ^d$, then there is a
5560 polynomial time algorithm that determines for the corresponding
5561 function $c(\vec s)$~\eqref{eq:rgf:psp} whether the sum~\eqref{eq:psp:sum}
5562 diverges and computes the value of $S$~\eqref{eq:psp:sum} if it does not.
5563 \end{proposition}
5564 \begin{proof}
5565 Since $Q$ is pointed, the series~\eqref{eq:rgf:psp} converges on a neighborhood
5566 of $e^{\vec \ell} = (e^{\ell_1}, \ldots, e^{\ell_d})$ for any $\vec \ell$
5567 such that $\sps {\vec r_k} {\vec \ell} < 0$ for
5568 any (extremal) ray $\vec r_k$ of $Q$ and
5569 such that $\sps {\vec b_{i j}} {\vec \ell} \ne 0$ for any
5570 $\vec b_{i j}$ in~\eqref{eq:rgf}.
5571 Let $\vec \alpha = - \vec \ell$ and perform the substitution
5572 $\vec x = t^{\vec \alpha}$. The function $g(t) = f(t^{\vec \alpha})$
5573 is then also a (short) \rgf/ and
5575 g(t) = \sum_{k \in \sps {\vec\alpha} Q \cap \ZZ}
5576 \left(
5577 \sum_{\shortstack{$\scriptstyle \vec s \in Q \cap \ZZ^d$\\
5578 $\scriptstyle \sp \alpha s = k$}} c(\vec s)
5579 \right) t^k
5580 =: \sum_{k \in \sps {\vec\alpha} Q \cap \ZZ} d(k) \, t^k
5583 with $\sps {\vec\alpha} Q = \{ \sp \alpha x \mid \vec x \in Q \}$,
5584 converges in a neighborhood of $e^{-1}$, while
5586 S = \sum_{k \in \sps {\vec\alpha} Q \cap \ZZ} d(k)
5589 Since $c(\vec s) \ge 0$, we have $d(k) \ge 0$
5590 and the above sum diverges iff any of the coefficients of the
5591 negative powers of $t$ in the Laurent expansion of $g(t)$ is non-zero.
5592 If the sum converges, then the sum is simply the coefficient
5593 of the constant term in this expansion.
5595 It only remains to show now that we can compute a suitable $\vec \alpha$
5596 in polynomial time, i.e., an $\vec \alpha$ such that
5597 $\sps {\vec r_k} {\vec \alpha} > 0$ for any (extremal) ray $\vec r_k$ of $Q$ and
5598 $\sps {\vec b_{i j}} {\vec \alpha} \ne 0$ for any
5599 $\vec b_{i j}$ in~\eqref{eq:rgf}.
5600 By adding the $\vec r_k$ to the list of $\vec b_{i j}$ if needed, we can relax
5601 the first set of constraints to $\sps {\vec r_k} {\vec \alpha} \ge 0$.
5602 Let $Q$ be described by the constraints $A \vec x + \vec c \ge \vec 0$
5603 and let $B$ be $d \times d$ non-singular submatrix of $A$, obtained
5604 by removing some of the rows of $A$. Such a $B$ exists since
5605 $Q$ does not contain any straight line.
5606 Clearly, $B \vec r \ge \vec 0$ for any ray $\vec r$ of $Q$.
5607 Let $\vec b'_{i j} = B \vec b_{i j}$, then since $\vec b_{i j} \ne \vec 0$
5608 and B is non-singular, we have $\vec b'_{i j} \ne \vec 0$.
5609 We may therefore find in polynomial time a point $\vec \alpha' \ge \vec 0$
5610 on the ``\ai{moment curve}'' such that
5611 $\sps {\vec b'_{i j}} {\vec \alpha'} \ne 0$
5612 \shortcite[Algorithm~5.2]{Barvinok1999}.
5613 Let $\vec \alpha = B^\T \vec \alpha'$.
5614 Then
5616 \sps {\vec b_{i j}} {\vec \alpha}
5618 \sps {\vec b_{i j}} {B^\T \vec \alpha'}
5620 \sps {B \vec b_{i j}} {\vec \alpha'}
5622 \sps {\vec b'_{i j}} {\vec \alpha'}
5623 \ne 0
5627 \sps {\vec r_k} {\vec \alpha}
5629 \sps {\vec r_k} {B^\T \vec \alpha'}
5631 \sps {B \vec r_k} {\vec \alpha'}
5632 \ge 0
5635 as required.
5636 Note that in practice, we would, as usual, first try a
5637 fixed number of random vectors $\vec \alpha' \ge \vec 0$
5638 before resorting to looking for a point on the moment curve.
5639 \end{proof}
5642 \subsection{Enumerating integer projections of parametric polytopes}
5643 \label{s:projection}
5645 In this section we are interested in computing
5646 \begin{equation}
5647 \label{eq:count:projection}
5648 c(\vec s)=\#\left\{\vec t\in\ZZ^{d} \mid \exists \vec u\in\ZZ^{m}:
5649 (\vec s,\vec t,\vec u)\in P\right\}
5651 \end{equation}
5652 with $P \subset \QQ^{n}\times\QQ^{d}\times\QQ^{m}$ a rational
5653 pointed polyhedron such that
5655 P_{\vec s}=\left\{(\vec t,\vec u)\in\QQ^d\times\QQ^m
5656 \mid (\vec s,\vec t,\vec u)\in P\right\}
5658 is a polytope for any $\vec s$.
5659 This is equivalent to computing the number of points
5660 in the \ai{integer projection} of a parametric polytope
5662 c(\vec s)=\#\big(\pi(P_{\vec s}\cap\ZZ^{d+m})\big)
5665 with $\pi:\QQ^d\times\QQ^m\rightarrow\QQ^d$ defined by
5666 $\pi(\vec t, \vec u)=\vec t$.
5667 Exponential methods for computing $c(\vec s)$ are
5668 described by \shortciteN{Verdoolaege2005experiences}
5669 and \shortciteN{Seghir2006memory}.
5670 Here, we provide some implementation details for the polynomial
5671 method of \shortciteN[Theorem~1.7]{Woods2003short}, for
5672 computing the generating function, $\sum_{\vec s}c(\vec s) \, \vec x^{\vec s}$,
5673 which can then be converted into an explicit function $c(\vec s)$
5674 \shortcite[Corollary~1.11]{Verdoolaege2008counting}.
5675 Note that in contrast to \shortciteN[Theorem~1.7]{Woods2003short},
5676 we may allow $P$ to be an unbounded (but still pointed) polyhedron here
5677 (as long as $P_{\vec s}$ is bounded), since
5678 we replace their application of
5679 \shortciteN[Lemma~3.1]{Kannan1992}
5680 by \shortciteN[Theorem~5]{Eisenbrand2007parameterised}.
5682 If there is only one existentially quantified variable ($m = 1$),
5683 then computing~\eqref{eq:count:projection} is easy.
5684 You simply shift $P$ by $1$ in the $u$ direction and subtract
5685 this shifted copy from the original,
5687 D = P \setminus (\vec e_{n+d+1} + P)
5690 (See, e.g., \shortciteN[Figure~1, page~973]{Woods2003short}
5691 or \shortciteN[Figure~4.33, page~186]{Verdoolaege2005PhD}.)
5692 In the difference $D$ there will be {\em exactly} one value of $u$
5693 for each value of the remaining variables for which there was
5694 {\em at least} one value of $u$ in $P$,
5696 \forall (\vec s, \vec t):
5697 \quad
5698 \left(
5699 \exists u: (\vec s, \vec t, u) \in P
5700 \right)
5701 \iff
5702 \left(
5703 \exists! u: (\vec s, \vec t, u) \in D
5704 \right)
5707 The function $c(\vec s)$ can then be computed by counting
5708 the number of elements in $D(\vec s)$.
5709 These operations can be performed either in the space
5710 of (unions of) parametric polytopes or on generating functions.
5711 In the first case, $D(\vec s)$ can be written as a disjoint union
5712 of parametric polytopes that can be enumerated separately.
5713 In the second case, we first compute the generating function
5714 $f(\vec x, \vec y)$ of the set
5718 (\vec s, \vec t) \mid \exists u \in \ZZ : (\vec s, \vec t, u) \in P
5721 and then obtain the generating function $C(\vec x)$ of $c(\vec s)$
5722 as $C(\vec x) = f(\vec x, \vec 1)$.
5723 In the remainder of this section, we will concentrate on the
5724 computation of the generating function of $S$.
5725 To compute this generating function in the current case where
5726 there is only one existentially quantified variable, we first
5727 compute the generating function $g(\vec x, \vec y, z)$ of
5728 $P(\vec s, \vec t, u)$, perform operations on the generating function
5729 equivalent to the set operations (see, e.g.,
5730 \shortciteN[Section~4.5.3]{Verdoolaege2005PhD}), resulting
5731 in a generating function $g'(\vec x, \vec y, z)$, and then sum
5732 over all values (at most one for each value of $\vec s$
5733 and $\vec t$) of $u$, i.e., $f(\vec x, \vec y) = g'(\vec c, \vec y, 1)$.
5735 \begin{figure}
5736 \intercol=1.05cm
5737 \begin{xy}
5738 <\intercol,0pt>:<0pt,\intercol>::
5739 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
5740 \POS0,{\xylattice{-0}{10}00}%
5741 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(10.5,0)}%
5742 \POS0,{\xylattice00{-0}7}%
5743 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*\xypolyline{}}
5744 \POS(0,0)*[*0.333]\xybox{
5745 \POS@i@={(0,0),(5,3),(9,6),(5,4),(0,0)},{0*\xypolyline{--}}
5747 \POS(0,0)*{\bullet}
5748 \POS(5,3)*{\bullet}
5749 \POS(5,4)*{\bullet}
5750 \POS(9,6)*{\bullet}
5751 \POS(3,2)*{\bullet}
5752 \POS(4,3)*{\bullet}
5753 \POS(6,4)*{\bullet}
5754 \POS(7,5)*{\bullet}
5755 \POS(-1,-0.5)\ar@{-}(-1,7.5)
5756 \POS(-1,0)*{\bullet}
5757 \POS(-1,3)*{\bullet}
5758 \POS(-1,4)*{\bullet}
5759 \POS(-1,6)*{\bullet}
5760 \POS(-1,2)*{\bullet}
5761 \POS(-1,3)*{\bullet}
5762 \POS(-1,4)*{\bullet}
5763 \POS(-1,5)*{\bullet}
5764 \POS(-0.5,-1)\ar@{-}(10.5,-1)
5765 \POS(0,-1)*+++!UR{S}
5766 \POS(0,-1)*{\bullet}
5767 \POS(5,-1)*{\bullet}
5768 \POS(5,-1)*{\bullet}
5769 \POS(9,-1)*{\bullet}
5770 \POS(3,-1)*{\bullet}
5771 \POS(4,-1)*{\bullet}
5772 \POS(6,-1)*{\bullet}
5773 \POS(7,-1)*{\bullet}
5774 \end{xy}
5775 \caption{A polytope and its integer projections}
5776 \label{f:projection}
5777 \end{figure}
5779 If there is more than one existentially quantified variable ($m > 1$),
5780 then we can in principle apply the above shifting and subtracting
5781 technique recursively to obtain a generating function
5782 $f(\vec x, \vec y)$ for the set
5783 \begin{equation}
5784 \label{eq:projection:T}
5787 (\vec s, \vec t) \mid \exists \vec u \in \ZZ^m : (\vec s, \vec t, \vec u) \in P
5789 \end{equation}
5790 and then compute $C(\vec x) = f(\vec x, \vec 1)$.
5791 There are however some complications.
5792 Most notably, after applying the technique in one direction
5793 and projecting out the corresponding variable, the resulting set, i.e.,
5797 (\vec s, \vec t, u_1, \ldots, u_{m-1}) \mid
5798 \exists u_m \in \ZZ : (\vec s, \vec t, \vec u) \in P
5802 in general does not correspond to the integer points in some polytope.
5803 For example, assume that the polytope in \autoref{f:projection}
5804 contains the values of $\vec u$ associated to a particular
5805 value of $(\vec s, \vec t)$. Since there are integer points
5806 in this polytope, we should count this value of $\vec t$, but only once.
5807 If we apply the above technique in the vertical direction ($u_2$), then
5808 we can compute (a generating function for) the set $S$ shown
5809 on the bottom of the figure.
5810 Note, however, that there are ``gaps'' in this set, i.e.,
5811 if we compute $S \setminus (\vec e_{n+d+1} + S)$ then we will not
5812 end up with a single point (for this value of $(\vec s, \vec t)$).
5813 Since the biggest gap is three wide, we need
5814 to compute
5817 \setminus (\vec e_{n+d+1} + S)
5818 \setminus (2 \vec e_{n+d+1} + S)
5819 \setminus (3 \vec e_{n+d+1} + S)
5821 to obtain a single point.
5822 If we do the subtraction in the horizontal direction first,
5823 then we end up with a set (shown on the left) with gaps
5824 at most two wide, so afterwards we only need to subtract twice in the
5825 vertical direction.
5827 \begin{figure}
5828 \intercol=0.8cm
5829 \begin{xy}
5830 <\intercol,0pt>:<0pt,\intercol>::
5831 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,7.5)}%
5832 \POS0,{\xylattice{-0}{4}00}%
5833 \def\latticebody{\POS="c"+(-0.5,0)\ar@{--}"c"+(4.5,0)}%
5834 \POS0,{\xylattice00{-0}7}%
5835 \POS@i@={(0,0),(1,3),(3,6),(3,4),(0,0)},{0*\xypolyline{}}
5836 \POS(0,0)*{\bullet}
5837 \POS(1,3)*{\bullet}
5838 \POS(3,4)*{\bullet}
5839 \POS(3,6)*{\bullet}
5840 \POS(1,2)*{\bullet}
5841 \POS(2,3)*{\bullet}
5842 \POS(2,4)*{\bullet}
5843 \POS(3,5)*{\bullet}
5844 \POS(-0.5,-1)\ar@{-}(4.5,-1)
5845 \POS(0,-1)*+++!UR{S}
5846 \POS(0,-1)*{\bullet}
5847 \POS(1,-1)*{\bullet}
5848 \POS(2,-1)*{\bullet}
5849 \POS(3,-1)*{\bullet}
5850 \end{xy}
5851 \caption{A transformed polytope and its integer projection}
5852 \label{f:projection:2}
5853 \end{figure}
5855 In general, there is no bound on the widths of the gaps we may
5856 encounter in any given direction. However, there are directions
5857 in which the gaps are known to be ``small''.
5858 In particular, if the dimension $m$ is fixed, then the lattice width
5859 (see \autoref{s:width}) of lattice point free polytopes
5860 is bounded by a constant $\omega(m)$%
5861 ~\shortcite{Lagarias90,Barvinok02,Banaszczyk1999flatness}.
5862 This means that in the direction of the lattice width of a polytope,
5863 the gaps will be not be larger than $\omega(m)$
5864 \shortcite[Theorem~4.3]{Woods2003short}.
5865 Otherwise, we would be able to put a (uniformly) scaled down version
5866 of the polytope in the gap and it would contain no lattice points,
5867 which would contradict the fact that its lattice width is bounded
5868 by $\omega(m)$.
5869 \autoref{f:projection} contains such a scaled down copy
5870 of the original polytope. However, neither the horizontal
5871 nor the vertical direction is a lattice width direction
5872 of this polytope. The actual lattice width of this
5873 polytope was computed in Example~\ref{ex:width} as $3$
5874 with corresponding direction $\vec c = (-1,2)$.
5875 \autoref{f:projection:2} shows the result of applying
5876 the unimodular transformation
5878 \begin{bmatrix}
5879 -1 & 2 \\
5880 0 & 1
5881 \end{bmatrix}
5883 to the polytope. Note that the horizontal direction
5884 now has gaps of width at most 1. After shifting, subtracting
5885 and projecting in the vertical direction, we therefore
5886 end up with a set $S$ with gaps of width 1 and we then
5887 only have to shift and subtract once in the remaining
5888 (horizontal) direction.
5890 In fact, for two-dimensional polytopes the gaps in the lattice
5891 width direction will always be one, as shown by the following lemma.
5892 \begin{lemma}
5893 \label{l:gap}
5894 For any rational polygon, the gaps in a lattice
5895 width direction are of width at most 1.
5896 \end{lemma}
5897 \begin{proof}
5898 We may assume that $x$ is the given lattice width direction of
5899 a given polygon $P$.
5900 If there is a gap of width 2, then there is an integer value $x_1$ of $x$
5901 such that
5902 $P \cap \{\, (x_1, y) \,\} \ne \emptyset$,
5903 $P \cap \{\, (x_1+2, y) \,\} \ne \emptyset$,
5904 while
5905 $P \cap \{\, (x_1+1, y) \,\} \cap \ZZ^2 = \emptyset$.
5906 Using \shortciteN[Lemma~4.2]{Woods2003short}, we can put
5907 a scaled down copy $P'$ of $P$ between $x=x_1$ and $x=x_1+2$
5908 (and inside of $P$).
5909 $P'$ meets the line $x=x_1+1$ between two consecutive integer
5910 points, $y_1$ and $y_1+1$. Let $P''$ be the polygon bounded by $x=x_1$ and
5911 $x=x_1+2$ and two lines that separate $P'$ from these two
5912 integer points.
5913 $P''$ will have the same width (2) in the
5914 $x$ direction, while $P' \subset P''$.
5915 The $x$ direction is therefore also a lattice width direction of $P''$.
5916 $P''$ cannot intersect both $x=x_1$ and $x=x_1+2$ in a segment of
5917 length greater than or equal to $1$.
5918 Otherwise, it would also intersect $x=x_1+1$ in a segment of length
5919 greater than or equal to $1$.
5921 We may therefore assume that the length of the intersection
5922 of $P''$ with $x=x_1$ is smaller than $1$.
5923 If this line segment contains an integer point, then call it $y_2$.
5924 Otherwise, let $y_2$ be the greatest integer smaller than the
5925 points in the line segment.
5926 We may assume that $y_1 = y_2$.
5927 Otherwise, we can apply the unimodular transformation
5929 \begin{bmatrix}
5930 x \\
5932 \end{bmatrix}
5934 \begin{bmatrix}
5935 1 & 0 \\
5936 y_1 - y_2 & 1
5937 \end{bmatrix}
5938 \begin{bmatrix}
5939 x \\
5941 \end{bmatrix}
5944 without changing the width in direction $x$.
5945 If $P''$ contains $(x_1, y_1)$, it intersects $x=x_1$
5946 in a segment $[y_1-\alpha_1, y_1+\alpha_2]$.
5947 We may then similarly assume that $\alpha_2 \ge \alpha_1$.
5948 $P''$ will only cut $x=x_1+2$ in points with $y$-coordinate
5949 smaller than $2-\alpha_2$. The width in the $y$ direction
5950 will therefore be smaller than $2-\alpha_2+\alpha_1 \le 2$,
5951 contradicting that $x$ is a lattice width direction.
5952 If $P''$ does not contain $(x_1, y_1)$, then it only
5953 intersects $x=x_1$ in points with $y$-coordinate $y_1+\alpha$
5954 with $0 < \alpha < 1$. Given any such point, it is clear
5955 that $P''$ intersects $x=x_1+2$ only in points with $y$-coordinate
5956 strictly between $y_1-\alpha$ and $y_1+1-\alpha$, again
5957 showing that the width in the $y$ direction is smaller than $2$ and
5958 leading to the same contradiction.
5959 The contradiction shows that there can be no gaps
5960 of width 2 in the lattice width direction of $P$.
5961 \end{proof}
5962 Note that the $\omega(2)$ bound is too coarse to reach
5963 the above conclusion as $\omega(2) > 2$.
5964 An example of a polygon with lattice with greater than $2$ is the polygon
5965 with vertices $(-17/110,83/110)$, $(2/10,-9/10)$ and $(177/90, 100/90)$,
5966 shown in \autoref{f:empty:width:2}, which has width $221/110$.
5968 \begin{figure}
5969 \intercol=3cm
5970 \begin{xy}
5971 <\intercol,0pt>:<0pt,\intercol>::
5972 \def\latticebody{\POS="c"+(0,-1.5)\ar@{--}"c"+(0,1.5)}%
5973 \POS0,{\xylattice{-1}{2}00}%
5974 \def\latticebody{\POS="c"+(-1.5,0)\ar@{--}"c"+(2.5,0)}%
5975 \POS0,{\xylattice00{-1}1}%
5976 \POS@i@={(-0.1545,0.7545),(0.2,-0.9),(1.966,1.111),(-0.1545,0.74545)},{0*\xypolyline{}}
5977 \end{xy}
5978 \caption{Lattice point free polygon with lattice width 2}
5979 \label{f:empty:width:2}
5980 \end{figure}
5982 The idea of the projection algorithm
5983 is now to first find a direction in which the gaps
5984 are expected to be small and to unimodularly transform
5985 the existentially quantified variables such that this direction
5986 lies in the direction of one of the transformed variables.
5987 Then, the remaining existentially quantified variables are
5988 projected out by applying the technique recursively.
5989 The resulting generating function will have gaps at most
5990 $\omega(m)$ wide and so we have to subtract at most
5991 $\omega(m)$ shifted copies of this generating function
5992 before we can plug in 1 to project out the selected
5993 (and now only remaining) existentially quantified variable.
5994 We now look at each of these step in a bit more detail.
5996 We are given a polyhedron $P$ such that $P_{\vec s}$ is a polytope
5997 and we want to compute a generating function $f(\vec x, \vec y)$
5998 for the set $T$ in~\eqref{eq:projection:T}.
5999 We first compute the lattice width directions of
6000 the $m$-dimensional parametric polytope $P_{\vec s, \vec t}$
6001 as in \autoref{s:width}.
6002 The result is a partition of the parameter domain, i.e.,
6003 the projection of $P$ onto the first $n+d$ coordinates,
6004 into partially open polyhedra $Q_i$, together with
6005 the lattice width direction $\vec c_i$ corresponding to each $Q_i$.
6006 Since the generating functions only encode integer points,
6007 we can replace each open facet $\sp a x + b > 0$ by the closed
6008 facet $\sp a x + b - 1 \ge 0$ to obtain a collection of closed
6009 polyhedra $\tilde Q_i$. Now let
6011 P_i = P \cap \tilde Q_i \times \QQ^m
6013 and let $f_i(\vec x, \vec y)$ be the generating function of the set
6015 T_i =
6017 (\vec s, \vec t) \mid
6018 \exists \vec u \in \ZZ^m : (\vec s, \vec t, \vec u) \in P_i
6022 Then clearly,
6024 f(\vec x, \vec y) = \sum_i f_i(\vec x, \vec y)
6027 From now on, we will consider a particular $P_i$ with corresponding
6028 lattice width $\vec c_i$ and drop the $i$ subscript.
6030 We are now given a polyhedron $P$ such that the lattice width
6031 direction of $P_{\vec s, \vec t}$ is $\vec c$.
6032 We first extend $\vec c$ to an $m \times m$ unimodular matrix $U$
6033 using the technique of \autoref{s:completion},
6037 \begin{bmatrix}
6038 \vec c^\T
6041 \end{bmatrix}
6043 and then compute
6045 P' =
6046 \begin{bmatrix}
6047 I_n & 0 & 0 \\
6048 0 & I_d & 0 \\
6049 0 & 0 & U
6050 \end{bmatrix}
6054 We have
6058 (\vec s, \vec t) \mid
6059 \exists \vec u' \in \ZZ^m : (\vec s, \vec t, \vec u') \in P'
6063 i.e., we may have changed the values of the existentially
6064 quantified variables, but we have not changed the set $T$.
6065 Now consider the set
6067 T' =
6069 (\vec s, \vec t, u_1') \mid
6070 \exists (u_2',\ldots,u_m') \in \ZZ^{m-1} :
6071 (\vec s, \vec t, \vec u') \in P'
6075 This set has only $m-1$ existentially quantified variables, so
6076 we may apply this projection algorithm recursively and obtain
6077 the generating function $f'(\vec x, \vec y, z)$ for $T'$.
6078 The set $T'$ may no longer correspond to the integer points
6079 in a polytope, but, by construction, the gaps in the final
6080 coordinate are small ($\le \omega(m)$).
6082 By now we have a generating function $f'(\vec x, \vec y, z)$
6083 for the set $T'$ (with small
6084 gaps in the final coordinate) and we have to compute the
6085 generating function $f(\vec x, \vec y)$ for $T$.
6086 By computing
6087 \begin{equation}
6088 \label{eq:projection:omega}
6089 f''(\vec x, \vec y, z) =
6090 f'(\vec x, \vec y, z) \bigoplus_{k=1}^{\floor{\omega(m)}}
6091 \left( z^k f'(\vec x, \vec y, z) \right)
6093 \end{equation}
6094 where $\oplus$ represents the operation on generating functions
6095 that corresponds to set difference on the corresponding sets,
6096 we obtain a generating for the set $T''$ where only
6097 the smallest value of $u_1'$ is retained.
6098 The total number of $u_1'$s associated to any $(\vec s, \vec t)$
6099 is therefore either zero or one and so the ``multiset'' defined
6100 by taking as many copies of $(\vec s, \vec t)$ as there are
6101 associated values of $u_1'$ is actually the set $T$.
6102 That is
6104 f(\vec x, \vec y) = f''(\vec x, \vec y, 1)
6108 The only remaining problem is that the ``$\oplus$'' operation
6109 in~\eqref{eq:projection:omega} is fairly expensive.
6110 In particular, this operation is performed by first
6111 computing the \ai{Hadamard product} of the two generating functions
6112 (which corresponds to the intersection of the sets) and
6113 then subtracting the resulting generating function from this
6114 first generating function.
6115 The last operation is fairly cheap, but the Hadamard product
6116 has a time complexity which while polynomial if the dimension (in
6117 this case the maximum of $k_i$ in~\eqref{eq:rgf}) is fixed,
6118 is exponential in this dimension.
6119 Furthermore, this dimension increases by $\max k_i - d$ on each
6120 successive application of the Hadamard product, while $\max k_i > d$
6121 as soon as some projection is performed, which certainly happens in the
6122 recursive application of the algorithm.
6123 Now, the total number of Hadamard products is bounded by a constant
6124 $\floor{\omega(m)}$ and so the increase in dimension is also bounded
6125 by a constant, so the whole operation is still polynomial for
6126 fixed dimension.
6127 Nevertheless, we do not want to perform any additional Hadamard
6128 products if we do not really have to.
6129 That is, we would like to be able to detect when we can stop
6130 performing these operations {\em before} reaching the upper
6131 bound $\floor{\omega(m)}$.
6133 Let $f'_0(\vec x, \vec y, z) = f'(\vec x, \vec y, z)$ and
6134 let $f'_k(\vec x, \vec y, z)$ be the result of applying
6135 the ``set difference'' in~\eqref{eq:projection:omega} $k$ times.
6136 Denote the corresponding sets by $T'_0$ and $T'_k$.
6137 We want to find the smallest $k$ such that
6138 $f''(\vec x, \vec y, z) = f'_k(\vec x, \vec y, z)$.
6139 Note that we are talking about equality of rational functions here.
6140 Any further application of the set difference operation will
6141 not change this rational function, but it {\em will\/} typically
6142 produce a different (more complex) representation.
6143 To check whether the current $k$ is sufficient, we are going to
6144 count how many times any element of $T'_k$ still appears in a
6145 shifted copy of $T'_0$, with shift greater than or equal to $k+1$.
6146 If this number is zero, any further set difference will have no effect.
6147 That is, we want to compute
6149 \sum_{l=k+1}^\infty
6150 \left|
6151 T'_l \cap \left(\vec e_{n+d+1} + T' \right)
6152 \right|
6155 or, in terms of generating functions,
6157 h(\vec x, \vec y, z) = \sum_{l=k+1}^\infty
6158 f_k'(\vec x, \vec y, z) \star z^l \, f'(\vec x, \vec y, z)
6161 We should point out here that while the Hadamard product ($\star$)
6162 corresponds to intersection when applied to generator functions
6163 of indicator functions (i.e., with coefficients one or zero),
6164 in general it will produce a generating function with coefficients
6165 that are the product of the corresponding coefficients in the two
6166 operands.
6167 We can therefore rewrite the above equation as
6169 \begin{aligned}
6170 h(\vec x, \vec y, z) & = \sum_{l=k+1}^\infty
6171 f_k'(\vec x, \vec y, z) \star z^l \, f'(\vec x, \vec y, z)
6173 & = f_k'(\vec x, \vec y, z) \star
6174 \left(
6175 \sum_{l=k+1}^\infty z^l \, f'(\vec x, \vec y, z)
6176 \right)
6178 & = f_k'(\vec x, \vec y, z) \star
6179 \frac{z^{k+1} \, f'(\vec x, \vec y, z)}{1-z}
6181 \end{aligned}
6183 Computing $h(\vec x, \vec y, 1)$ would give us a generating
6184 function with as coefficients how many times a point of $T'_k$
6185 still appears in a shifted copy of $T'_0$ for any particular
6186 value of $\vec s$ and $\vec t$.
6187 However, we want to know if this number is zero for {\em all\/}
6188 values of $\vec s$ and $\vec t$, so we compute $h(\vec 1, \vec 1, 1)$
6189 instead. We have to be careful here since we allow the polyhedron
6190 $P$ to be unbounded and so we should apply the technique
6191 of \autoref{s:infinite} with $Q$ the projection of $P$ on
6192 the remaining coordinates.
6194 Note that testing whether we can stop is more expensive
6195 than applying the next iteration (since we have an extra
6196 $(1-z)$ factor in the denominator of one of the operands).
6197 However, we may save many iterations by stopping early
6198 and we will not needlessly replace a given representation
6199 of $f''(\vec x, \vec y, z)$ by a more complex representation
6200 (with more factors in the denominator).
6201 An alternative way of checking whether we can stop is to
6202 test whether $f'_k(\vec x, \vec y, z) = f'_{k+1}(\vec x, \vec y, z)$
6203 (as rational functions).
6204 To do so, we would need to check that both
6206 f'_k(\vec x, \vec y, z) -
6207 \left( f'_k(\vec x, \vec y, z) \star f'_{k+1}(\vec x, \vec y, z) \right)
6211 f'_{k+1}(\vec x, \vec y, z) -
6212 \left( f'_k(\vec x, \vec y, z) \star f'_{k+1}(\vec x, \vec y, z) \right)
6214 are zero and this Hadamard product is more expensive than
6215 the one above.
6217 \begin{figure}
6218 \intercol=1.05cm
6219 \begin{xy}
6220 <\intercol,0pt>:<0pt,\intercol>::
6221 \def\latticebody{\POS="c"+(0,-5.5)\ar@{--}"c"+(0,5.5)}%
6222 \POS0,{\xylattice{-5}{5}00}%
6223 \def\latticebody{\POS="c"+(-5.5,0)\ar@{--}"c"+(5.5,0)}%
6224 \POS0,{\xylattice00{-5}5}%
6225 \POS(0,-5.5)\ar(0,5.5) \POS(0,5.5)*+!UL{x_2}
6226 \POS(-5.5,0)\ar(5.5,0) \POS(5.5,0)*+!DR{x_1}
6227 \POS@i@={(-5,0),(5,0)},{0*[|(2)]\xypolyline{}}
6228 \POS@i@={(-4.5,0.5),(4.5,0.5),(4.5,-0.5),(-4.5,-0.5),(-4.5,0.5)},{0*[|(2)]\xypolyline{}}
6229 \POS@i@={(-4,1),(4,1),(4,-1),(-4,-1),(-4,1)},{0*[|(2)]\xypolyline{}}
6230 \POS@i@={(-3.5,1.5),(3.5,1.5),(3.5,-1.5),(-3.5,-1.5),(-3.5,1.5)},{0*[|(2)]\xypolyline{}}
6231 \POS@i@={(-3,2),(3,2),(3,-2),(-3,-2),(-3,2)},{0*[|(2)]\xypolyline{}}
6232 \POS@i@={(-2.5,2.5),(2.5,2.5),(2.5,-2.5),(-2.5,-2.5),(-2.5,2.5)},{0*[|(2)]\xypolyline{}}
6233 \POS@i@={(-2,3),(2,3),(2,-3),(-2,-3),(-2,3)},{0*[|(2)]\xypolyline{}}
6234 \POS@i@={(-1.5,3.5),(1.5,3.5),(1.5,-3.5),(-1.5,-3.5),(-1.5,3.5)},{0*[|(2)]\xypolyline{}}
6235 \POS@i@={(-1,4),(1,4),(1,-4),(-1,-4),(-1,4)},{0*[|(2)]\xypolyline{}}
6236 \POS@i@={(-0.5,4.5),(0.5,4.5),(0.5,-4.5),(-0.5,-4.5),(-0.5,4.5)},{0*[|(2)]\xypolyline{}}
6237 \POS@i@={(0,-5),(0,5)},{0*[|(2)]\xypolyline{}}
6238 \POS(-5,0)*+!DR{5}
6239 \POS(-4.5,0.5)*+!DR{4}
6240 \POS(-4,1)*+!DR{3}
6241 \POS(-3.5,1.5)*+!DR{2}
6242 \POS(-3,2)*+!DR{1}
6243 \POS(-2.5,2.5)*+!DR{0}
6244 \POS(-2,3)*+!DR{-1}
6245 \POS(-1.5,3.5)*+!DR{-2}
6246 \POS(-1,4)*+!DR{-3}
6247 \POS(-0.5,4.5)*+!DR{-4}
6248 \POS(-0,5)*+!DR{-5}
6249 \end{xy}
6250 \caption{The parametric polytope from Example~\ref{ex:projection}
6251 for different values of the parameter}
6252 \label{f:ex:projection}
6253 \end{figure}
6255 \begin{example} \label{ex:projection}
6256 Consider once more the parametric polytope
6258 P(p) = \left\{\,
6259 \vec x \mid
6260 \begin{aligned}
6261 -2 x_1 + p + 5 &\ge 0 \\
6262 2 x_1 + p + 5 &\ge 0 \\
6263 -2 x_2 - p + 5 &\ge 0 \\
6264 2 x_2 - p + 5 &\ge 0
6265 \end{aligned}
6266 \,\right\}
6268 from \shortciteN[Example~2.1.7]{Woods2004PhD}
6269 and Example~\ref{ex:width:2} and assume we want to
6270 compute
6272 c(p) = \left[ \exists \vec x \in \ZZ^2: (p, \vec x) \in P \right]
6275 That is, we simply want to know for which values of $p$
6276 the polytope is non-empty.
6277 Now, there are more efficient ways of answering this particular question,
6278 but we will use it here as an example of the above algorithm.
6279 The polytope $P(p)$ is shown in \autoref{f:ex:projection} for
6280 all integer value of the parameter for which the polytope
6281 is non-empty.
6283 \begin{figure}
6284 \intercol=1.05cm
6285 \begin{xy}
6286 <\intercol,0pt>:<0pt,\intercol>::
6287 \def\latticebody{\POS="c"+(0,-5.5)\ar@{--}"c"+(0,5.5)}%
6288 \POS0,{\xylattice{-5}{5}00}%
6289 \def\latticebody{\POS="c"+(-5.5,0)\ar@{--}"c"+(5.5,0)}%
6290 \POS0,{\xylattice00{-5}5}%
6291 \POS(0,-5.5)\ar(0,5.5) \POS(0,5.5)*+!UL{x_2}
6292 \POS(-5.5,0)\ar(5.5,0) \POS(5.5,0)*+!DR{x_1}
6293 \POS@i@={(-2.5,2.5),(2.5,2.5),(2.5,-2.5),(-2.5,-2.5),(-2.5,2.5)},{0*[|(2)]\xypolyline{}}
6294 \POS@i@={(-2,3),(2,3),(2,-3),(-2,-3),(-2,3)},{0*[|(2)]\xypolyline{}}
6295 \POS@i@={(-1.5,3.5),(1.5,3.5),(1.5,-3.5),(-1.5,-3.5),(-1.5,3.5)},{0*[|(2)]\xypolyline{}}
6296 \POS@i@={(-1,4),(1,4),(1,-4),(-1,-4),(-1,4)},{0*[|(2)]\xypolyline{}}
6297 \POS@i@={(-0.5,4.5),(0.5,4.5),(0.5,-4.5),(-0.5,-4.5),(-0.5,4.5)},{0*[|(2)]\xypolyline{}}
6298 \POS@i@={(0,-5),(0,5)},{0*[|(2)]\xypolyline{}}
6299 \POS(-2.5,2.5)*+!DR{0}
6300 \POS(-2,3)*+!DR{1}
6301 \POS(-1.5,3.5)*+!DR{2}
6302 \POS(-1,4)*+!DR{3}
6303 \POS(-0.5,4.5)*+!DR{4}
6304 \POS(-0,5)*+!DR{5}
6305 \POS(0,-11.5)*\xybox{
6306 \def\latticebody{\POS="c"+(0,-0.5)\ar@{--}"c"+(0,5.5)}%
6307 \POS0,{\xylattice{-5}{5}00}%
6308 \def\latticebody{\POS="c"+(-5.5,0)\ar@{--}"c"+(5.5,0)}%
6309 \POS0,{\xylattice00{0}5}%
6310 \POS(0,-0.5)\ar(0,5.5) \POS(0,5.5)*+!UR{p}
6311 \POS(-5.5,0)\ar(5.5,0) \POS(5.5,0)*+!UR{x_1}
6312 \POS(-2,0)*{\bullet}
6313 \POS(-1,0)*{\bullet},*+!DL{1}
6314 \POS(-0,0)*{\bullet},*+!DL{2}
6315 \POS(1,0)*{\bullet},*+!DL{3}
6316 \POS(2,0)*{\bullet},*+!DL{4}
6317 \POS(3,0)*+!DL{5}
6318 \POS(4,0)*+!DL{5}
6319 \POS(5,0)*+!DL{5}
6320 \POS(-2,1)*{\bullet}
6321 \POS(-1,1)*{\bullet},*+!DL{1}
6322 \POS(-0,1)*{\bullet},*+!DL{2}
6323 \POS(1,1)*{\bullet},*+!DL{3}
6324 \POS(2,1)*{\bullet},*+!DL{4}
6325 \POS(3,1)*+!DL{5}
6326 \POS(4,1)*+!DL{5}
6327 \POS(5,1)*+!DL{5}
6328 \POS(-1,2)*{\bullet}
6329 \POS(-0,2)*{\bullet},*+!DL{1}
6330 \POS(1,2)*{\bullet},*+!DL{2}
6331 \POS(2,2)*+!DL{3}
6332 \POS(3,2)*+!DL{3}
6333 \POS(4,2)*+!DL{3}
6334 \POS(5,2)*+!DL{3}
6335 \POS(-1,3)*{\bullet}
6336 \POS(-0,3)*{\bullet},*+!DL{1}
6337 \POS(1,3)*{\bullet},*+!DL{2}
6338 \POS(2,3)*+!DL{3}
6339 \POS(3,3)*+!DL{3}
6340 \POS(4,3)*+!DL{3}
6341 \POS(5,3)*+!DL{3}
6342 \POS(-0,4)*{\bullet}
6343 \POS(1,4)*+!DL{1}
6344 \POS(2,4)*+!DL{1}
6345 \POS(3,4)*+!DL{1}
6346 \POS(4,4)*+!DL{1}
6347 \POS(5,4)*+!DL{1}
6348 \POS(-0,5)*{\bullet}
6349 \POS(1,5)*+!DL{1}
6350 \POS(2,5)*+!DL{1}
6351 \POS(3,5)*+!DL{1}
6352 \POS(4,5)*+!DL{1}
6353 \POS(5,5)*+!DL{1}
6354 \POS(-6,-0.5)\ar(-6,5.5) \POS(-6,5.5)*+!UL{p}
6355 \POS(-6,0)*{\bullet}
6356 \POS(-6,1)*{\bullet}
6357 \POS(-6,2)*{\bullet}
6358 \POS(-6,3)*{\bullet}
6359 \POS(-6,4)*{\bullet}
6360 \POS(-6,5)*{\bullet}
6362 \end{xy}
6363 \caption{The transformed parametric polytope from Example~\ref{ex:projection}
6364 for $0 \le p \le 5$}
6365 \label{f:ex:projection:transformed}
6366 \end{figure}
6368 The first step is to compute the lattice width of $P(p)$.
6369 In Example~\ref{ex:width:2}, we already obtained the decomposition
6370 of the parameter domain into
6372 \begin{aligned}
6373 \hat C_1 &= \{\, p \mid 0 \le p \le 5 \,\} \\
6374 \hat C_2 &= \{\, p \mid -5 \le p \le -1 \,\}
6376 \end{aligned}
6378 with corresponding lattice widths and lattice width directions
6380 \begin{aligned}
6381 \vec c_1 &= (0,1) & w_{\vec c_1}(p) &= 5-p \\
6382 \vec c_2 &= (1,0) & w_{\vec c_2}(p) &= 5+p
6384 \end{aligned}
6386 Note that in this example, the gaps in both coordinate directions
6387 are $1$, so, in principle, there is no need to perform any unimodular
6388 transformation here. Nevertheless, we will apply the transformation
6389 that would be applied by the algorithm.
6390 On the first domain, we extend the lattice width direction
6391 to the unimodular matrix
6393 \begin{bmatrix}
6394 0 & 1 \\
6395 1 & 0
6396 \end{bmatrix}
6399 After application to the existentially quantified variables $\vec x$,
6400 we obtain the parametric polytope
6402 P'_1(p) = \left\{\,
6403 \vec x \mid
6404 \begin{aligned}
6405 -2 x_2 + p + 5 &\ge 0 \\
6406 2 x_2 + p + 5 &\ge 0 \\
6407 -2 x_1 - p + 5 &\ge 0 \\
6408 2 x_1 - p + 5 &\ge 0 \\
6409 p & \ge 0 \\
6410 \end{aligned}
6411 \,\right\}
6413 shown in the top part of \autoref{f:ex:projection:transformed}.
6414 We now temporarily remove the existential quantification on $x_1$,
6415 resulting in
6417 T' = \{ (p, x_1) \in \ZZ^2 \mid \exists x_2 \in \ZZ : (s, \vec x) \in P' \}
6420 Since there is only one existentially quantified variable left,
6421 we know we only have to shift and subtract the set once to obtain
6422 a set with at most one value of $x_2$ associated to each value
6423 of $(p, x_1)$.
6424 In particular, let $f(x,z_1,z_2)$ be the generating function
6425 of the integer points in $P'$. Then $g(x,z_1) = f'(x,z_1,1)$, with
6426 $f'(x,z_1,z_2) = f(x,z_1,z_2) - f(x,z_1,z_2) \star z_2 f(x,z_1,z_2)$,
6427 is the generating function of $T'$.
6429 To check whether we need to subtract any shifted copies of
6430 $g(x,z_1)$ from itself, we compute
6432 h(x,z_1) = g(x,z_1) \star \frac{z_1 \, g(x,z_1)}{1-z_1}
6435 The second argument of this Hadamard product is depicted
6436 in \autoref{f:ex:projection:transformed} by its coefficients.
6437 The exponents in $h(x,z_1)$ that have a non-zero coefficient
6438 are therefore those marked by both a dot ($\bullet$) and
6439 a number. The total sum can be computed as $h(1,1) = 26$,
6440 which is finite, but non-zero. We therefore need to subtract
6441 at least one shifted copy of $g(x,z_1)$.
6444 g'(x,z_1) = g(x,z_1) - g(x,z_1) \star z_1 g(x,z_1)
6447 Computing
6449 h'(x,z_1) = g'(x,z_1) \star \frac{z_1^2 \, g(x,z_1)}{1-z_1}
6452 we would find that $h'(1,1) = 0$ and so we do not need
6453 to shift and subtract any further.
6454 However, since we are dealing with a two-dimensional problem,
6455 we already know from \autoref{l:gap} that we can stop
6456 after one shift and subtract, so we do not even need
6457 to compute $h'(x,z_1)$ here.
6458 The function $g'(x,z_1)$ now only has non-zero coefficients
6459 for at most one exponent of $z_1$ for each exponent of $x$.
6460 We may therefore project down to obtain
6461 the function $g'(x,1)$, which is the generating function
6462 of the set in the lower left part of \autoref{f:ex:projection:transformed}.
6464 For the chamber $\hat C_2$ of the parameter domain, the computations
6465 are nearly identical and the final result is simply the sum
6466 of the two generating functions found for each of the two (disjoint)
6467 chambers.
6469 \end{example}