## 1 Introduction

Knapsack problems are a classical category of combinatorial optimization problems, and have been studied for more than a century

(mathews1896partition). They have found wide applications in various fields (strusevich2005knapsack), such as selection of investments and portfolios, selection of assets, finding the least wasteful way to cut raw materials, etc. One of the most commonly studied problem is the so-called*0-1 knapsack problem*, where a set of items are given, each with a reward and a size, and the goal is to select a subset of these items to maximize the total reward, subject to the constraint that the total size may not exceed some knapsack capacity. It is well-known that the 0-1 knapsack problem is NP-complete. However, the problem was shown to possess

*fully polynomial-time approximation schemes (FPTASs)*, i.e., there are algorithms that achieve factor of the optimal value for any , and take polynomial time in and .

The first published FPTAS for the 0-1 knapsack problem was due to ibarra1975fast where they achieve a time complexity by dividing the items into a class of “large” items and a class of “small” items. The problem is first solved for large items only, using the dynamic program approach, with rewards rounded down using some discretization quantum (chosen in advance), and the small items are added later. lawler1979fast proposed a more nuanced discretization method to improve the polylogarithmic factors. Since then, improvements have been made on the dynamic program for large items (kellerer2004improved; rhee2015faster). Most recently, the FPTAS has been improved to in jin:LIPIcs:2019:10652.

In this paper, we study three extensions of the 0-1 knapsack problem. First, we consider a multiperiod version of the 0-1 knapsack problem, which we call the *multiperiod binary knapsack problem (MPBKP)*.
There is a horizon length and a vector of knapsack sizes , where is the cumulative size for periods and is non-decreasing in . We are also given a list of items, each associated with a triple where denotes the reward or value of the item, its size, and denotes its time index (or, deadline).
The goal is to choose a reward maximizing set of items to include such that for any , the total size of selected items with deadlines at most does not exceed the cumulative capacity of the knapsack up to time . The application that motivates this problem is a seller who produces units of a good in time period , and can store unsold goods for selling later. The seller is offered a set of bids, where each bid includes a price (), a quantity demanded (), and a time at which this quantity is needed. The problem of deciding the revenue maximizing subset of bids to accept is exactly MPBKP.

The second extension we consider is the *multiperiod binary knapsack problem with soft capacity constraints (MPBKP-S)* where at each period the capacity constraint is allowed to be violated by paying a penalty that is linear in the violation. The goal of MPBKP-S is then to maximize the total profit, which is the total reward of the selected items less the total penalty. In this case, the seller can procure goods from outside at a certain rate if his supply is not enough to fulfill the bids he accepts, and wants to maximize his profit.

The third extension we consider is the *multiperiod binary knapsack problem with soft stochastic capacity constraints (MPBKP-SS)* where the non-decreasing vector of knapsack sizes

follows some arbitrary joint distribution given as the set of sample paths of the possible realizations and their probabilities. We select the items

*before*realizations of any of these random incremental capacities to maximize the total

*expected*profit, which is the total reward of selected items less the total expected penalty. In this case, the production of the seller at each time is random, but he has to select a subset of bids before realizing his supply. Again, the seller can procure capacity from outside at a certain rate if his realized supply is not enough to fulfill the bids he accepts, and wants to maximize his expected profit.

We note that MPBKP is also related to a number of other multiperiod versions of the knapsack problem in literature. The multiperiod knapsack problem (MPKP) proposed by faaland1981multiperiod has the same structure as MPBKP, except that in faaland1981multiperiod, each item can be repeated multiple times, i.e., the decision variables for each item is not binary, but any nonnegative integer (in the single-period case, this is called the unbounded knapsack problem (andonov2000unbounded)). To the best of our knowledge, there has been no further studies on MPKP since faaland1981multiperiod. In the multiple knapsack problem (MKP), there are knapsacks, each with a different capacity, and items can be inserted to any knapsacks (subject to its capacity constraints). It has been shown in chekuri2005polynomial that MKP does not admit an FPTAS, but an efficient polynomial time approximation scheme (EPTAS) has been found in 10.1007/978-3-642-27660-6_26, with runtime depending polynomially on but exponentially on . The incremental knapsack problem (IKP) is another multiperiod version of the knapsack problem (10.1007/11764298_4), where the knapsack capacity increases over time, and each selected item generates a reward on every period after its insertion, but this reward is discounted over time. Unlike MPBKP, items do not have deadlines and can be selected anytime throughout the periods. A PTAS for the IKP when the discount factor is (time invariant, referred to as IIKP) and has been found in bienstock2013approximation, and it has been shown that IIKP is strongly NP-hard. Later, faenza2018ptas proposed the first PTAS for IIKP regardless of , and della2019approximating proposed an PTAS for IKP when is a constant. Most recent developments of IKP include aouad2020approximate; faenza2020approximation. Other similar problems and/or further extensions include the multiple-choice multiperiod knapsack problem (randeniya1994multiple; lin2004multiple; lin2010dynamic), the multiperiod multi-dimensional knapsack problem (lau2004multi), the multiperiod precedence-constrained knapsack problem (moreno2010large; samavati2017methodology), to name a few.

