## Abstract

Given n elements with nonnegative integer weights w=(w_{1},…,w_{n}), an integer capacity C and positive integer ranges u=(u_{1},…,u_{n}), we consider the counting version of the classic integer knapsack problem: find the number of distinct multisets whose weights add up to at most C. We give a deterministic algorithm that estimates the number of solutions to within relative error ϵ in time polynomial in n, logU and 1/ϵ, where U=max_{i}u_{i}. More precisely, our algorithm runs in O(n3log2UϵlognlogUϵ) time. This is an improvement of n^{2} and 1/ϵ (up to log terms) over the best known deterministic algorithm by Gopalan et al. (2011) [5]. Our algorithm is relatively simple, and its analysis is rather elementary. Our results are achieved by means of a careful formulation of the problem as a dynamic program, using the notion of binding constraints.

Original language | English |
---|---|

Pages (from-to) | 41-47 |

Number of pages | 7 |

Journal | Theoretical Computer Science |

Volume | 645 |

DOIs | |

State | Published - 2016 |

Externally published | Yes |

### Bibliographical note

Publisher Copyright:© 2016

### Funding

Partial support for this research was provided by the Recanati Fund of the Jerusalem School of Business Administration .

Funders | Funder number |
---|---|

Jerusalem School of Business Administration |

## Keywords

- Approximate counting
- Binding constraints
- Dynamic programming
- Integer knapsack
- K-approximating sets and functions