Improved approximation algorithms and disjunctive relaxations for some knapsack problems Yuri Faenza∗, Igor Malinovi´c† January 26, 2017 7 1 0 2 Abstract n We consider two knapsack problems. The time-Invariant Incremental Knapsack problem a (IIK) is a generalization of Maximum Knapsack to a discrete multi-period setting. At each J time the capacity increases and items can be added, but not removed from the knapsack. The 5 goal is to maximize the sum of profits over all times. While IIK is strongly NP-Hard [8], we 2 design a PTAS for it and some of its generalizations. TheMinimumKnapsackproblem(min-K)aimsatminimizingalinearfunctionoverthe0/1 ] points that satisfy a single linear constraint. Despite the existence of an FPTAS, it is an open S question whether one can obtain a poly-size linear formulation with constant integrality gap D for min-K. This motivated recent work on disjunctive formulations having integrality gap of at . s most (1+ε) for a fixed objective function. We give such a formulation of size polynomial in n c and subexponential in 1. [ ε 1 1 Introduction v 9 9 Knapsack problems are among the most fundamental and most studied in integer programming. 2 Somevariantsforegothedevelopmentofmoderncombinatorialoptimization,datingbacktoatleast 7 1896 [21]. The best known representative of this class is arguably Maximum Knapsack (max-K): 0 givenasetofitems,eachhavingaprofitandaweight,andathresholdcapacity,findamostprofitable . 1 subsetofitemswhosetotalweightdoesnotexceedthethreshold. max-KisknowntobeNP-complete 0 [16], while admitting a fully polynomial-time approximation scheme (FPTAS) [14]. Many classical 7 1 algorithmic techniques including greedy, dynamic programming, backtracking/branch-and-bound : have been studied by means of solving this problem, see e.g. [17]. The algorithm of Martello and v Toth [20] has been known to be the fastest in practice for exactly solving knapsack instances [1]. i X Resemblingreal-worldscenarios,manyrecentworksstudiedextensionsofclassicalcombinatorial r optimizationproblemstomulti-periodsettings, seee.g. [13], [24], [25]. Bienstocketal. [8]proposed a an interesting generalization of max-K that they dubbed time-Invariant Incremental Knapsack (IIK). In IIK, we are given a set of items [n] with profits p:[n] R and weights w :[n] R >0 >0 → → and a knapsack with non decreasing capacity b over time t [T], i.e. 0<b b for t [T 1]. t t t+1 ∈ ≤ ∈ − We are allowed to add items at each time as long as the capacity constraint is not violated, and once inserted, an item cannot be removed from the knapsack. The goal is to maximize the total profit, which is defined to be the sum, over t [T], of profits of items in the knapsack at time t. IIK models a scenario where available resou∈rces (e.g. money, labour force) augment over time in a predictable way, allowing an increase of our portfolio. Take as an example a bond market with an extremely low levels of volatility, where all coupons render profit only at their common ∗IEOR,ColumbiaUniversity,USA.Email: [email protected] †DISOPT,EPFL,Switzerland. Email: igor.malinovic@epfl.ch 1 maturity time T (zero-coupon bonds) and an increasing budget over time that allows buying more andmore(differentlysizedandpriced)packagesofthosebonds. Forvariationsof max-Kthathave been historically used to model financial problems, see [17]. IIK was proved in [8] to be strongly NP-hard. In the same paper, a PTAS is given when T = O(logn). This result is stronger than the one from [24], where a PTAS for the special case p = w is given when T is a constant. Again when p=w, a 1/2-approximation algorithm for generic T is given in [13]. Results from [26] can be adapted to give an algorithm that solves IIK in time polynomial in n and of order (logT)O(logT) for a fixed approximation guarantee ε [23]. However, nothing was known on the approximability of the problem for generic T and profit/weight structure. Pure knapsack problems are rarely studied independently in either theoretical or practical ap- plications. One often aims at developing techniques that remain valid when more general, less structured constraints are added. This can be achieved by casting the problem in a geometric set- ting, mostly using linear and semidefinite programming (LP and SDP, respectively). Moreover, LP-based techniques have been broadly used for designing approximation algorithms for knapsack- related problems, including multiple knapsack , generalized assignment, and scheduling problems among others, see e.g. [9], [12], [15]. The standard LP relaxation for max-K has integrality gap (IG) 2, but one can design an (extended) LP relaxation with with (n+1/ε)O(1/ε) variables and constraints, and IG 1+ε [6]. (Interestingly, no such relaxation exist in the original space [11]). Hence, the applicability of LP to max-K is essentially understood, the only (yet very interesting) open question being whether relaxations of size poly(n,1/ε) with IG 1+ε exist. Surprisingly, the situation is quite different for Minimum Knapsack (min-K). This is the min- imization version of the classical max-K: given a set of n items with non-negative costs c and weights w, find a cheapest subset of the items whose total weight is at least the target value β. NP-completeness of min-K immediately follows from the NP-completeness of max-K, and it is not hard to show that the FPTAS for max-K can be adapted to min-K [14]. min-K is an important problem appearing as a substructure in many IPs. Valid inequalities for min-K – like knapsack cover inequalities – have been generalized e.g. to problems in scheduling and facility location. Un- likemax-K,therecannotbeanLPrelaxationintheoriginalspacewithconstantintegralitygapand a polynomial number of inequalities [10]. More generally, the problem seems to be very challenging for geometric algorithms, as even the Lassere strengthening of the natural LP relaxation may have unbounded integrality gap up to level n 1 [19]. No relaxation for the problem with a constant − integrality gap and a polynomial number of inequalities is known. A remarkable recent result [4] shows that for any fixed ε>0 there is an LP relaxation of size nO(logn) with IG bounded by 2+ε. Clearlytheproblembecomeseasierifweaskforarelaxationof min-Kthathasconstantintegrality gap only for a fixed objective function. Indeed, let x be a (1+ε)-approximate solution obtained (cid:48) using an FPTAS. Adding cTx cTx/(1+ε) to the standard LP relaxation reduces the integrality (cid:48) ≥ gap to 1+ε. A more interesting question is requiring the relaxation to be more structured, in order to be able to reuse it us to tackle a broader class of knapsack problems. A common technique to produce those structured relaxations is Disjunctive programming. It provides a very general and flexible approach to find strong relaxations for integral sets, and it has been exploited in practice to produce the so called disjunctive cuts for MILP. See Appendix B for more details on disjunctive programming and disjunctive cuts. Several papers successfully applied disjunctive programming to obtain theoretical results on knapsack problems, including min-K [7] and max-K [6]. In particular, in [7], a linear relaxation for min-K with n2( 1/ε )(cid:100)Cε(cid:101) variables and constraints and integrality gap 1+ε is given, where (cid:100) (cid:101) C =log 1 =Θ(1log(1)). Hence, the relaxation has size polynomial in n and exponential in 1. ε 1+ε ε ε ε ε Our Contributions. The first main result of this paper is an algorithm for computing a (1 ε)- approximated solution for IIK that depends polynomially on the number n of items and, for−any fixed ε, also polynomially on the number of times T. In particular, our algorithm provides a PTAS for IIK, regardless of T. 2 Theorem 1. Thereexistsanalgorithmthat, whengivenasinputε R andaninstance of IIK >0 ∈ I with n items and T times, produces a (1 ε)-approximation to the optimum solution of in time − I O(Th(ε) nf (n)). Here f (m) is the time required to solve a linear program with O(m) variables LP LP and cons·traints, and h:R R is a function depending on ε only. In particular, there exists a >0 1 PTAS for IIK. → ≥ Theorem1thereforedominatesallpreviousresultsonIIK[8,13,24,26]. Interestingly,itisbased on designing a disjunctive formulation – a tool mostly common among integer programmers and practitioners – and then rounding the solution to its linear relaxation with a greedy-like algorithm. Because of the hardness result from [8], Theorem 1 is essentially optimal. We see Theorem 1 as an important step towards the understanding of the complexity landscape of knapsack problems over time. Theorem 1 is proved in Section 2: see Section 2.1 for a sketch of the techniques we use and a detailed summary of Section 2. In Section 2.5, we show some extensions of Theorem 1 to more general problems. The second main result of this paper is a disjunctive relaxation for min-K of size polynomial in n and subexponential in 1/ε, hence asymptotically smaller than the one provided in [7]. Recall that C =Θ(1log(1)). ε ε ε Theorem 2. Given ε>0 and a fixed objective function, there is a disjunctive relaxation for min-K with n2(1/ε)O(√Cε) variables and constraints such that the integrality gap is 1+ε. Theorem 2 is proved in Section 3. An overview of the techniques used is given in Section 3.1. More related work. The authors in [8] show that IIK is strongly NP-hard, and provide an instance showing that the natural LP relaxation has an unbounded integrality gap. Furthermore, [8] discuses the relation between IIK and the generalized assignment problem (GAP), highlighting the differences between those problems. In particular, there does not seem to be a direct way to apply to IIK the (1 1/e ε) approximation algorithm [12] for GAP. A special case of GAP where − − an item has non-changing weight and profit over the set of bins is called the multiple knapsack problem (MKP). MKP is strongly NP-complete as well as IIK and has an LP-based efficient PTAS (EPTAS) [15]. There is a certain similarity between the scheme in [15] and the one we are going to present here, since they are both based on reducing the number of possible profit classes and knapsack capacities, and then guessing the most profitable items in each class. However, the way thisisperformedisverydifferent. Thekeyingredientoftheapproximationschemessofardeveloped for MKP is a shifting trick. In rounding a fractional LP solution it redistributes and mixes together items from different buckets. Applying this technique to IIK would easily violate the monotonicity constraint,i.e. x x wherex indicateswhetheranitemiispresentintheknapsackattime t,i t+1,i t,i ≤ t. Thishighlightsasignificantdifferencebetweentheproblems: theorderingofthebinsisirrelevant for MKP while it is crucial for IIK. 2 A PTAS for IIK We already defined IIK in the introduction. The following IP gives an equivalent, mathematical programming formulation. max (cid:80) pTx t t [T] s.t. w∈Txt bt t [T] (1) ≤ ∀ ∈ x x t [T 1] t t+1 ≤ ∀ ∈ − x 0,1 n t [T]. t ∈{ } ∀ ∈ Recall that by the definition of the problem 0<b b for t [T 1]. We also assume wlog t t+1 ≤ ∈ − that 1=p p ... p . 1 2 n ≥ ≥ ≥ 3 2.1 Overview of the proof technique In order to illustrate the ideas behind Theorem 1, let us recall a possible PTAS for the classical max-K with capacity β, n items, profit and weight vector p and w respectively. Recall the greedy algorithm for knapsack: 1. Sort items so that p1 p2 pn. w1 ≥ w2 ≥···≥ wn (cid:80) 2. Let x¯ =1 for i=1,...,¯ı, where¯ı is the maximum integer s.t. w β. i i ≤ 1 i ¯ı ≤≤ It is well-known that pTx¯ pTx max p , where x is the optimum solution to the fractional ∗ i ¯ı+1 i ∗ relaxation. A PTAS for m≥ax-K c−an then≥be obtained as follows: guess a set S of 1 items with 0 (cid:100)ε(cid:101) w(S ) β andconsiderthe“residual”knapsackinstance obtainedremovingitemsinS anditems 0 0 ≤ I (cid:96) with p >min p , and setting the capacity to β w(S ). Apply the greedy algorithm to as (cid:96) i∈S0 i − 0 I to obtain solution S. Clearly S S is a feasible solution to the original knapsack problem. The 0 ∪ best solutions generated by all those guesses can be easily shown to be a (1 ε)-approximation to − the original problem. When trying to extend the algorithm above to our setting, we face two problems. First, we have multiple times, and a standard guessing over all times will clearly be exponential in T. Second, when inserting an item in the knapsack in a specific time, we are clearly imposing this decision on all time stamps that succeed it, and it is not clear a priori how to take it into account. We solve this by proposing an algorithm that, in a sense, still follows the general scheme of the greedyalgorithmsketchedabove: aftersomepreprocessing,guessitemsandinsertiontimesthatgive high profit, and then fill the remaining capacity with an LP-driven integral solution. In particular, we first show that by losing at most a 2ε fraction of the profit we can assume the following (see Section 2.2): item 1, which has the maximum profit, is always inserted in the knapsack at some time; the capacity of the knapsack only increases and hence the insertion of items can only happen atJ =O(1logT)times(wecallthemsignificant);andtheprofitofeachitemiseithermuchsmaller ε thanp =1orittakesoneofK =O(1logT)possiblevalues(wecallthemprofit classes). Thiswill 1 ε ε give a 2-dimensional grid of size J K of “significant times” vs “profit classes” with O( 1 log2 T) × ε2 ε entries. Notethatthoseentriesarestilltoomanytoperformaguessingoverallofthem. Instead,we proceed as follows: for a carefully guessed subset of points (j,k) of this grid, we will either exactly guess how many items from profit class k are inserted at time j, or impose that they are at most 1. ε To each of those guesses, we associated a natural IP (see Section 2.3). The optimal solution x of ∗ its linear relaxation is not as simple as the classical fractional greedy solution, but it still has a lot of structure. We exploit this to produce an integral solution to the IP, and show that we can round x such that the portion of the profit we lose is negligible (see Section 2.4). ∗ 2.2 Reducing IIK to special instances and solutions Our first step will be to show that we can reduce IIK, without loss of generality, to solutions and instances with a special structure. The first reduction is immediate: we restrict to solutions where the highest profit item is inserted in the knapsack at some time. We call these 1-in solutions. This can be assumed by guessing which is the highest profit item that is inserted in the knapsack, and reducing to the instance where all higher profit items have been excluded. Since we have n possible guesses, the running time is scaled by a factor O(n). Observation 1. Suppose there exists a function f : N N R such that, for each n,T N, >0 ε > 0, and any instance of IIK with n items and T time×s, we×can find a (1 ε)-approximatio∈n to − a 1-in solution of highest profit in time f(n,T,ε). Then we can find a (1 ε)-approximation to any instance of IIK with n items and T times in time O(n) f(n,T,ε). − · 4 Now, let be an instance of IIK with n items, let ε > 0. We say that is ε-well-behaved if it I I satisfies the following properties. (ε1) For all i [n], one has p =(1+ε) j for some j [ log T ] , or p ε. ∈ i − ∈ (cid:100) 1+ε ε(cid:101)0 i ≤ T (ε2) b =b forallt [T]suchthat (1+ε)j 1 <T t+1< (1+ε)j forsomej [ log T ], t t−1 ∈ (cid:100) − (cid:101) − (cid:100) (cid:101) ∈ (cid:98) 1+ε (cid:99) where we set b =0. 0 See Figure 1 for an example. Note that condition (ε2) implies that the capacity can change only duringthesetoftimes := t [T]:t=T+1 (1+ε)j for some j N ,with =O(log T). T { ∈ −(cid:100) (cid:101) ∈ } |T| 1+ε clearly gets sparser as t becames smaller. Note also that times t = 1,...,T (1+ε)(cid:98)log1+εT(cid:99) T −(cid:100) (cid:101) have capacity b =0. t Next theorem implies that we can, wlog, assume that our instances are ε-well-behaved (and our solutions are 1-in). t b b t 0t 1 2 3 4 5 6 7 T 8 I → I0 9 10 11 12 13 14 (32)0 (32)−1 (32)−2 0 (32)0 (32)−1 (32)−2 0 p p 0 (cid:15)=1 (cid:15)=1 2 2 Figure 1: An example of obtaining an ε-well-behaved instance for ε= 1 and T =14. 2 Theorem3. Supposethereexistsafunctiong :N N R suchthat, foreachn,T N, ε>0, and >0 any ε-well-behaved instance of IIK with n items a×nd T×times, we can find a (1 3ε)∈-approximation − to a 1-in solution of highest profit in time g(n,T,ε). Then we can find a (1 5ε)-approximation to any instance of IIK with n items and T times in time O(T +n(n+g(n,T,−ε)). Proof. Fix an IIK instance . By Observation 1, it is enough to find a (1 3ε)-approximation to I − its 1-in solution of highest profit in time O(n+T)+g(n,T,ε). Consider instance with n items (cid:48) I having the same weights as in , T times, and the other parameters defined as follows: I For i [n], if (1+ε) j p < (1+ε) j+1 for some j [ log T ], set p := (1+ε) j; • ∈ − ≤ i − ∈ (cid:100) 1+ε ε(cid:101) (cid:48)i − otherwise, set p :=p . Note that we have 1=p p ... p . (cid:48)i i (cid:48)1 ≥ (cid:48)2 ≥ ≥ (cid:48)n For t [T] and (1+ε)j 1 < T t+1 (1+ε)j for some j [ log T ], set b := • ∈ (cid:100) − (cid:101) − ≤ (cid:100) (cid:101) ∈ (cid:98) 1+ε (cid:99) (cid:48)t b . T (1+ε)j +1 −(cid:100) (cid:101) • For t such that (cid:100)(1+ε)(cid:98)log1+εT(cid:99)(cid:101)<T −t+1≤T (i.e all the remaining t), set b(cid:48)t :=0. 5 One easily verifies that is ε-well-behaved. Moreover, b b for all t [T] and pi p p for I(cid:48) (cid:48)t ≤ t ∈ 1+ε ≤ (cid:48)i ≤ i i [n], so we deduce: ∈ Claim 1. Any solution x¯ feasible for is also feasible for , and p(x¯) p(x¯). (cid:48) (cid:48) I I ≥ Claim 2. Let x be a 1-in feasible solution of highest profit for . There exists a 1-in feasible ∗ I solution x for such that p(x) (1 ε)2p(x ). (cid:48) (cid:48) (cid:48) (cid:48) ∗ I ≥ − Proof. Define x 0,1 Tn as follows: (cid:48) ∈{ } (cid:40) x if (1+ε)j 1 <T t+1 (1+ε)j , j [ log T ], x := ∗T (1+ε)j +1 (cid:100) − (cid:101) − ≤(cid:100) (cid:101) ∈ (cid:98) 1+ε (cid:99) (cid:48)t 0 −(cid:100) (cid:101) otherwise, i.e. for t : (1+ε)(cid:98)log1+εT(cid:99) <T t+1 T. (cid:100) (cid:101) − ≤ In order to prove the claim we first show that x is a feasible 1-in solution for . Indeed, it (cid:48) (cid:48) I is 1-in, since by construction x = x = 1. It is feasible, since for t such that (1+ε)j 1 < (cid:48)T,1 ∗T,1 (cid:100) − (cid:101) T t+1 (1+ε)j , j N,j [ log T ] we have − ≤(cid:100) (cid:101) ∈ ∈ (cid:98) 1+ε (cid:99) wTx =wTx b =b , (cid:48)t ∗T−(cid:100)(1+ε)j(cid:101)+1 ≤ T−(cid:100)(1+ε)j(cid:101)+1 (cid:48)t while wTx =0=b otherwise. (cid:48)t (cid:48)t Comparing p(x) and p(x ) gives (cid:48) (cid:48) ∗ (cid:80) (cid:80) (cid:80) p(x) p x = (T t (x)+1)p (cid:48) (cid:48) ≥ (cid:48)i (cid:48)t,i − i,min (cid:48) (cid:48)i t [T]i [n] i [n] ∈(cid:80) ∈1 (T t (x )+1)p ∈(cid:80) 1 (T t (x )+1)p ≥ 1+ε − i,min ∗ (cid:48)i ≥ (1+ε)2 − i,min ∗ i i [n] i [n] = (∈1 )2p(x ) (∈1 ε)2p(x ), 1+ε ∗ ≥ − ∗ where t (v):=min t [T]: v =1 for v 0,1 Tn. (End of the claim.) i,min t,i { ∈ } ∈{ } Let xˆ be a 1-in solution of highest profit for and x¯ is a solution to that is a (1 ε)- (cid:48) (cid:48) I I − approximation to xˆ. Claim 1 and Claim 2 imply that x¯ is feasible for and we deduce: I p(x¯) p(x¯) (1 3ε)p(xˆ) (1 3ε)p(x) (1 3ε)(1 ε)2p(x ) (1 5ε)p(x ). (cid:48) (cid:48) (cid:48) (cid:48) ∗ ∗ ≥ ≥ − ≥ − ≥ − − ≥ − In order to compute the running time, it is enough to bound the time required to produce . (cid:48) I Vector p can be produced in time O(n), while vector b in time T. Moreover, the construction of (cid:48) (cid:48) the latter can be performed before fixing the highest profit object that belongs to the knapsack (see Observation 1). The thesis follows. 2.3 A disjunctive relaxation Fix ε > 0. Because of Theorem 3, we can assume that the input instance is ε-well-behaved. We I callalltimesfrom significant. Notethatasolutionoverthelattertimescanbenaturallyextended T to a global solution by setting x =x for all non-significant times t. We denote significant times t t 1 − by t <t < <t . 1 2 ··· |T| In this section we describe an IP over feasible 1-in solutions of an ε-well-behaved instance of IIK. The feasible region of this IP is the union of different regions, each corresponding to a partial assignment of items to significant times. In Section 2.4 we give a strategy to round an optimal solution of the LP relaxation of the IP to a feasible integral solution with a (1 3ε)-approximation − guarantee. Together with Theorem 3 (taking ε = ε), this implies Theorem 1. (cid:48) 5 In order to describe those partial assignments, we introduce some additional notation. We say that items having profit (1+ε) k for k [ log T ], belong to profit class k. Hence bigger profit − ∈ (cid:100) 1+ε ε(cid:101) classescorrespondtoitemswithsmallerprofit. Allotheritemsaresaidtobelongtothesmall profit class. Note that there are O(1logT) profit classes (some of which could be empty). Our partial ε ε assignments will be induced by special sets of vertices of a related graph called grid. 6 Definition 4. Let J Z ,K Z , a grid of dimension J (K + 1) is the graph G = >0 0 J,K ([J] [K] ,E), where ∈ ∈ ≥ × 0 × E := u,v :u,v [J] [K] , u=(j,k) and either v =(j+1,k) or v =(j,k+1) . 0 {{ } ∈ × } Definition 5. Given a grid G , we call S = (j ,k ),(j ,k ),..., (j ,k ) V(G ) is a J,K 1 1 2 2 S S J,K stairway if j >j and k <k for all h [{S 1]. | | | | } ⊆ h h+1 h h+1 ∈ | |− Lemma 6. There are at most 2K+1+J distinct stairways in G . J,K Proof. The first coordinate of any entry of a stairway can be chosen among J values, the second coordinate from K +1 values. By Definiton 5, each stairway correspond to exactly one choice of sets J [J] for the first coordinates and K [K] for the second, with K = J . 1 1 0 1 1 ⊆ ⊆ | | | | Now consider the grid graph with J := = O(1logT), K = log T , and a stairway S |T| ε (cid:100) 1+ε ε(cid:101) with k = 0. See Figure 2 for an example. This corresponds to a partial assignment that can be 1 informallydescribedasfollows: if(j ,k ) S,theninthecorrespondingpartialassignmentnoitem h h ∈ belonging to profit classes k k <k is in the knapsack at any time t<t , while the first time h ≤ h+1 jh an item from profit class k is inserted in the knapsack is time t (if j > 1 then items from the h jh |S| small profit class can only be placed in the knapsack at times 1,...,t 1). Moreover, for each j|S| − (¯,k¯) S, for an appropriately chosen family of profit classes k following k¯ and significant times t (cid:48) (cid:48) ∈ following t , we will either specify exactly the number of items taken from k at time t, or impose ¯ (cid:48) (cid:48) that there are at least 1 of those items. Note that we can assume that the items taken within a (cid:100)ε(cid:101) profit class are those with minimum weight: this may exclude some feasible 1-in solutions, but it will always keep at least a feasible 1-in solution of maximum profit. No other constraint is imposed. More formally, set k =K+1, C =2 log 1 . For each h=1,..., S : |S|+1 ε (cid:100) 1+ε ε(cid:101) | | i) Set x =0 for all t [t 1] and each item i in a profit class k [k 1]. t,i ∈ jh − ∈ h+1− ii) Define := t : j j j , where j = min j +C , J . For k k min k + Th { j ∈ T h ≤ ≤ h∗} h∗ { h ε } h ≤ ≤ { h Cε,kh+1−1}, fix vectors ρk ∈{0,1,...,(cid:100)1ε(cid:101)}|Th| such that ρtj,k ≤ρtj+1,k for all j :jh ≤j <jh∗ and ρ 1. tjh,kh ≥ For each profit class k [K] we assume that items I = ik,...,ik in this class are ordered ∈ k { 1 |Ik|} so that w w w . Based on our choice (S,ρ) we define the polytope: ik1 ≤ ik2 ≤···≤ ik|Ii| P(S,ρ)= x RTn : wTx b t [T] (2) t t { ∈ ≤ ∀ ∈ x x t [T 1] (3) t t+1 ≤ ∀ ∈ − 0 x 1 t [T] (4) t ≤ ≤ ∀ ∈ x = =x =0, h [S ], k <k , t<t (5) t,ik1 ··· t,ik|Ik| ∀ ∈ | | ∀ h+1 ∀ jh x = =x =1, h [S ], t (6) tj,ik1 ··· tj,ikρtj,k ∀ ∈ | | ∀ j ∈Th 1 x = =x =0, h [S ], t :ρ < . (7) tj,ik(ρtj,k+1) ··· tj,ik|Ik| ∀ ∈ | | ∀ j ∈Th tj,k ε} NotethatsomechoicesofS,ρmayleadtoemptypolytopes. FixS,ρ, anitemiandsometimet. If, for some t(cid:48) t, xt(cid:48),i = 1 explicitly appears in the definition of P(S,ρ) above, then we say that i is ≤ t-included. Conversely, if xt¯,i =0 explicitly appears for some t¯≥t, then we say that i is t-excluded. Theorem 7. Any optimum solution of max (cid:80) pTx : x ( P(S,ρ)) 0,1 Tn is a 1-in { t t ∈ ∪S,ρ, ∩{ } } t [T] solution of maximum profit for . Moreover, t∈he the number of constraints of the associated LP relaxation is at most nTf(ε) for sIome function f :R R depending on ε only. >0 >0 → 7 pk (j ,k ) S S tj 0 | | | | K 1 jh+1 ρ jh jh+C(cid:15) (jj,k1) J j1∗ kh kh+C(cid:15) kh+1 Figure 2: An example of a stairway S, given by thick black dots. Entries (j,k) lying in the light gre are those for which a value ρ is specified. No item corresponding to the entries in the dark grey is taken, except on the boundary in bold. Proof. The first part of the statement follows from the previous discussion. The second from the fact that the possible choices of (S,ρ) are (# stairways) (# possible values in each entry of ρ) (max# entries of a vector ρ ) · = 2O(1εlogTε) O(1) O(1εlogTε)(Cε)2 · ε = (T)O(1ε) (T)O((1ε)4), ε · ε and each of them has g(ε)O(Tn) constraints, where g depends on ε only. 2.4 Rounding Byconvexity, there isa choiceof S and ρ asin theprevioussectionsuchthat anyoptimum solution of (cid:88) max pTx :x P(S,ρ) (8) t { ∈ } t [T] ∈ is also an optimum solution to max (cid:80) pTx : x conv( P(S,ρ)) . Hence, we can focus on { t [T] t ∈ ∪S,ρ } ∈ rounding an optimum solution x of (8). For h [S ], := i:i is in profit class k for some k ∗ h ∈ | | O { ∈ Kh} with Kh :={kh ≤k <kh+1}, and O∞ :=[n]\∪|hS=|1Oh. Hence, O∞ isthe setofitems fromthe small profit class. Let o ,o ,...,o be items from sorted by decreasing value of their profit / weight ratio. Moreove1r, l2et t (r|Oeshp|. t) be the setOohf items from that are t-included (resp. Ih (cid:80)Eh Oh t-excluded)and,fort [T],letW := w x . Algorithm1produces,foreachh [S ] , a value x¯ for t [T∈] and i t. Respi∈eOcthingit∗th,ie choices of S and ρ, at each time t∈A|lgo|r∪it{h∞m}1 t,i h ∈ ∈ O greedly adds objects into the knapsack, until the total weight is at most W . The juxtaposition x¯ t of those vectors is the claimed approximated integer solution. As in max-K we aim at obtaining a rounded solution which differs from x by profit of at most one item (at each time). However, the ∗ structure of x is much more subtle then the optimal fractional solution of max-K. ∗ Theorem 8. Let x be an optimum solution to (8). Apply Algorithm 1 for each h [S ] , ∗ as to produce, in time O(T +n), an integer vector x¯. Then x P(S,ρ) and (cid:80) ∈pT| x¯| ∪{(∞1} ∈ t [T] t ≥ − 3ε)(cid:80) pTx . ∈ t [T] ∗t ∈ 8 Algorithm 1 1: For all i h, set x¯0,i =0. ∈O 2: For t=1,...,T: (a) Set x¯ =x¯ . t t 1 − (b) Set x¯ =1 for all i t. t,i ∈Ih (c) Select the smallest p N such that o / t and x¯ =0. ∈ p ∈Eh t,op (cid:80) (d) If w W w x¯ , set x¯ =1 and go to (c), else stop. op ≤ t− i∈Oh i t,i t,op Theorem8willbeprovedinaseriesofintermediatesteps. Untildifferentlyspecified,wesuppose that h [S ] is fixed. ∈ | | ∪{∞} Claim 3. Let t [T 1]. Then: ∈ − (i) t t+1 and t t+1. Ih ⊆Ih Eh ⊇Eh (ii) t+1 t t. Ih \Ih ⊆Eh Proof. (i) Immediately from the definition. (ii) Ift+I1ht+1 \tIchtan(cid:54)=o∅n,lywbeediendubcuecktet+s1k=: ktj forks<omke jhw≤hejre≤ρjh∗<. B1y .coHnsetnrcuec,tiaolnl,ittehmesitfreomms Ih \Ih h ≤ h+1 t,k (cid:100)ε(cid:101) t+1 t are t-excluded. Ih \Ih (cid:80) Recall that, for t [T], let W := w x . Note that W = W = = W = 0 and W W for all∈t [T 1].tAlgoritih∈mOh2 piro∗tv,iides a construct1ive way2 to ·p·r·oducettjhhe−1restriction t t+1 ≤ ∈ − to of an optimum solution to (8). h O Algorithm 2 1: For all i∈Oh, set x(cid:48)0,i =0. 2: For t=1,...,T: (a) Set x =x . (cid:48)t (cid:48)t 1 − (b) Set x =1 for all i t. (cid:48)t,i ∈Ih (cid:80) (c) While W w x >0: t− i∈Oh i (cid:48)t,i (i) Select the smallest p N such that o / t and x <1. ∈ p ∈Eh (cid:48)t,op (ii) Set x =x +min 1 x ,Wt−(cid:80)i∈Ohwix(cid:48)t,i . (cid:48)t,op (cid:48)t,op { − (cid:48)t,op wop } The proof of the following claim easily follows by construction. Claim 4. (i) For t [t 1] and i , one has x =x =0. ∈ jh − ∈Oh ∗t,i (cid:48)t,i (ii) For t [T 1] and i , one has x x 0. ∈ − ∈Oh (cid:48)t+1,i ≥ (cid:48)t,i ≥ 9 (iii) For t [T], one has: x =x =1 for i t and x =x =0 for i t. ∈ ∗t,i (cid:48)t,i ∈Ih ∗t,i (cid:48)t,i ∈Eh (cid:80) Claim 5. Let x be the solution produced by Algorithm 2. Then for each t [T], w x = (cid:80) w x and(cid:48) (cid:80) p x =(cid:80) p x . ∈ i∈Oh i (cid:48)t,i i∈Oh i ∗t,i i∈Oh i (cid:48)t,i i∈Oh i ∗t,i Proof. We first prove the statement on the weights by induction on t, the basic step being trivial. Suppose it is true up to time t 1. The total weight of solution x after step (b) is − (cid:48)t (cid:80) (cid:80) (cid:80) w x + w (1 x ) = W + w (1 x ) i∈Oh i (cid:48)t−1,i i∈Iht\Iht−1 i − (cid:48)t−1,i t−1 i∈Iht\Iht−1 i − ∗t−1,i = W +(cid:80) w (∗)W , t−1 i∈Iht\Iht−1 i ≤ t wheretheequationsfollowbyinduction,Claim4.(iii),andClaim3.(ii),and( )followsbyobserving (cid:80) (cid:80) ∗ w x w x w . x isafterwordsincreased untilitstotal weight isat most i∈Oh i ∗t,i− i ∗t−1,i ≥ i∈Iht\Iht−1 i (cid:48)t W . Last, observe that W is always achieved, since it is achieved by x . This concludes the proof t t ∗t of the first statement. We now move to the statement on profits. Note that it immediately follows from the optimality ofx andthefirstpartoftheclaimifweshowthatx isthesolutionmaximizingpTx forallt [T], ∗ (cid:48) t (cid:80) ∈ among all x P(S,ρ) that satisfy w x = W for all t [T]. So let us prove the latter. Suppose by c∈ontradiction this is not thie∈Ocahse,iatn,id let x˜tbe one suc∈h solution such that pTx˜ >pTx t (cid:48)t for some t [T]. Among all such x˜, take one that is lexicographically maximal, where entries are ∈ ordered (1,o ),(1,o ),...,(1,o ),(2,o )...,(T,o ). Then there exists τ [T], (cid:96) [ ] such 1 2 |Oh| 1 |Oh| ∈ ∈ |Oh| that x˜ > x . Pick τ minimum such that this happens, and (cid:96) minimum for this τ. Using that x =τx˜,o(cid:96) for(cid:48)τi,o(cid:96) τ τ since x,x˜ P(S,ρ) and recalling (cid:80) w x = (cid:80) w x˜ = W on(cid:48)τ,ei obtaτi,nis ∈ Ih ∪Eh (cid:48) ∈ i∈Oh i (cid:48)τ,i i∈Oh i τ,i τ (cid:88) (cid:88) w x = w x˜ (9) i (cid:48)τ,i i τ,i i∈Oh\(Ihτ∪Ehτ) i∈Oh\(Ihτ∪Ehτ) It must be that x < 1, since x < x˜ 1, so step (c) of Algorithm 2 in iteration τ did (cid:48)τ,o(cid:96) (cid:48)τ,o(cid:96) τ,o(cid:96) ≤ not change any item o : (cid:96)ˆ> (cid:96), i.e. x = x for each (cid:96)ˆ> l. Additionally, (cid:96) / τ beacuse x < 1, and (cid:96) / τ s(cid:96)ˆince otherwise x(cid:48)τ,o(cid:96)ˆ = x˜(cid:48)τ−1,=o(cid:96)ˆ0. Hence, (cid:96) ( τ τ). W∈eIrhewrite (9) (cid:48)τ,o(cid:96) ∈ Eh (cid:48)τ,o(cid:96) τ,o(cid:96) ∈ Oh\ Ih ∪Eh as follows: (cid:88) (cid:88) (cid:88) w x = w x˜ + w (x˜ x ) o(cid:96)¯ (cid:48)τ,o(cid:96)¯ o(cid:96)¯ τ,o(cid:96)¯ o(cid:96)ˆ τ,o(cid:96)ˆ− (cid:48)τ,o(cid:96)ˆ o(cid:96)¯∈Oh\(cid:96)¯≤(I(cid:96)hτ∪Ehτ): o(cid:96)¯∈Oh\(cid:96)¯≤(I(cid:96)hτ∪Ehτ): o(cid:96)ˆ∈Oh\(cid:96)ˆ>(I(cid:96)hτ∪Ehτ): =x(cid:124)(cid:48)τ(cid:123)−(cid:122)1(cid:125),o(cid:96)ˆ (cid:80) (cid:80) By minimality of τ one has x˜ x , so w x˜ = W = w x implies x˜ =x and thus τ−1 ≤ (cid:48)τ−1 i∈Oh i τ−1,i τ−1 i∈Oh i (cid:48)τ−1,i τ 1 (cid:48)τ 1 − − 0 (cid:122) ≥(cid:125)(cid:124) (cid:123) (cid:88) (cid:88) (cid:88) w x = w x˜ + w (x˜ x˜ ) (10) o(cid:96)¯ (cid:48)τ,o(cid:96)¯ o(cid:96)¯ τ,o(cid:96)¯ o(cid:96)ˆ τ,o(cid:96)ˆ− τ−1,o(cid:96)ˆ o(cid:96)¯∈Oh\(cid:96)¯(I(cid:96)hτ∪Ehτ): o(cid:96)¯∈Oh\(cid:96)¯(I(cid:96)hτ∪Ehτ): o(cid:96)ˆ∈Oh\(cid:96)ˆ>(I(cid:96)hτ∪Ehτ): ≤ ≤ Notethattheitemsin areorderedaccordingtomonotonicallydecreasingprofit/weightratio. h By minimality of (cid:96) subjectOto τ we have that x x˜ for (cid:96)¯< (cid:96). Thus combining x < x˜ (cid:48)τ,o(cid:96)¯ ≥ τ,o(cid:96)¯ (cid:48)τ,o(cid:96) τ,o(cid:96) with (10) gives that there exists β <(cid:96) such that x >x˜ . Then for all τ¯ τ, one can perturb (cid:48)τ,oβ τ,o(cid:96)¯ (cid:80)≥ x˜ by increasing x˜ and decreasing x˜ while keeping x˜ P(S,ρ) and w x˜ = W , without decreasingτ¯,opβTx˜ . This contradicτ¯t,os(cid:96)the choice of x˜ bei∈ng lexicographicail∈lyOmh axτ¯,iimaτ¯,li. τ¯ τ¯ Because of Claim 5, we suppose wlog x = x for t [T] and i . Note that Algorithm 1 ∗t,i (cid:48)t,i ∈ ∈ Oh can be seen as a “discrete version” of Algorithm 2. 10