Our main contributions of this paper are two-fold. First, from the perspective of model formulation, we propose the MPBKP and its generalized versions MPBKP-S and MPBKP-SS. Despite the fact that there are a number of multiperiod/multiple versions of knapsack problems, including those mentioned above (many of which are strongly NP-hard), the MPBKP and MPBKP-S we proposed here are the first to admit an FPTAS among any multiperiod versions of the classical knapsack problem since their initiation back in 1980s. With these results, it is thus interesting to see where the boundary lies between these multiperiod problems that admit an FPTAS and those problems that do not admit an FPTAS. Second, the algorithms we propose for both MPBKP and MPBKP-S are generalized from the ideas of solving 0-1 knapsack problems, but with nontrivial modifications as we will address in the following sections. For MPBKP-SS, we propose a greedy algorithm that achieves -approximation for the special case when all items have the same size.

The rest of this paper is organized as follows. In Section 2 we formally write the three problems in mathematical programming form. The FPTAS for MPBKP is proposed in Section 3 and the FPTAS for MPBKP-S is proposed in Section 4. Alternative algorithms for both problems are also provided in Apendix. A greedy algorithm for a special case of MPBKP-SS is proposed in Section 5. All proofs are left to Appendix but we provide proof ideas in the main body.

## 2 Problem Formulation and Main Results

In this section, we formally introduce the Multiperiod Binary Knapsack Problem (MPBKP), as well as the generalized versions: the Multiperiod Binary Knapsack Problem with Soft capacity constraints (MPBKP-S), and Multiperiod Binary Knapsack Problem with Soft Stochastic Capacity constraints (MPBKP-SS).

### 2.1 Multiperiod binary Knapsack problem (MPBKP)

An instance of MPBKP is given by a set of items, each associated with a triple , and a sequence of knapsack capacities . For each item , we get reward if and only if is included in the knapsack by time . We assume that , and . The knapsack capacity at time is , and by convention . The MPBKP can be written in the integer program (IP) form:

(1a) | |||

(1b) | |||

(1c) |

where ’s are binary decision variables, i.e., is if item is included in the knapsack and is otherwise. In (1), we aim to pick a subset of items to maximize the objective function, which is the total reward of picked items, subject to the constraints that by each time , the total size of picked items with deadlines up to does not exceed the knapsack capacity at time , which is . For each , let denote the set of items with deadline . Note that without loss of generality, we may assume that and . We further note that the decision variables ’s in (1) are binary, but if we relax this to any nonnegative integers, the problem becomes the so-called multiperiod knapsack problem (MPKP) as in faaland1981multiperiod. Our first main result is the following theorem on MPBKP.

###### Theorem 1.

An FPTAS exists for MPBKP. Specifically, there exists a deterministic algorithm that achieves -approximation in .

As we will see shortly, MPBKP can be viewed as a special case of MPBKP-S. In Section 3, we will provide an approximation algorithm for MPBKP with runtime . An alternative algorithm with runtime is provided in Appendix B. In Section 4, we will provide an approximation algorithm for MPBKP-S with runtime , which is also applicable to MPBKP.

### 2.2 Multiperiod binary Knapsack problem with soft capacity constraints (MPBKP-S)

In MPBKP-S, the capacity constraints in (1) no longer exist, i.e., the total size of selected items at each time step is allowed to be greater than the total capacity up to that time, however, there is a penalty rate for each unit of overflow at period . We assume that to avoid trivial cases (any item with and will always be added to generate more profit). In the IP form, MPBKP-S can be written as

