arXiv:2610.19200cs.CCOct 2026

Manuscript Offprint

arXiv:2610.19200

A Simple Algorithm for Counting Solutions to Integer Programs

Daniel Dadush, Anita Dürr, Thekla Hamm, Jonas Schmidt, Karol Węgrzycki

Abstract

We consider the problem of counting solutions to integer linear programming problems of the form {x∈Z≥0n:Ax=b}\{\mathbf{x} \in \mathbb{Z}_{\geq 0}^n : A \mathbf{x} = \mathbf{b}\} where A∈{−Δ,…,Δ}m×nA \in \{-\Delta, \ldots, \Delta\}^{m \times n} and b∈Zm\mathbf{b} \in \mathbb{Z}^m. We present an algorithm that counts solutions with (nΔ)m+o(1)⋅log⁡∥b∥(n\Delta)^{m+o(1)} \cdot \log \|\mathbf{b}\| arithmetic operations. This simplifies the algorithm of Gribanov and Malyshev, who considered the problem for the more general setting in which AA is Δ\Delta-modular.

Acknowledgements We thank the organizers of the workshop Phase Transitions in Combinatorics, Algorithms and Probability held at the CWI, Amsterdam in May 2026 for providing a fruitful research environment in which this work was initiated.

∗^{*}Centrum Wiskunde & Informatica (CWI), Amsterdam, The Netherlands, dadush@cwi.nl.

†^{\dagger}ETH Zürich, Zürich, Switzerland, anita.duerr@inf.ethz.ch.

‡^{\ddagger}Eindhoven University of Technology, Eindhoven, The Netherlands, t.l.s.hamm@tue.nl.

§^{§}Bocconi University, Milan, Italy, jonas.schmidt2@phd.unibocconi.it.

^{¶}Max Planck Institute for Informatics, Saarbrücken, Germany, kwegrzyc@mpi-inf.mpg.de. Supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) grant number 559177164.

1 Introduction

Integer linear programming is a fundamental problem in discrete optimization and theoretical computer science. In this paper, we study the problem of computing the cardinality of

ILP(A,b):={x∈Z⩾0n:Ax=b},\mathrm{ILP}(A,\mathbf{b}):=\left\{\mathbf{x}\in\mathbb{Z}_{\geqslant0}^{n}:A\mathbf{x}=\mathbf{b}\right\},

where A∈{−Δ,…,Δ}m×nA \in \{-\Delta, \ldots, \Delta\}^{m \times n} and b∈Zm\mathbf{b} \in \mathbb{Z}^m.

The corresponding feasibility problem asks whether ILP(A,b)\text{ILP}(A, \mathbf{b}) is nonempty. Building on the seminal work of Lenstra and Kannan [13, 15], Reis and Rothvoss [17] gave a randomized algorithm deciding feasibility in time (log⁡(2n))O(n)⋅poly(∣I∣)(\log(2n))^{\mathcal{O}(n)} \cdot \text{poly}(|I|), where ∣I∣|I| denotes the input size. Note, however, that these algorithms only determine whether a solution exists and do not compute the number ∣ILP(A,b)∣|\text{ILP}(A, \mathbf{b})| of solutions. For the counting problem, the best known general-purpose method is Barvinok's algorithm [2, 3], which computes ∣ILP(A,b)∣|\text{ILP}(A, \mathbf{b})| in time ∣I∣O(nlog⁡n)|I|^{\mathcal{O}(n \log n)} (see [6]).

These algorithms are exponential when nn is large. Gribanov and Malyshev [10] considered the regime in which AA is DD-modular, i.e., D(A)⩽DD(A) \leqslant D, where, using AR,CA_{R,C} to denote the restriction of AA to a subset RR of its rows and a subset CC of its columns,

D(A):=max⁡{∣det⁡(AR,C)∣such that∣R∣=∣C∣=rank⁡(A)}.D(A):=\max\{|\det(A_{R,C})|\text{such that}|R|=|C|=\operatorname{rank}(A)\}.

