Contents lists available atScienceDirect
Theoretical
Computer
Science
www.elsevier.com/locate/tcs
Improved
approximation
algorithms
for
a
bilevel
knapsack
problem
Xian Qiu
a,
∗
,
1,
Walter Kern
baCollegeofComputerScience,ZhejiangUniversity,China
bDepartmentofAppliedMathematics,UniversityofTwente,Netherlands
a
r
t
i
c
l
e
i
n
f
o
a
b
s
t
r
a
c
t
Articlehistory:
Received20September2014 Receivedinrevisedform13May2015 Accepted13June2015
Availableonline19June2015 CommunicatedbyX.Deng Keywords: Bilevel Knapsack Approximationalgorithm Stackelberg
Westudythe Stackelberg/bilevelknapsackproblemasproposedbyChenand Zhang[1]: Consider two agents, a leader and a follower. Each has his own knapsack. (Knapsack capacitiesare possibly different.) Asusual, there is aset of itemsi=1, . . . , n ofgiven weights wiandprofitspi.Itisallowedtopackitemi intobothknapsacks,butinthiscase
thecorrespondingprofitforeachplayerbecomespi+ai,whereai isagiven(positiveor
negative)number.Theobjectiveistofindapackingfortheleadersuchthatthetotalprofit ofthetwoknapsacksismaximized,assumingthatthefolloweractsselfishly.Wepresent tightapproximationalgorithmsforallsettingsconsideredin[1].
©2015ElsevierB.V.All rights reserved.
1. Introduction
The standardknapsackproblemisoneofthemostfundamentalandwell-studiedproblemsincombinatorial optimiza-tion: There isa knapsackofprescribed capacityW and n items withgivensize wi andprofit pi.The taskisto selecta set ofitemsoftotalsize atmostW and maximumtotalprofit. Afirst bilevelvariant(in theformofa
Stackelberg game)
was introducedbyDempeandRichter
[2]
:Therearetwodecisionmakers(players)–aleader and
afollower –
aswellasa (universal)knapsackwithflexiblecapacityandasetofitemswithgivensizesasabove,yetitemprofitsmayvaryw.r.t. the leader andthefollower,respectively.Theleaderfirstdeterminesthecapacityoftheknapsack,andafterwardsthefollower, assumedtobeselfish,packsitemstotheknapsack,maximizinghisownprofit.The(leader’sbilevel)problemistocompute the knapsackcapacitysuch that the leader’s profit–definedby a linearfunction oftheknapsack capacityplus histotal profitofpackeditems–ismaximized.Severalotherbilevelvariantsofknapsackhavebeenproposedaswell. Forexample,Mansi etal.
[12]
studyasettingin whichboth theleaderandthefollowerpackitemsintoaknapsack(offixedcapacity).DeNegre [17]investigatesabilevel version whereboth playersown aprivate knapsackeachandpackitemsfroma commonitemset.Again,theleader acts first,selectingasetofitemsforhisownknapsack,thenthefollowerpacksitemsfromtheremainingitemsetintohisown knapsack,seekingtomaximize histotalprofit.The objectiveofthe(hostile)leaderisto choosehissetofitemssuchthat thefollower’sprofitisminimized.*
Correspondingauthor.E-mailaddresses:xianqiu@zju.edu.cn(X. Qiu),w.kern@utwente.nl(W. Kern).
1 SupportedbytheNaturalScienceFoundationofZhejiangProvince,No.LQ15A010001andtheFundamentalResearchFundsfortheCentralUniversities ofChina.
http://dx.doi.org/10.1016/j.tcs.2015.06.027 0304-3975/©2015ElsevierB.V.All rights reserved.
Cases Approx. ratios[1] Lower bounds ai≤0 2+ 1.5 ai≥0 W1>W2 W1<W2 1+√2+ 2+ 1.5 2 Fig. 1. Known lower bounds.
Inthispaperweconsideryetanothervariantofthebilevelknapsackproblem,duetoChenandZhang
[1]
.Inthissetting, again,eachplayerhashisownknapsackoffixedcapacities W1andW
2,respectively.Items1,
. . . ,
n have fixedweights wi andprofitsp
i.Thecharacteristicfeatureofthemodelin[1]
isthatitemsmaybedouble-packed, i.e. packed
bybothplayers. Incaseitemi is
packedonlybyoneplayer,itaccountsforaprofitofp
i,asusual, however,ifi is
packedbybothplayers, itsprofit(forbothplayers)ismodified to pi+
ai forgivenprofit modifier a
i∈ R
.Again,thesettingisthatofaStackelberg game,andtheobjectiveistoexhibit an optimalpackingfortheleader,i.e.,
one thatmaximizesthetotal profitassuming that the second player (the follower) actsselfishly (disregarding the impact anydouble packing mayhave on the items packedby theleader).Asamotivatingexample,ChenandZhangmentionthecaseoftwoinvestors,say,the government andacompany withbudgets W1 and W2,respectively.Items correspondtopotential projects ofcost wi andreward pi, resp. pi+
ai witha
i>
0 ifbothplayersinvestinprojecti. Dependingontheapplication, thenumbersa
i maybepositive ornegative (“double booking”).Incasealla
i are positive,ChenandZhang[1]
call itthebeneficial model and
ifalla
i are negative,itisreferredtoasthecompetitive model.
Bileveloptimizationis oftencomputationally difficultandlikely toextend beyondNP.In thelast decades, bilevel and multilevel optimizationhavereceived much attentionin theliterature (cf. books by Migdalas, Pardalos andVärbrand [4]
andDempe
[3]
,asurveybyColsonetal.[5]
).DempeandRichter[2]
introducedamixedintegerbilevelprogramfortheir problemvariant andproposed an algorithm basedon branch andbound. Afterwards,a dynamic programmingalgorithm forthisproblemwasgivenby Brotcorneetal.[6]
.Recently, Capraraetal.[7]
provedthat thefirstthreeproblemvariants mentionedaboveare2P-hard(probablythefourthoneisaswell),
i.e.,
thereisnowayofformulatingthemassingle-level integer programs of polynomial size unless the polynomial hierarchy collapses (cf. [7]for more details).In particular, they showedthatthefirsttwovariants(cf. DempeandRichter[2]
,Mansietal.[12]
)donotpossessapolynomialapproximation algorithmwithfiniteworst caseguaranteeunless P=
NP and proposed apolynomial timeapproximation schemeforthe thirdvariant(cf. DeNegre[17]
),whichisknownasthefirstapproximationschemefora2P-hardproblem.Forothervariants andrelatedproblems,
cf.
[8–12].Regarding the problem to be considered in this paper, Chen and Zhang [1] proposed a
(
2+
)
-approximation algo-rithmforthecompetitivemodel(ai≤
0),and,forthebeneficialmodel(ai≥
0),a(
1+
√
2+
)
-approximationforthecaseW1
>
W2 anda(
2+
)
-approximationforthecaseW
1≤
W2.In thispaper, we presentbetter approximation algorithms forthe beneficial model aswell asthe competitive model andshowthat theapproximationratiosaretight ineachcase, i.e., theapproximationratios canbemadearbitrarily close to theknownlower bounds(cf. Fig. 1). The mainingredients ofour approachare: An
-approximation ofthemaximum profitproblemincasebothplayerscooperate–whichmaybeofindependentinterest,
cf.
(P3)inSection2–andafactor revealingLPforestimatingthequalityofourapproximationalgorithms(cf. Jainetal.[18]
).Therestofthepaperisorganizedasfollows:Inthesectionbelow,we formallyintroducethebilevel problem(cf.(P1)
inSection2)andits“cooperative”counterpart(cf.(P3)).InSection3,wedescribeapolynomialtimeapproximationscheme (PTAS)forthecooperativeproblemversion
(P3)
.InSection4,wepresentnewapproximationalgorithmsandanalyzetheir approximationratios.Finally,inSection5,wementionsomeopenproblems.2. Bilevelknapsackwithindependentknapsacks
Let W1, W2 be capacities ofthe knapsacks ownedby player 1 (leader)and player2 (follower), respectively. Let A
=
{
1,
2, . . . ,
n}
be a set of itemsof weight wi, profit pi and “double packing modifier” ai for all i∈
A. Let xi,
y
i∈ {
0,
1}
indicatewhetheritemi is
packedbyplayer1andplayer2,respectively.Recallthatthe profitofitem i is modified to pi
+
ai ifi is packedby bothplayers. Thusthe leader’s problemcan be formulatedasabilevelintegerprogramasfollows:max x n
i=1 pi(
xi+
yi)
+
2 n i=1 aixiyi (P1) s.t. n i=1 wixi≤
W1,
xi∈ {
0,
1} ,
i=
1,
2, . . . ,
n,
max y n
i=1 piyi+
n i=1 aixiyi (P2) s.t. n i=1 wiyi≤
W2,
yi∈ {
0,
1} ,
i=
1,
2, . . . ,
n.
Notethatforfixed
x there
mayexistmultiplecorrespondingoptimalsolutions y for player2.Inouranalysis,wealways assumeaworstcasescenario,i.e. we
focusona“pessimistic”versionoftheabovebilevelproblem,whereplayer2chooses an optimalsolution y of (P2)minimizing the objectiveof(P1)
. Wecall theoutcome ofthispessimistic versionthe com-petitive optimum and –asinthepaperbyChen andZhang[1]
–compareittotheso-calledcooperative optimum, i.e., the maximumtotalprofitthetwoplayerscouldachieve.Thelattercanbeexpressedbya(singlelevel)integerprogrammax n
i=1 pi(
xi+
yi)
+
2 n i=1 aixiyi s.t. n i=1 wixi≤
W1,
n i=1 wiyi≤
W2,
xi,
yi∈ {
0,
1} .
(P3)Example.Considertwoknapsacksofcapacity
W
1=
1 (fortheleader)andcapacityW2=
2 (forthefollower).Theitemsetcontainstwoitemsofweights
w
1=
1,w
2=
2,profitsp
1=
2, p2=
1 andmodifiersa
1= −
1 (a2 isarbitrary).Observethatplayer1onlyhastwooptions: Packingitem1orpackingnothing.Ifplayer1packsitem1,then player2 gets amaximalprofit1 byeitherpackingitem1oritem2,resultinginatotalprofit2 or3 respectively.Ifplayer1packs nothing,thenplayer2packsitem1,resultinginatotalprofit2.Thus,thecooperativeoptimummaybeaslargeas1
.
5 times thecompetitive optimum.Weaimatshowingthatthisexampleisaworst caseexampleinthesense thatifallmodifiersaiarenegative,thentheratiobetweenthecooperativeandcompetitiveoptimumisboundedby1.5andthatsolutions
x for
theleader’sproblemensuringaratioof1.
5+
canbefoundinpolynomialtime.Similarly,wepresenttightboundsforthe caseofnon-negative
a
i and,eventually,themixedcasewithbothpositiveandnegativedoublepackingmodifiers.2.1. Dynamic programming for (P3)
We derivea straightforwardpseudo-polynomialalgorithmfor
(P3)
basedondynamic programming.Let fi(
a,
b)
be the maximumtotalprofitwithknapsackcapacitiesa
,
b w.r.t. itemset{
1, . . . ,
i}
,fora
,
b,
i∈ Z
+,1≤
i≤
n, a≤
W1,b
≤
W2.The recursiveformulaisdefinedbyfi+1
(
a,
b)
=
max{
fi(
a,
b),
fi
(
a−
wi+1,
b)
+
pi+1,
fi(
a,
b−
wi+1)
+
pi+1,
fi
(
a−
wi+1,
b−
wi+1)
+
2pi+1+
2ai+1}.
Theinitialconditionis f1
(
a,
b)
=
max{
p1
,
2p1+
2a1} ,
a=
w1,
b=
w1,
p1
,
a=
w1,
b<
w1or a<
w1,
b=
w1,
0
,
a<
w1,
b<
w1.
It isstraightforwardtocheckthat fn
(
W1,
W2)
returnsthemaximumprofitfor(P3)
andthealgorithmhasarunningtime O(
nW1W2)
.3. Polynomialtimeapproximationschemefor(P3)
As afirststep,wecompute approximatelyoptimalcooperativesolutions.Itiswell knownthatknapsackcanbesolved byafullypolynomialtimeapproximationscheme(FPTAS)(cf.[13,14]).As
(P3)
witha
i→ −∞
becomesamultipleknapsack problemwithtwo knapsacks,wecannot expectanFPTASfor(P3)
unless P=
NP (cf.[15]).Inthefollowing,we seekfora polynomialtimeapproximationscheme(PTAS)for(P3)
.We startwithsome notations.Foranyset S of items, let w
(
S)
and p(
S)
denotethe totalweight andthetotal profit of itemsin S, respectively, i.e., w(
S)
=
i∈Swi and p(
S)
=
i∈Spi. Since theprofits of itemsmaybe modified dueto double-packing, p
(
S)
mayalsodenotethemodifiedtotalprofitofitemsin S if nomisunderstandingispossible.As it turnsout,
negative items,
i.e., those witha
i<
0,andnon-negative items (those
withai≥
0) can be treated inde-pendently. Therefore,we simplifymattersby first assuming thatall items arenegative (non-negative itemswill be dealt afterwards).Fortechnicalreasons(tobeexplainedintheproof)we slightlygeneralizeourproblem,assuming thatcertain items,say,itemsinthesetN
1⊆
N, arenotallowedtobedouble-packed.Weletn
1= |
N1|
denotethenumberofitemsthatareprescribedtobesingle,and
n
2isthenumberofitemsinN
2=
N\
N1thatmaybedouble-packed.Thusn
1+
n2=
n. Ourprooffortheapproximationratiowillbebyinductionon
n
1+
2n2.Wedescribe an O
(
1−
1/
k)
-approximationalgorithm–againdenotedbyALG –proceedingina similarwaytothatof Sahni[16]
.Onedifferenceisthatforadouble-packableitemi we
distinguishbetweenitsprimary copy i with
anassociated profit pi anditssecondary copy i with
profit pi+
2ai<
pi.Let S∗=
S∗1∪
S∗2=
supp x∗∪
supp y∗ be anoptimalsolution of(P3).Observethat–aswedistinguishprimaryandsecondarycopies–theset S∗maybeunderstoodasaset rather
than amultiset.InphaseI,ALGseeksto“guess”thek most
profitableitemsfromtheoptimumsolutionS
∗1∪
S∗2 toincludethem intheinitialpacking.Incaseanitemi is
double-packedinS
∗,and(theprimarycopyof)i belongs
tothek most
profitable items, wewantALGto includealsothesecondary copyintotheinitialpacking.Forthisreason, welet ALGstartfromall initialpackings withuptok primary
itemsplussome oftheir secondarycopiesandlet S=
S1∪
S2 be thissetofitems,with
S
1,
S
2packedonknapsacks1and2,respectively.Thesecondphase,again,considerstheremainingitemsinorderofnon-increasingprofitrates.Asinthesingleknapsack case,itproceedsinatrueonlinemannerasexplainedbelow.Inparticular,wheneverALGchecksanitem
i,
itimmediately decidesuponpackingornotpackingi,
butdoesnotyetdecidewhetheri should
bedouble-packed.Notethat,aswestickto thecaseofnegativeitemshere,wehavep
i+
2ai<
pi,sothatprimaryitemscomewithhigherprofitratesandarechecked forinclusionbeforetheircorrespondingsecondarycopiesarrive.Summarizing,inphaseII,ALGconsidersthe(copiesof)itemsin
{
1, . . . ,
n} \
S in orderofnon-increasingprofitrates ri1≥
ri2≥ . . . ≥
rim(
m=
n1+
2n2− |
S|)
definedasexplainedabove.
WheneverALG checksa primaryitem
i
=
it,theitem ispackedwherever itfits. Incaseitdoesnot fitanywhere,the itemisskipped.WheneverALGchecksasecondaryitem i=
it,itisperfectlyclearonwhichknapsacki should
bepacked andALGseekstoaccommodateitemi there,
say,onknapsack1,by“switching”singleitemsfromknapsack 1toknapsack 2 ifnecessary.Moreprecisely,ALG considersallsingle (primary)itemsfrom{
1,
. . . ,
n}\
S currently packedonknapsack1in someorderandswitchesthemontoknapsack2whenevertheyfitthere,untileitheritemi can
eventuallybeaccommodated onknapsack1ornofurthersingleitemcanbeswitchedtoknapsack2whileitemi still
cannotbeaddedtoknapsack1.In thelattercase,itemi
=
it isskipped.Theorderinwhichitemsareconsideredforswitchingfromknapsack1toknapsack2 isnotrelevant,butitisconvenienttousea“lastinfirstout”orderasswitchingrule.Notethatanypackeditemremainspacked,onlytheassignmenttoaparticularknapsackmayberevised(possiblyeven severaltimes),duetoswitching.
Lemma1.
ALG as described above yields a
(
1−
2/
k)
-approximation for (P3)(assuming that all items are negative).Proof. Theproof isbyinductionon
n
1+
2n2.The claimisobviouslytrueforn
1+
2n2≤
k. Indeed,whenevertheoptimalsolution
S
∗=
S∗1∪
S∗2contains2k orlessitems,thenALGwillexhibitS
∗ inphaseI.Hence, let us assume that n1
+
2n2>
k and follow the computation of ALG, assuming that in phase I, S=
S1∪
S2containingthe
k largest
profititemsfromS
∗arepackedinthesamewayandwiththesamemultiplicitiesasintheoptimal solution.Leti
=
it denotethefirstitemthatisskippedbyALG.Ifi
∈
N1,theproofisalmostidenticaltothesingleknapsackcase:As wi exceedstheremainingcapacity,say,
c
1,
c2 respectively,forbothknapsacks,thetotalremainingcapacityc
1+
c2satisfies
c
1+
c2<
2wi.Ifwecompare thecurrenttotalprofit Pt−1 ofALG, justafteritemi
t−1 hasbeenplaced,thetotalusedcapacityequals
W
1+
W2− (
c1+
c2)
and–sinceALGpacksinorderofnon-increasingprofitrates–nootherpackingcanachieveahigherprofitonthispart.Consequently,nootherpackingalgorithmcanachieveatotalprofitlargerthanor equalto Pt−1
+
2(
c1+
c2)
ri(theamountthatwouldbeachievedbypackinganitemwithprofitrateequaltor
i,butsmaller size(c1,
c2 respectively), therebyexhausting exactlybothknapsack capacities).Hence, thefinal totalprofit P achieved byALGcomparestotheoptimumprofit P∗asfollows: P∗
≤
P+ (
c1+
c2)
ri<
P+
2wiri=
P+
2pi.
Thus, ifi
∈
S∗1∪
S∗2,then pi≤
P∗/
k and we get P≥
P∗(
1−
2/
k)
asrequired. Else,ifi∈
/
S∗1∪
S∗2,then P and P∗ remainunchangedifweremoveitem i,therebydecreasing
n
1+
2n2 byone,sotheclaimfollowsbyinduction.The same argumentworks without anychange in casei
=
it∈
N2 is a primary item, exceptthat by removing i, wedecrease
n
1+
2n2 by two. Thus assume nowthat i=
it∈
N2 isalready packed,say, onknapsack 1,but thesecondary idoesnot fitonknapsack2,evenafterswitchingamaximal setofitemsfromknapsack2toknapsack1.Thesituationcan be described asfollows: Besides the initial packing S1
,
S2, thereis a certain set D of itemsthat aredouble-packed andFig. 2. Packing negative items.
sets J1
,
J
2 ofsingle/primary itemson knapsack1and2,respectively. Byassumption,the remaining capacitiesc
1 andc
2on knapsack 1 and2 satisfy: c2
<
wi (item i does not fit) and c1≤
wj for every j∈
J2 (no j∈
J2 can be switched toknapsack 1).Let D∗ denotetheset ofitemsthat aredouble-packedinthe optimumsolution.
Fig. 2
belowillustrates the currentsituation.First note that, again, we mayassume that i
∈
J1∩
D∗.Otherwise, ifi∈
J1\
D∗,prescribing i as single wouldreduce n1+
2n2 butotherwise affectneither ALG nor the optimum solution, and the claim would follow by induction. Hence i=
it∈
J1∩
D∗ indeed.Hence pi≤
1kp(
S1∪
S2)
≤
1kP∗ follows.Asimilarargumentshowsthatwemayassume j
∈
/
S∗1∪
S∗2 forany j∈
J2:If j∈
S∗1∪
S∗2,then pj≤
1kp(
S∗1∪
S∗2)
≤
1kP∗. Thus if c1,
c2 are the remaining capacities on knapsack 1 and 2 respectively, then (due to the fact that ALG proceedsaccordingtonon-increasingprofitrates)wehave
r
j≥
riandhence P∗≤
P+ (
c1+
c2)
ri≤
P+
c1rj+
c2ri<
P+
wjrj+
wiri=
P+
pj+
pi≤
P+
2 kP∗
andtheclaimwouldfollow.Hencewemayassumeindeedthat J2
∩ (
S1∗∪
S∗2)
= ∅
.Aswehaveseenabove,wemayassumethat
p
i≤
P∗/
k, sowecanaffordskippingthesecondaryitemi
=
it.Theproblem isthati
t+1,
it+2 etc.mightbesimilarsecondaryitemsthatwehavetoskip.Thus howmuchskippingcanweafford?Theanswerisgivenby thesizeof J2 andD
\
D∗:Astheitemsin J2 arenot packedintheoptimumsolutionandtheitemsin D\
D∗ areatleastnotdouble-packedintheoptimumsolution.ALGspendsatotalofw
=
w(
J2)
+
w(
D\
D∗)
packingitemsatrate
r
≥
ri which arenot packedby an optimalalgorithm, say,OPT. Instead,OPTpacksthe secondaryitemsi
=
it and subsequentsecondaryitemsatrater
≤
ri.Thuswecanaffordskippingsecondaryitemsoftotalsizew without
fallingback behind OPT(theonethatbuilds S∗=
S∗1∪
S∗2).Thegoodnewsisthat,roughly,nomorethanthisisabouttocome:IfOPT buildstheoptimumsolutionS
∗1,
S
∗2,thenitpacksS
2 andD
∩
D∗onknapsack2,sotheremainingspaceforsecondaryitems i∈
S∗1∪
S∗2 isboundedbyW2
−
w(
S2)
−
w(
D∩
D∗)
≤
w(
D\
D∗)
+
w(
J2)
+
wi=
w+
wi.
Thusthetotalsizeofsecondaryitemsthatweskipcanbecompensatedbytheprofitwegainwhilepacking J2and
D
\
D∗,exceptforanamountofatmost
w
iri=
pi.Thus atleast after skipping that many secondary itemssomething else must happen: Either a single item i that we skip or a secondary item j
∈
J2 that we cannot accommodate on knapsack 1. But then, again, even without anyeffortof reassigning items, we conclude that j
∈
S∗1∪
S∗2 (otherwise prescribe j as single and apply induction), implying thatpj
≤
P∗/
k and, hence–disregardingatotalofw for theskippedsecondary itemscompensatedby J2 and D\
D∗ –allwelooseisboundedby
p
i (onknapsack2)andpj(onknapsack1).Summarizing,weget P≥ (
1−
2/
k)
P∗alsointhiscase. WeliketostressthattheaboveargumentholdsalsowhenthesecondaryitemsthatALGskipsdonotcomeinarow.For example,itmightwellhappenthatALGskipsi
=
it,buti
t+1isa(primaryorsecondary)itemthatfitswellonknapsack 2,thereby enlargingD or J2.Itmayalsohappenthat–possiblyafterreassigningsome itemsin J1toknapsack2–anitem j
=
it+1 canbeaccommodatedonknapsack1.Inanycase,wheneverthenextsecondaryitem j to beputonknapsack2isskippedbyALG,thenthisisbecauseALGhastriedinvaintoaccommodate j by switchingsingleitemsfromknapsack2to knapsack1.Accordingtotheswitchingrule,ALGreassignsitemsina“lastinfirstout”order,ensuringthattheset J2that
wasblockingthesecondaryitem
i
=
it willstaypackedonknapsack2.(Thus,atalaterstage,wemightevenhavealarger set J 2⊃
J2, J2∩ (
S∗1∪
S∗2)
= ∅
,tocompensateforskipping.)2
It is an easy exercise tobound the runningtime:There are O
(
nk+1)
sets S of size|
S| ≤
k to choose fortheprimaryitems. Given S, weare lefttofixforeach
i
∈
S whether todouble-pack i or not,and, inthelattercase,wheretopackit (knapsack1or2).Thusintotalthenumberof“guesses”isboundedbyO
(
nk+13k)
.Nextletusturntothebeneficialmodel,whichturnsouttobeeasier:Assumethatallitemsin
N are
non-negative,i.e.,
ai≥
0.Ourapproximationalgorithm–denotedby ALG–inthiscase,will againhavea“guessing” phaseI, followedbya phase II, whereitemsare processedinorder ofnon-increasingprofitrates.Notethat thistime, however,double-packing yields higher profit rates than single packing, so ALG will first decide about double-packingitem i (at profit rate ri=
(
pi+
a1)/
wi) and then – in case of non-acceptance consider single-packing i at a later stage. Correspondingly, in the beneficial model,it doesnot makesense to distinguishbetweena primary andsecondary copyofitem i (as both arriveatthesametime).Thus, inwhat followswewill interpretan optimalsolution of(P3)asamultiset S∗
=
S∗1∪
S∗2, whereD∗
=
S∗1∩
S∗2 isthesetofdouble-packeditems.Inphase I,ALG guesses aset D
⊆ {
1,
. . . ,
n}
ofsize|
D|
≤
k (as acandidatefora setofmostprofitabledouble-packed itemsinan optimalsolution) aswellasaset S⊆ {
1,
. . . ,
n}\
D,|
S|
≤
k of mostprofitablesingle-packeditems. Inaddition, itguessesanumberl
≤
n indicating thetotalnumberofitemsthatshouldbedouble-packedbyALG(ontopofthealready chosensetD).
InphaseII,ALGprocessestheremainingitemsinorderofnon-increasingprofitratesasusual.Moreprecisely, let ri1=
pi1+
ai1 wi1≥ . . . ≥
ril=
pil+
ail wilbethe
l highest
double-packingprofitratesinN
2\
D. ThenALGdouble-packsasmuchaspossibleofi
1,
. . . ,
il (ontopof D) andthencontinues(afterpacking S1 andS2)withsinglepackingoftheremainingitems(i.e.,itemsin(
N1∪
N2)
\(
D∪
S∪
{
i1,
. . . ,
il})
)inorderofnon-increasingprofitrates.Thereare O
(
n2(k+1))
possiblechoicesforD and S,
andO(
2k)
bipartitionsofS.
Togetherwiththedifferentchoicesforl,
thereareO
(
n2k+32k)
differentchoicesofparameters.Lemma2.
For suitable choice of parameters D
,
S1,
S
2and l, ALG yields an approximation ratio(
1−
4/
k)
.Proof. Theproofisbyinductionon
n
1+
2n2.LetS
∗1,
S
∗2beanoptimalsolutionandletW
∗:=
w(
S1∗∩
S∗2)
bethetotalsizeofdouble-packeditems.If
S∗1∩
S∗2≤
k, thenALGwillguessD
=
S∗1∩
S∗2 exactly,otherwiselet D denote thesetofk highest
profit
(
=
pi+
ai)
itemsinS
∗1∩
S∗2 andassumel is
chosen suchthat w(
D)
+
wi1+ . . . +
wil≤
W∗ but w(
D)
+
wi1+ . . . +
wil+1
>
W∗.ThusALG,withthischoiceofparameters
D and l will
double-packi
1,
. . . ,
il(ontopofD),
butallfurtheritemswillgetat mostsingle-packed.Weclaimthatthetotaldouble-packingprofitisatleast(
p+
a)(
S∗1∩
S2∗)(
1−
2k)
,where(
p+
a)(
S∗1∩
S∗2)
:=
i∈S∗1∩S∗2
(
pi+
ai)
.Indeed,ifi=
il+1∈
S∗1∩
S∗2,thisfollowsin the–by now–usual mannerfrom pi+
ai≤
1k
(
p+
a)(
D)
. Else,ifi
∈
/
S∗1∩
S∗2,wemightprescribei as
single,thusdecreasingn
1+
2n2 andtheclaimfollowsbyinduction.ThusALGperformsverywellw.r.t.doublepacking,achievingalmostoptimalprofit,byusinglessspaceingeneral.Sowe arelefttoanalyzethesinglepackingpart.Ifatmost
k items
aresingle-packedintheoptimumsolution S∗1∪
S∗2,ALGwill exhibitthese(alongwiththecorrectassignmenttoknapsack1andknapsack2).Else,let S=
S1∪
S2 denotethek highest
profitsingle-packeditemsintheoptimumsolution(with Si packedonknapsack
i).
AsALG,whenitstarts single-packing items, hasatleastasmuchcapacityleft asOPToneachknapsack, S1 and S2 canbe single-packedwithoutanyproblem.Theremaining itemsare thenprocessedinorderofnon-increasingprofitratesandtheremaining partoftheproof isby nowroutine:Let
i
=
it bethefirstitemthatcannotbeaccommodated,neitheronknapsack1noronknapsack2.(Herewe donot needto trytoreassign anyitems.)Then thetotalprofit, say P , includingsingle-packeditemsobtainedby ALGat thistime,isatleasta(
1−
4/
k)
-fractionof P∗thetotalprofitintheoptimumsolution:Incase
i
∈
/
S∗1∩
S∗2,theclaimfollowsbyinductiononn
1+
2n2 ifweprescribei as
single item.Else,ifi
∈
S∗1∩
S∗2,then pi≤
pi+
ai≤
k1(
p+
a)(
S∗1∩
S∗2)
≤
1kP∗.Hence,addingacopyofitemi to
bothknapsacks(therebyviolatingtheir capacity constraints)wouldyieldaprofitlargerthanP
∗(
1−
2k)
.(Thefactor1−
2k takescareofthepossiblelossinthedouble-packing case.)Thus,intotal,whenskippingitemi,
wecanensureatotalprofitofatleastP∗(
1−
2k)
−
2pi≥
P∗(
1−
4k)
.2
Remark1.Weliketopointoutthatnegativeitemscannotbetreatedinsuchaneasyway:Consider,forexamplealistof2n itemswithpi
=
10,a
i= −
5 plus2n items withpi=
5,
ai= −
andwi
=
1 forall 4n items.Anoptimumpackingfortwo knapsacksofcapacity3n eachwouldsingle-packallitemswithp
i=
10 anddouble-packallremainingitems.Yet,a simple greedyheuristiclikethe“positiveitemvariant”ofALGwouldalwaysstartdouble-packingthe“highprofit”items–atleast wecannotpreventitfromdoingsobyprescribingthenumberl of
itemstobedouble-packed.We are left to combinethe two algorithms for negative and non-negative items in order to deal with “mixed” sets ofitems. The onlyway wefound worksin asense by “brute force”:We guesstheamount W1+ andW2+ ofcapacityan optimum solutionuses on knapsack 1and2 fornon-negative itemsrespectively andthen splitthe problemaccordingly intoonewithnegativeandone withnon-negativeitems.Inourcase,itissufficienttoapproximate
W
1+ andW
2+ uptoa factor1/
k, soweactuallyguessm
i:=
log1+1/kWiandrunthealgorithmwithW˜
i+= (
1+
1/
k)
mi insteadofW
i+.Thetotal numberofguessesweneedis O(
klogWi)
fori
=
1,
2,thusO
(
k2(
logW1)(
logW2))
intotal.Thisintroduces another possibleloss oforder1
/
k on thetotal profitgainedwithpositive items, so thatafter all,the combinedalgorithmALG willyieldatotal profitP with P≥ (
1−
1/
k)(
1−
4/
k)
P∗,where P∗ istheoptimumprofit. Thus wehaveshownTheorem1.
For fixed k, there exists a polynomial time algorithm ALG that approximates
(P3)up to a factor(
1−
5/
k)
in time O(
n2k+52klog W1log W2)
.4. Approximationalgorithmsfortheleader
Let S1 and S2 be optimalsolutions forthestandard single knapsackinstances withknapsack capacities W1 and W2,
resp., and profits pi for all items. In other words, S1 and S2 denote the support of optimal solutions of the following
problemwith
W
=
W1 andW
=
W2,resp.:max n
i=1 pixi s.t. n i=1 wixi≤
W,
xi∈ {
0,
1} ,
i=
1,
2, . . . ,
n.
(P4)Let
(
S∗1,
S
∗2)
beanoptimalsolutionofthecooperativerelaxation(P3)
.WefirstnotethatthevalueOPT of (P3)
satisfiesOPT
=
p(
S∗1)
+
p(
S∗2)
+
2h∗,
where h∗:=
i∈S∗1∩S∗2
ai
.
(1)Furthermore,wetriviallyhave
p
(
S∗1)
≤
p(
S1)
and p(
S∗2)
≤
p(
S2).
(2)As
(
S∗1,
S
∗2)
canbefoundbydynamicprogramming(cf. Section2.1)andcanbeapproximatedarbitrarilycloselybyaPTAS (cf. Section3),wefirstpresentanalgorithmbyassumingthat S∗1,
S
∗2,
S
1andS
2 canbefoundexactly.Afterwards,weshowthatweloseafactorof
ifthesesolutionsareapproximatedcorrespondingly(cf. Section4.3).We(first)treatthebeneficial andthecompetitivemodelseparately.
4.1. The beneficial model: ai
≥
0We presenta very simple algorithm and show that the approximation ratios are tight in both cases (W1
≥
W2 and W1<
W2).Algorithm1.Packoneof
S
∗1 andS1 (whicheverresultsinamaximumtotalprofit1).Assume firstthat player1packs S∗1 andplayer 2packssome set S.
ˆ
Lethˆ
=
i∈S∗1∩ˆS2ai.Then p
( ˆ
S2)
+ ˆ
h≥
p(
S ∗2
)
+
h∗.Denoteby
ALG the
valueobtainedbythealgorithm.Thus ALG=
p(
S∗1)
+
p( ˆ
S2)
+
2hˆ
≥
p(
S∗1)
+
p(
S∗2)
+
h∗+ ˆ
h.
Sincep
( ˆ
S2)
≤
p(
S2)
,wehaveˆ
h≥
p(
S∗2)
−
p( ˆ
S2)
+
h∗≥
p(
S∗2)
−
p(
S2)
+
h∗,
implying ALG≥
p(
S1∗)
+
2p(
S2∗)
−
p(
S2)
+
2h∗.
(3)Nowassumethatplayer1packs S1.Thenplayer2willgetatleast
p
(
S2)
bypacking S2,implying ALG≥
p(
S1)
+
p(
S2).
Besides,weobservethefollowing“knapsackconstraints”:
p
(
S1)
≥
p(
S2)
if W1≥
W2,
(4)p
(
S1)
≤
p(
S2)
if W1≤
W2.
(5)Let
α
=
ALG/
OPT. Wederivethefollowinglinearprogramforestimatingtheapproximationratio:minimize
α
subject to p(
S∗1)
+
p(
S∗2)
+
2h∗=
1,
α
≥
p(
S∗1)
+
2p(
S∗2)
−
p(
S2)
+
2h∗,
α
≥
p(
S1)
+
p(
S2),
p(
S1)
≥
p(
S∗1),
p(
S2)
≥
p(
S∗2),
p(
S1),
p(
S2),
p(
S∗1),
p(
S∗2),
h∗≥
0and the knapsack constraints hold
.
(6)
Theminimumvalue equals2
/
3 ifW
1≥
W2 and1/
2 ifW
1<
W2,proving thatOPT
/
ALG is atmost3/
2 resp. 2,matchingthelowerbounds(cf.[1]).
4.2. The competitive model: ai
<
0Inprinciple,wecouldalsoapply
Algorithm 1
tothiscase:Ifplayer1packsS
∗1,similartotheaboveargument,wehave ALG≥
p(
S∗1)
+
2p(
S∗2)
−
p(
S2)
+
2h∗.
In case of packing S1, we want to show that ALG
≥
p(
S1)
+
p(
S2)
+
2h, where h=
i∈S1∩S2ai. This is clearly true ifplayer 2 packs S2. Otherwise,player 2packs a set,say, Sˆ
2,with hˆ
=
i∈S1∩ˆS2ai,such that p( ˆ
S2)
+ ˆ
h≥
p(
S2)
+
h. As p( ˆ
S2)
≤
p(
S2)
,thisimplieshˆ
≥
h. Thus,ALG
≥
p(
S1)
+
p( ˆ
S2)
+
2hˆ
≥
p(
S1)
+
p(
S2)
+
h+ ˆ
h≥
p(
S1)
+
p(
S2)
+
2h,
asclaimed.
Nowweobtainthefollowinglinearprogramboundingtheapproximationratioof
Algorithm 1
.min
α
s.t. p(
S∗1)
+
p(
S∗2)
+
2h∗=
1,
α
≥
p(
S∗1)
+
2p(
S∗2)
−
p(
S2)
+
2h∗,
α
≥
p(
S1)
+
p(
S2)
+
2h,
p(
S1)
≥
p(
S∗1),
p(
S2)
≥
p(
S∗2),
p(
S1),
p(
S2),
p(
S∗1),
p(
S2∗)
≥
0,
h,
h∗≤
0and the knapsack constraints hold
.
(7)
Letting p
(
S∗1)
=
p(
S1)
=
p(
S2)
=
1, h= −
1 andh
∗=
p(
S2∗)
=
0,we can easily seethat theoptimal objectivevalue is0.We observe that in thisworst-case instance the penalty h is too large: A better choice for player 1 isto pack nothing. Then player2mustpackS2,implying
ALG
≥
p(
S2)
.Addingthissimpleconstrainttotheaboveprogram yieldsan optimalobjectivevalue0
.
5.Thus,excludingitemswithlargepenaltyfrom
S
1canimprovetheperformanceofALG,however,itdoesnotyieldatightapproximation yet.The idea forfurtherimprovement isnot only toavoid packingitemswithlarge penalties butalsoto packitemswith
small penalties.
Wedefinethefollowingsets:S+2
=
i∈
S2| |
ai| >
pi 2,
S−2=
S2\
S+2,
(8)where
S
+2,
S
−2 aresetsofitemshavinglargepenaltiesandsmallpenaltiesrespectively.Ouralgorithmcannowbedescribed asfollows.Algorithm2.Packoneof
S
∗1,
S1\
S+2 and∅
(whicheverresultsinamaximumtotalprofit).Toanalyzeitsperformance,wedistinguishthreecases:
Case2.Player1packs S1
\
S+2.WeprovethatALG
≥
p(
S1)
+
p(
S−2)
+
2h−,whereh
−=
i∈S−2ai.Clearly,thisistruewhen player 2packs S2.Ifplayer 2packssome otherset,say
ˆ
S2=
S2,withhˆ
=
i∈(S1\S+2)∩ˆS2ai,then p
( ˆ
S2)
+ ˆ
h≥
p(
S2)
+
h −, implyinghˆ
≥
h− (recallthatp
( ˆ
S2)
≤
p(
S2)
).Hence,ALG
≥
p(
S1)
−
p(
S2+)
+
p( ˆ
S2)
+
2hˆ
≥
p(
S1)
−
p(
S+2)
+
p(
S2)
+
h−+ ˆ
h≥
p(
S1)
−
p(
S2+)
+
p(
S2)
+
2h−=
p(
S1)
+
p(
S−2)
+
2h−.
Case3.Player1packsnothing.Thenplayer2canguaranteeatotalprofit p
(
S2)
bypackingS
2.Thus,ALG
≥
p(
S2)
.Furthermore,inadditiontotheknapsackconstraints
(4)
,(5)
wehavethefollowingconstraints:p
(
S2)
=
p(
S+2)
+
p(
S−2)
and h−≥ −
p
(
S−2)
2
.
Thisfinallyyieldsthefollowinglinearprogramwithanoptimalvalueof2
/
3 (forbothW
1≥
W2 andW
1<
W2).minimize
α
subject to p(
S∗1)
+
p(
S∗2)
+
2h∗=
1,
α
≥
p(
S∗1)
+
2p(
S2∗)
−
p(
S2)
+
2h∗,
α
≥
p(
S1)
+
p(
S−2)
+
2h−,
α
≥
p(
S2),
p(
S2)
=
p(
S+2)
+
p(
S−2),
h−≥ −
p(
S − 2)
2,
p(
S1)
≥
p(
S∗1),
p(
S2)
≥
p(
S∗2),
p(
S1),
p(
S2),
p(
S+2),
p(
S−2),
p(
S∗1),
p(
S∗2)
≥
0,
h∗,
h−≤
0and the knapsack constraints hold
.
(9)
Hence
OPT
/
ALG≤
1.
5,whichistight(cf. theexampleinSection2).Remark2. Since player2 actsafterplayer 1,thereadermaywonder how tofind themaximal totalprofitover all cases (in
Algorithms 1 and
2).Thiscanbedonebycheckingtheinequalities“α
≥ . . .
”in(6)
and(9)
respectively:Ifanyofthese inequalitiesgetstight,thealgorithmmaypicktheassociatedset(forplayer1).4.3. Approximating S∗1and S∗2
Algorithms 1 and 2 mayequally well be applied, ifwe replace S1
,
S
2,
S
∗1 and S∗2 by corresponding-approximations
(to be computed as explained in Section 2.1, say, S
˜
1,
˜
S2,
˜
S∗1 and S˜
∗2 with corresponding S˜
+2= {
i∈ ˜
S2| |
ai|
>
pi/
2}
and˜
S−2
= ˜
S2\˜
S2+). A close lookat the analysisof Algorithms 1 and 2 revealsthat optimality of(
S∗1,
S
∗2)
is only used in (1)and(3).Itiseasytoseethat
(1)
becomes(
1−
)
OPT≤
p( ˜
S1∗)
+
p( ˜
S2∗)
+
2h˜
∗,
whereh˜
∗=
i∈˜S∗1∩ ˜S∗2 ai
.
Notethatthe“
˜
-version”of(2)
maybeassumedtobesatisfiedwithoutanychanges.(Replacetheapproximation S˜
1 by˜
S∗1 incasep
( ˜
S1)
<
p( ˜
S∗1)
.)Thesameis trueforthe knapsackconstraints.Thusall thatchanges inthelinearprograms intheprevioustwosectionsisthattherighthandsideofthefirstconstraintchangesfrom1 to
(
1−
)
.Thus,asimplescaling argumentshowsthattheresultingoptimumwilldifferbyatmostan O(
)
-fractionfromtheoriginalvalue.Remark3.To be precise, theabove argument is validonly ifwe assume that player 2 is ableto solve his (lowerlevel) problemexactly. Ifalsoplayer 2applies
-approximation algorithmsinstead, weget anotherfactorof
(
1−
)
introduced in(3).4.4. The mixed case
Finally,letusturntothecasewheretheitemsetcontains bothpositiveandnegativeitems.Thiscaseiseasilyreduced tothe twocases(beneficialandcompetitive modelrespectively)considered above: Allwehaveto doistosplit theitem set A into theset A+and A−ofnon-negativeandnegativeitems,respectivelyandtoguess–again,uptoacertainfactor, say, 1
/
k – the associated parts of knapsacks 1 and2 that are filled with non-negative andnegative items, resp., in an optimalsolutionS
∗1∪
S∗2of(P3)
.Solvingthe“pure”(beneficialresp.competitive)casesfortheapproximatelycorrectchoiceofcorrespondingknapsackcapacitieswillthengivesolutionsfortheleader’sproblemthatdifferfromthecooperativevalue byatmostafactorof
(
2+
)
attheexpenseofanadditionalO((
log W1)(
log W2))
factorintherunningtime.5. Remarks
Wehavepresentedaunifiedapproachforcomputingsolutionstotheleader’sproblemwithapproximatelyoptimalratio, ifcomparedtotheoutcomeofthecooperativeversionoftheproblem.Withoutfurthergoingintodetails,wementionthat inthelowerboundexamples(cf. theexampleinSection2andtheexamplesin
[1]
),themaximumcooperativevalueequals themaximumvalue of(the optimistic versionof) thebilevel problem.Thus ourresultsalso providetightboundsforthe ratiobetweentheoptimisticandpessimisticversionofthebilevelproblemitself.A natural question to ask is aboutside payments: Player 1 can certainly enforce the optimistic value of the bilevel problemwitharbitrarily small side payments.Thus, it seemsnatural toalso investigateapproximation algorithms inthe optimisticsetting.
References
[1]L.Chen,G.Zhang,Approximationalgorithmsforabi-levelknapsackproblem,in:ProceedingsofCOCOA’11,Springer-Verlag,Berlin,Heidelberg,2011, pp. 399–410.
[2]S.Dempe,K.Richter,Bilevelprogrammingwithknapsackconstraints,Cent.Eur.J.Oper.Res.8(2000)93–107. [3]S.Dempe,FoundationsofBilevelProgramming,KluwerAcademicPublishers,Dordrecht,2002.
[4]A.Migdalas,P.M.Pardalos,P.Värbrand,MultilevelOptimization:AlgorithmsandApplications,KluwerAcademicPublishers,Dordrecht,1998. [5]B.Colson,P.Marcotte,G.Savard,Bilevelprogramming:asurvey,4OR:Quart.J.Oper.Res.3 (2)(2005)87–107.
[6]L.Brotcorne,S.Hanafi,R.Mansi,Adynamicprogrammingalgorithmforthebilevelknapsackproblem,Oper.Res.Lett.37 (3)(2009)215–218. [7]A.Caprara,M.Carvalho,A.Lodi,G.Woeginger,Acomplexityandapproximabilitystudyofthebilevelknapsackproblem,in:ProceedingsofIPCO’13,
Springer,Berlin,Heidelberg,2013,pp. 98–109.
[8]P.Loridan,J.Morgan,WeakviastrongStackelberg problem:newresults,J.GlobalOptim.8 (3)(1996)263–287. [9]Z.Wang,W.Xing,S.-C.Fang,Two-groupknapsackgame,Theoret.Comput.Sci.411 (7–9)(2010)1094–1103. [10]Z.Wang,W.Xing,Two-personknapsackgame,J.Ind.Manag.Optim.6 (4)(2010)847–860.
[11]X.Deng,Complexityissues inbilevellinear programming,in:MultilevelOptimization:Algorithmsand Applications,KluwerAcademicPublishers, Dordrecht,1998,pp. 149–164.
[12]R.Mansi,C.Alves,J.deCarvalho,S.Hanafi,Anexactalgorithmforbilevel0–1knapsackproblems,Math.Probl.Eng.(2012),articleID504713. [13]O.H.Ibarra,C.E.Kim,Fastapproximationalgorithmsfortheknapsackandsumofsubsetproblems,J.ACM22 (4)(1975)463–468.
[14]V.V.Vazirani,ApproximationAlgorithms,Springer-Verlag,NewYork,Inc.,NewYork,NY,USA,2001.
[15]C.Chekuri,S.Khanna,APTAS forthemultipleknapsackproblem,in:ProceedingsofSODA’00,SocietyforIndustrialandAppliedMathematics, Philadel-phia,PA,USA,2000,pp. 213–222.
[16]S.Sahni,Approximatealgorithmsforthe0/1knapsackproblem,J.ACM22 (1)(1975)115–124.
[17]S.DeNegre,Interdictionanddiscretebilevellinearprogramming,Ph.D.thesis,Bethlehem,PA,USA,aAI3456385,2011.