(2a) | |||

(2b) | |||

(2c) |

where the decision variables represent the units of overflow at time , and is the incremental capacity at time . The objective is to choose a subset of the items to maximize the total profit, which is the sum of the rewards of the selected items minus the sum of penalty paid at each period, and the constraints enforce that the total size of accepted items by the end of each period must not exceed the sum of the cumulative capacity and the units of overflow. Our second main result is the following theorem on MPBKP-S.

###### Theorem 2.

An FPTAS exists for MPBKP-S. Specifically, there exists an algorithm which achieves -approximation in .

In section 4 we will present an approximation algorithm for solving MPBKP-S with time complexity . An alternative FPTAS with runtime is provided in Appendix C. For the ease of presentation, our algorithms and analysis are presented for the case , but they can be generalized to the heterogeneous in a straightforward manner. It is worth noting that the algorithm for MPBKP that we introduce in section 3 does not extend to MPBKP-S, and we will make this clear in the beginning of section 4.

### 2.3 Multiperiod Binary Knapsack Problem with Soft Stochastic Capacity Constraints (MPBKP-SS)

The MPBKP-SS formulation is similar to (2), except that the vector of knapsack sizes follows some arbitrary joint distribution given to the algorithm as the set of possible sample path (realization) of knapsack sizes and the probability of each sample path. We use to index sample paths which we denote by , as the probability of sample path , and as the set of possible sample paths. The goal is to pick a subset of items before the realization of so as to maximize the expected total profit, which is the sum of the rewards of the selected items deducted by the total (expected) penalty. For a sample let be the overflow at time . Then, we can write the problem in IP form as:

(3a) | |||

(3b) | |||

(3c) |

Our third main result is the following theorem on MPBKP-SS, which asserts a greedy algorithm for the special case when all items are of the same size. Details will be provided in Section 5.

###### Theorem 3.

If for all , then there exists a greedy algorithm that achieves -approximation for MPBKP-SS in .

We further note that both MPBKP-S and MPBKP-SS are special cases of non-monotone submodular maximization which is *not* non-negative, for which not many general approximations are known. In that sense, studying these problems would be an interesting direction to develop techniques for it.

## 3 FPTAS for MPBKP

In this section, we provide an FPTAS for the MPBKP with time complexity . We will apply the “functional approach” as used in chan:OASIcs:2018:8299. The main idea is to use the results on function approximations (chan:OASIcs:2018:8299; jin:LIPIcs:2019:10652) as building blocks – for each period we approximate one function that gives, for every choice of available capacity, the maximum reward obtainable by selecting items in that period. We then combine “truncated” version of these functions using -convolution. This idea, despite its simplicity, allows us to obtain an FPTAS for MPBKP. Such a result should not be taken as granted – as we will see in the next section, this method does not apply for MPBKP-S, even though it is just a slight generalization of MPBKP.

We begin with some preliminary definitions and notations. For a given set of item rewards and sizes, , define the function

(4) |

for all , and for . The function is a nondecreasing step function, and the number of steps is called the *complexity* of that function. Further, for any , i.e., being a disjoint union of and , we have that , where denotes the -*convolution*: .

We define the *truncated function* as follows:

(5) |

Recall that we denote the set of items with deadline by . We next define the function as follows:

(6) |

In words, each function value of corresponds to a feasible, in fact an optimal, solution for items with deadline at most as the next proposition shows.

###### Proposition 1.

Proposition 1 implies that, to obtain an approximately optimal solution for MPBKP (1), it is sufficient to have a good approximation for the function

(7) |

We say that a function approximates the nonnegative function with factor if for all . It should be clear that if approximates with factor and approximates with factor , then approximates with factor . We then introduce the following result from jin:LIPIcs:2019:10652 for 0-1 Knapsack problem.

###### Lemma 1 (jin:LIPIcs:2019:10652).

Given a set , we can obtain that approximates (defined in (4)) with factor and complexity in .

With the above lemma, we present Algorithm 1 for MPBKP.