Gribanov and Malyshev [10] presented an algorithm computing ∣ILP(A,b)∣|\mathrm{ILP}(A, \mathbf{b})| using O(n4ν2D4log⁡D)\mathcal{O}(n^4\nu^2D^4\log D) arithmetic operations, where ν=ν(A)\nu = \nu(A) is the maximum possible number of vertices in the polytope defined by AA as b\mathbf{b} varies (see [10, Definition 2]). Since D(A)⩽O(mΔ)mD(A) \leqslant \mathcal{O}(\sqrt{m}\Delta)^m and ν(A)⩽O(nm)\nu(A) \leqslant \mathcal{O}(n^m), their bound simplifies to O(mnΔ)4m⋅poly(∣I∣)\mathcal{O}(\sqrt{mn}\Delta)^{4m} \cdot \text{poly}(|I|) arithmetic operations. More recently, Gribanov, Shumilov, Malyshev, and Zolotykh [9] (see also [8]) gave an improved bound of O(ν2d4D3)\mathcal{O}(\nu^2d^4D^3) arithmetic operations, where dd is the polytope dimension. Since d⩽nd \leqslant n, the same estimates for ν(A)\nu(A) and D(A)D(A) give

O(n2m+4m3m/2Δ3m).\mathcal{O}\Big(n^{2m+4}m^{3m/2}\Delta^{3m}\Big).

in the parameters used here. In this work, we give a simpler algorithm with improved dependence on n, m, and Δ\Delta.

Theorem 1.1. There exists an algorithm that computes ∣ILP(A,b)∣|\mathrm{ILP}(A, \mathbf{b})| with O(nΔ)mlog⁡(nΔ)log⁡(nΔ∥b∥∞)\mathcal{O}(n\Delta)^m \log(n\Delta) \log(n\Delta \| \mathbf{b} \|_\infty) arithmetic operations 1^1.

Notice that in the packing case (i.e., when every entry of AA is non-negative), after handling zero columns separately, the value ∣ILP(A,b)∣|\mathrm{ILP}(A, \mathbf{b})| can be computed using O(n∥b∥∞m)\mathcal{O}(n\|\mathbf{b}\|_{\infty}^m) arithmetic operations by dynamic programming, but even in this special case it is not clear how to avoid polynomial dependence on ∥b∥∞\|\mathbf{b}\|_{\infty}. For general AA, the feasibility problem under this parameterization was first studied by Papadimitriou [16]. Eisenbrand and Weismantel [7] proposed an O(mΔ)m⋅n∥b∥1\mathcal{O}(m\Delta)^m \cdot n\|\mathbf{b}\|_1-time algorithm. Jansen and Rohwedder [11] later improved this to a bound of O(mΔ)mlog⁡(Δ)log⁡(Δ+∥b∥∞)+O(nm)\mathcal{O}(m\Delta)^m \log(\Delta) \log(\Delta + \|\mathbf{b}\|_{\infty}) + \mathcal{O}(nm). All of these methods rely on proximity results guaranteeing the existence of an integral solution close to the LP relaxation. This approach is challenging to apply in the counting setting.

Organization and Exposition. Our paper follows a slightly non-standard structure. We start by presenting the simpler packing case of Theorem 1.1 in Section 2. The algorithm is presented in the language that we discovered it in, namely using a generating function of ILP(A,b)\mathrm{ILP}(A, \mathbf{b}) and polynomial multiplications

1^{1}To simplify the presentation, we bound the running time always in the number of arithmetic operations. In the standard word RAM model, the running time equals the stated bound increased by a factor of O(nlog⁡(Δ∥b∥))O(n \log(\Delta \| \mathbf{b} \|)) (see the discussion in Section 3).

and manipulations of polynomials. This language turns out to be convenient for expressing the operations that our algorithm performs. We find this surprising, since our algorithm does not rely on any specific deeper theory used in other counting algorithms such as Barvinok's algorithm [2,3]. (In fact, our algorithm even works with a different generating function.)

While allowing for an efficient presentation and interesting perspective, we find it less intuitive to grasp which operations the algorithm in Section 2 is actually performing and therefore harder to generalize (e.g., to the non-packing case). Thus, we believe that it adds value to present the generalized algorithm and full proof of Theorem 1.1 in a more traditional, dynamic-programming-based way in Section 3.

Based on this difference, readers may choose whether to read Section 2 or Section 3, as the main ideas are identical. The main difference is the need for the Steinitz lemma (see, [7]).