We now describe the intuition behind Algorithm 1. We first discard all items with reward . The maximum we could lose is , which is at most fraction of the optimal value. We next obtain all , for all , that approximate (as defined in (4)) within a factor. These functions have complexity . We start with combining the functions of period and period using -convolution. To enforce the constraint that the total size of selected items in period does not exceed the capacity of period , we truncate by (so that any solution using more capacity in period results in reward) and do the convolution on the truncated function . Since both functions are step functions with complexity , the convolution can be done in time . The resulting function would have complexity . To avoid inflating the complexity throughout different periods (which increases computation complexity), the function is rounded down to the nearest , where and is some nonnegative integer. Note that is a lower bound of any solution value. After discarding small-reward items, we have that , which implies that is an upper bound for the optimal solution value. Therefore, after rounding down the function values of and obtaining , there are at most different values on . Now we have brought down the complexity of again to , at an additional factor loss in the approximation error. We then move to period and continue this pattern of -convolution, truncation, and rounding down. In the end when we reach period , will only contain feasible solutions to (1), and approximate with total approximation factor of . Formally, we have the following lemma which shows the approximation factor of for .

###### Lemma 2.

Lemma 2 and Proposition 1 together imply that , obtained from Algorithm 1, approximates the optimal value of MPBKP (1) by a factor of . In Algorithm 1, obtaining for all takes time ; computing the -convolution on for all take time . Therefore, Algorithm 1 has runtime . As a result, we have the following proposition.

###### Proposition 2.

Taking , Algorithm 1 achieves -approximation for MPBKP in .

## 4 FPTAS for MPBKP-S

In this section, we provide an FPTAS for the MPBKP-S with time complexity . An alternative FPTAS with time complexity is provided in Appendix C. Combining the two, we show that our algorithms achieve approximation ratio in time , which proves Theorem 2. We should note that the algorithm in the previous section does not apply here: we could similarly define a function which gives the maximum profit (rewardpenalty) under a given capacity constraint, but the main obstacle is on the -convolution because profit does not “add up”. In other words, the total profit we earn by selecting items in the set is not the sum of the profits we earned by selecting and separately. For this reason, we can no longer rely on the techniques used in function approximation and -convolution as in chan:OASIcs:2018:8299; jin:LIPIcs:2019:10652. Instead, our main idea is motivated by the techniques that originated from earlier papers (ibarra1975fast; lawler1979fast), but adapting their technique to MPBKP-S requires significant modifications as we show in this section. We restrict our presentation to the case for readability, but our algorithms and analysis generalize in a straightforward manner when the penalties for buying capacity are heterogeneous (by replacing with in the calculations of profit/penalty at period on line 7 of Algorithm 2).

Preliminaries: We first introduce some notation. From now on, let . The optimal solution set to (2) is denoted by . The total profit earned can be expressed as a function of the solution set :

(8) |

Let be the profit of item , which is defined as the profit earned if we select only , i.e., . Without loss of generality, we assume that each item is by itself profitable, i.e., , so one profitable solution would be . Let and . The following bounds on follow:

(9) |

Partition of items: We partition the set of items into two sets: a set of “large” items and a set of “small” items

such that we can bound the number of large items in any optimal solution. The main idea is to use dynamic programming to pick the large items in the solution, and a greedy heuristic for ‘padding’ this partial solution with small items. The criterion for small and large items is based on balancing the permissible error

equally in filling large items and filling small items. Instead of first packing all large items and then all small items, we consider items in the order of their deadlines, and for each deadline , the large items are selected first and then the small items are selected greedily in order of their reward densities. As a result, the approximation error due to large items overall will be and the error due to the small items with each deadline will be . This gives a total approximation error of .Suppose that we can find some that satisfies (10).

(10) |

Then, the set of items is partitioned as follows.

(11) |

This partition is computed in time and is not the dominant term in time complexity. Let and , so that . Further, let

denote the set of large and small items, respectively, with deadline .
We will assume that the items in are indexed in non-decreasing order of their deadlines, i.e., such that , we have that . Denote by as the index of the last item with deadline , i.e., .
For each time , we will also sort the small items in according to their reward densities, i.e., and , . This sorting only takes place once for each guess , and does not affect our overall time complexity result.

Algorithm overview: Our FPTAS algorithm is given in Algorithm 5 which uses a doubling trick to guess the value of satisfying (10), and for each guess uses Algorithm 4 as a subroutine. Algorithm 4 is the main algorithm for MPBKP-S, which first selects the items with deadline , then the items with deadline , and so on.
For each deadline , we maintain two sets of partial solutions: the first, , corresponds to an approximately optimal (in terms of leftover capacity carried forward to time ) subset of large and small items with deadline at most and some *rounded profit* ; and the second corresponds to the optimal appending of large items with deadline to the approximately optimal set of solutions corresponding to .

Given , we first select large items from using dynamic programming to obtain , which is done in Algorithm 2. In other words, given the partial solutions for all , is the maximum capacity left when earning *rounded profit* (precise definition given in (A.2)) by adding items in . We then use a greedy heuristic to pick small items from to obtain , which is done in Algorithm 3. Specifically, our goal in Algorithm 3 is to obtain the partial solutions given the partial solutions by packing the small items . We initialize with , and for each we try to augment the solution corresponding to using a subset defined as

The small items in are sorted according to their reward densities, and are added to the solution of one by one. After each addition of a small item, if the new total rounded reward is , we compare the leftover capacity with current , and update with the new solution if it has more leftover capacity. We continue this add-and-compare (and possibly update) until we reach the situation where adding the next small item overflows the available capacity.

Intuitively, for any amount of capacity available to be filled by small items, and a minimum increase in profit, the optimal solution either packs a single item from in which case the loss by ignoring items in this set is bounded by the maximum reward of any small item, or the optimal solution only contains items from in which case the space used by this optimal set of items is lower bounded by the a fractional packing of the highest density items in . During Algorithm 3, one of the solutions we would consider would be the integral items of this fractional solution, and lose at most in profit, and obtain a solution with still smaller space used (more leftover capacity) than the fractional solution. Accumulation of these errors for periods then will give us the invariant: the partial solution obtained as above has more leftover capacity than any solution obtained by selecting items from with rounded rewards and rounded penalties, and items from with original (unrounded) rewards such that the rounded total profit is at least .

Our main theorem for the approximation ratio for MPBKP follows.

## 5 A greedy algorithm for a special case of MPBKP-SS

In this subsection, we consider the special case of MPBKP-SS when all items have the same size, i.e., . We again only present for the case . We note that in the deterministic problems (MPBKP or MPBKP-S), when items all have the same size, greedily adding items one by one in decreasing order of their rewards leads to the optimal solution. For MPBKP-SS, as the capacities are now stochastic, we wonder if there is any greedy algorithm performs well. We propose Algorithm 6, where we start with an empty set, and greedily insert the item that brings the maximum increment on expected profit, and we stop if adding any of the remaining items does not increase the expected profit.

Let be an optimal solution, i.e., , where

is the expected quantity of overflow on set , and let be the set output by Algorithm 6. Then, we have the following theorem.

###### Theorem 5 (Restating Theorem 3).

Algorithm 6 achieves -approximation factor for MPBKP-SS when items have the same size, i.e., in .

The proof of the -approximation could be more nontrivial than one may think. The idea is to look at the greedy solution set and the optimal solution set , where we will use the dual to characterize the optimal solution on each sample path. By swapping each item in to in replacement of the same item or two other items, we construct a sequence of partial solutions of the greedy algorithm as well as modified optimal solution set, while maintaining the invariant that the profit of is bounded by the sum of two times the profit of items in swapped into so far and the additional profit of remaining items in the modified optimal solution set. We leave the formal proof of Theorem 5 to Appendix A.3.

## 6 Comments and Future Directions

The current work represents to the best of our knowledge the first FPTAS for the two multi-period variants of the classical knapsack problem. For MPBKP, we obtained the runtime . This was done via the function approximation approach, where a function is approximated for each period. The runtime increases in since we conduct number of rounding downs, one after each -convolution. An alternative algorithm with runtime is also provided in Appendix B. Note that the function we approximated is in the same form as used in the 0-1 knapsack problem (chan:OASIcs:2018:8299). It is thus interesting to ask if we could instead directly approximate the following function:

where and is a -dimensional vector. Here we impose all constraints in the function. The hope is that, if the above function could be approximated, and if we could properly define the -convolution on dimensional vectors (and have a fairly easy computation of it), then we may get an algorithm that depends more mildly on .

For MPBKP-S and MPBKP-SS, there seems to be less we can do without further assumptions. One direction to explore is parameterized approximation schemes: assuming that in the optimal solution, the total (expected) penalty is at most fraction of the total reward. Then we may just focus on rewards. Our ongoing work suggests that an approximation factor of may be achieved in

Comments

There are no comments yet.