modeling (integer programming examples) · integer programming : bus scheduling: how do you define...
TRANSCRIPT
MODELING(IntegerProgramming
Examples)
1
IE400PrinciplesofEngineeringManagement
IntegerProgramming:Set5
IntegerProgramming:Sofar,wehaveconsideredproblemsunderthefollowingassumptions:
i. Proportionality&Additivityii. Divisibilityiii. Certainty
Whilemanyproblemssatisfytheseassumptions,there areother
problems inwhichwewillneedtoeitherrelax these assumptions.
For example,considerthefollowingbusschedulingproblem:
IntegerProgramming:
BusScheduling:Periods 1 2 3 4 5 6
Hours 0-4AM 4-8 AM 8AM– 12 PM 12- 4PM 4 – 8PM 8PM-0AM
Min. #ofbusesrequired
4 8 10 7 12 4
Eachbusstartstooperateatthebeginningofaperiodandoperates
for8consecutivehoursandthenreceives16hoursoff.
Forexample,abusoperatingfrom4AMto12PMmustbeoff
between12PMand4AM.
Findtheminimum#ofbussestoprovidetherequiredservice.
IntegerProgramming:
BusScheduling:
Howdoyoudefineyourdecisionvariableshere?
a) xi:#ofbussesoperatinginperiodi,i=1,2,…,6
or
b)xi:#ofbussesstartingtooperateinperiodi,i=1,2,…,6
Periods 1 2 3 4 5 6
Hours 0-4AM 4-8 AM 8AM– 12 PM 12- 4PM 4 – 8PM 8PM-0AM
Min. #ofbusesrequired
4 8 10 7 12 4
IntegerProgramming:Thealternative“b”makesmodelingofthisproblemmucheasier.Itisnotpossibletokeeptrackofthetotalnumberofbussesunderalternative“a”.(WHY?)Themodelisasfollows:
IntegerProgramming:Thealternative“b”makesmodelingofthisproblemmucheasier.Itisnotpossibletokeeptrackofthetotalnumberofbussesunderalternative“a”.(WHY?)Themodelisasfollows:
, . . . i = , x x + x x + x x + x x + x x + x x + xx
+ x + x + x + xxx
ii 61 integer, 041271084
s.t. + min
65
54
43
32
21
61
654321
³³³³³³³
IntegerProgramming:
Notethateachdecisionvariablerepresentsthenumberofbusses.
Clearly,itdoesnotmakesensetotalkabout3.5bussesbecause
bussesarenotdivisible.Hence,weshouldimposetheadditional
conditionthateachofx1,...,x6 canonlytakeintegervalues.
Ifsomeorallofthevariablesarerestrictedtobeintegervalued,we
callitanintegerprogram(IP).ThislastexampleishenceanIP
problem.
WorkScheduling:BurgerQueenwouldliketodeterminethemin#ofkitchenemployees.Eachemployeeworkssixdaysaweekandtakestheseventhdayoff.Days Mon Tue Wed Thu Fri Sat Sun
Min. #ofworkers
8 6 7 6 9 11 9
Howdoyouformulatethisproblem?
Theobjectivefunction?
Theconstraints?
WorkScheduling:BurgerQueenwouldliketodeterminethemin#ofkitchenemployees.Eachemployeeworkssixdaysaweekandtakestheseventhdayoff.Days Mon Tue Wed Thu Fri Sat Sun
Min. #ofworkers
8 6 7 6 9 11 9
xi :#ofworkerswhoarenotworking ondayi,i =1,...,7(1:Mon,7:Sun)
WorkScheduling:
DecisionVariables:
IPModel:
TheAssignmentProblem:
• Therearen peopleandnjobstocarryout.
• Eachpersonisassignedtocarryoutexactlyonejob.
• Ifpersoni isassignedtojobj,thenthecostiscij .
Findanassignmentofnpeopleton jobswithminimumtotalcost.
P1
P2
Pn
J1
J2
Jn
TheAssignmentProblem:
P1
P2
Pn
J1
J2
Jn
njni
jixij
,,2,1 ; ,,2,1
otherwise ,0
job toassigned is person ,1
!! ==
îíì
=
SuchvariablesarecalledBINARYVARIABLESandoffergreatflexibilityinmodeling.TheyareidealforYES/NOdecisions.
Sohowistheproblemformulated?
TheAssignmentProblem:Theproblemisformulatedasfollows:
job) oneexactly toassigned is (person 1 , 1 n
1ji,...,nix
s.t.
ij ==å=
ThisisstillanexampleofanIPproblemsincexij canonlytakeoneofthetwointegervalues0and1.
min n
1i
n
1j xc ijijåå
= =
n ... 1,j ...n; 1,i {0,1}, x
person) oneexactly toassigned is (job 1 , 1
ij
n
1i
==Î
==å=
j,...,njxij
The0-1KnapsackProblem
Youaregoingonatrip.YourSuitcasehasacapacityofbkg’s.• Youhaven differentitemsthatyoucanpackintoyoursuitcase1,...,n.
• Itemi hasaweightofaiandgivesyouautilityofci.
Howshouldyoupackyoursuitcasetomaximizetotalutility?
The0-1KnapsackProblem
DecisionVariables:
IPModel:
21
WorkforceSchedulingMonthlydemandforashoecompany
• Apairofshoesrequires4hoursoflaborand$5worthofrawmaterials
• 50pairsofshoesinstock• Monthlyinventorycostischargedforshoesinstockattheendof
eachmonthat$30/pair• Currently3workersareavailable• Salary$1500/month• Eachworkerworks160hours/month• Hiringaworkercosts$1600• Firingaworkercosts$2000
Month
1 2 3 4
Demand 300 500 100 100
22
WorkforceSchedulingMonthlydemandforashoecompany
• Apairofshoesrequires4hoursoflaborand$5worthofrawmaterials
• 50pairsofshoesinstock• Monthlyinventorycostischargedforshoesinstockattheendof
eachmonthat$30/pair• Currently3workersareavailable How to meet demand with • Salary$1500/monthminimum total cost?• Eachworkerworks160hours/month• Hiringaworkercosts$1600• Firingaworkercosts$2000
Month
1 2 3 4
Demand 300 500 100 100
Decision Variables:
LP Model:
23
IPModelForWorkforceScheduling
TheCuttingStockProblem:Apapercompanymanufacturesandsellsrollsofpaperoffixedwidthin5standardlengths:5,8,12,15and17m.Demandforeachsizeisgivenbelow.Itproduces25mlengthrollsandcutsordersfromitsstockofthissize.Whatisthemin#ofrollstobeusedtomeetthetotaldemand?
Length(meters)
5 8 12 15 17
Demand 40 35 30 25 20
TheCuttingStockProblem:
First,identifythecuttingpatterns:
17 8
15 8
17 5
15 5 5
12 12
12 8 5
12 55
8 88
8 58
8 55 5
5 5 5 5 5
1
2
3
4
5
6
7
8
9
10
11
TheCuttingStockProblem:Thenhowdoyoudefinethedecisionvariable?
xj :#ofrollscutaccordingtopatternj.
TheCuttingStockProblem:Thenhowdoyoudefinethedecisionvariable?
xj :#ofrollscutaccordingtopatternj.
Whatabouttheconstraints?i.e.Howdoyouwritetheconstraintforthedemandof12mrollsofpaper?
Welookatthepatternsthatcontain12mpieces,andthenwritetheconstraintbasedonxj.
Length(meters)
5 8 12 15 17
Demand 40 35 30 25 20
TheCuttingStockProblem:
Thecuttingpatterns:
17 8
15 8
17 5
15 5 5
12 12
12 8 5
12 55
8 88
8 58
8 55 5
5 5 5 5 5
1
2
3
4
5
6
7
8
9
10
11
TheCuttingStockProblem:
Thecuttingpatterns:
17 8
15 8
17 5
15 5 5
12 12
12 8 5
12 55
8 88
8 58
8 55 5
5 5 5 5 5
1
2
3
4
5
6
7
8
9
10
11
5 6 72 30x x x+ + ³Whydowehave“≥”sign?
TheCuttingStockProblem:Thenhowdoyoudefinethedecisionvariable?
xj :#ofrollscutaccordingtopatternj.
Whatabouttheconstraints?i.e.Whataboutdemandfor5m?
Length(meters)
5 8 12 15 17
Demand 40 35 30 25 20
TheCuttingStockProblem:
Thecuttingpatterns:
17 8
15 8
17 5
15 5 5
12 12
12 8 5
12 55
8 88
8 58
8 55 5
5 5 5 5 5
1
2
3
4
5
6
7
8
9
10
11
TheCuttingStockProblem:
Thecuttingpatterns:
17 8
15 8
17 5
15 5 5
12 12
12 8 5
12 55
8 88
8 58
8 55 5
5 5 5 5 5
1
2
3
4
5
6
7
8
9
10
11
2 4 6 7 9 10 112 2 3 5 40x x x x x x x+ + + + + + ³
TheCuttingStockProblem:
Theproblemisformulatedasfollows:
11
1
2 4 6 7 9 10 11
1 3 6 8 9 10
5 6 7
3 4
1 2
min
2 2 3 5 40 + 3 2 35
2 30 25
20 0 1 ...,11, integer.
jj
j j
x
s.t. x x x x x x x x x + x + x + x + x x + x + x x x
x + x x , j = , x
=
+ + + + + + ³
³
³
+ ³
³³
å
ProjectSelection
Amanagershouldchoosefromamong10differentprojects:
pj :profitifweinvestinprojectj,j=1,...,10cj :costofprojectj,j=1,...,10q:totalbudgetavailable
Therearealsosomeadditionalrequirements:i. Projects3and4cannotbechosentogetherii. Exactly3projectsaretobeselectediii. Ifproject2isselected,thensoisproject1iv. Ifproject1isselected,thenproject3shouldnotbeselectedv. Eitherproject1orproject2ischosen,butnotbothvi. Eitherbothprojects1and5arechosenorneitherarechosenvii. Atleasttwoandatmostfourprojectsshouldbechosenfromtheset{1,2,7,8,
9,10}viii. Neitherproject5nor6canbechosenunlesseither3or4ischosenix. Atleasttwooftheinvestments1,2,3arechosen,oratmostthreeofthe
investments4,5,6,7,8arechosen.x. Ifboth1and2arechosen,thenatleastoneof9and10shouldalsobechosen.
ProjectSelection
Undertheserequirements,theobjectiveistomaximizetheProfit.
DecisionVariables
10 ,...,1
otherwise ,0
chosen is project if ,1
=îíì
=
j
jx j
ProjectSelection
Objectivefunctionis:
å=
10
1jp max jj x
ProjectSelection
Objectivefunctionis:
Firstthebudgetconstraint:
å=
10
1jp max jj x
ProjectSelection
Objectivefunctionis:
Firstthebudgetconstraint:
å=
10
1jp max jj x
qc 10
1j£å
=jj x
ProjectSelection
Objectivefunctionis:
Firstthebudgetconstraint:
å=
10
1jp max jj x
qc 10
1j£å
=jj x
i.Projects3and4cannotbechosentogether:
ProjectSelection
Objectivefunctionis:
Firstthebudgetconstraint:
å=
10
1jp max jj x
qc 10
1j£å
=jj x
i.Projects3and4cannotbechosentogether:
143 £+ xx
ProjectSelection
iiExactly3projectsaretobechosen:
310987654321 =+++++++++ xxxxxxxxxx
iii.Ifproject2ischosenthensoisproject1:
12 xx £
ProjectSelection
ivIfproject1isselected,thenproject3shouldnotbeselected
v.Eitherproject1orproject2ischosen,butnotboth
31 1 xx -£
121 =+ xx
ProjectSelection
vi.Eitherbothprojects1and5arechosenorneitherarechosen
0or 5151 =-= xxxx
vii.Atleasttwoandatmostfourprojectsshouldbechosenfromtheset{1,2,7,8,9,10}:
4
2
1098721
1098721
£+++++
³+++++
xxxxxx
xxxxxx
ProjectSelection
viii.Neitherproject5nor6canbechosenunlesseither3or4ischosen:
Equivalently, 0 then 0 If 6543 ===+ xxxx
436
435
xxxxxx
+£+£
Anotherpossibility,
)(2 4365 xxxx +£+
ProjectSelection
ix.Atleasttwooftheinvestments1,2,3arechosen,oratmostthreeoftheinvestments4,5,6,7,8arechosen:
Itismoredifficulttoexpressthisrequirementinmathematicaltermsdueto“or”!
( ) ( )II I 3or 2 87654321 £++++³++ xxxxxxxx
Sowewanttoensurethatatleastoneof(I)and(II)issatisfied.
Thefollowingsituationcommonlyoccursinmathematicalprogrammingproblems.Wearegiventwoconstraintsoftheform,
( ) ( )( ) ( )
1 2
1 2
, ,.... 0 I
, ,.... 0 IIn
n
f x x x
g x x x
£
£
Either-OrConstraints
Thefollowingsituationcommonlyoccursinmathematicalprogrammingproblems.Wearegiventwoconstraintsoftheform,
( ) ( )( ) ( )
1 2
1 2
, ,.... 0 I
, ,.... 0 IIn
n
f x x x
g x x x
£
£
Either-OrConstraints
Wewanttomakesurethatatleastoneof(I)and(II)issatisfied.Theseareoftencalledeither-orconstraints.
Thefollowingsituationcommonlyoccursinmathematicalprogrammingproblems.Wearegiventwoconstraintsoftheform,
( ) ( )( ) ( )
1 2
1 2
, ,.... 0 I
, ,.... 0 IIn
n
f x x x
g x x x
£
£
Either-OrConstraints
Wewanttomakesurethatatleastoneof(I)and(II)issatisfied.Theseareoftencalledeither-orconstraints.Addingtwonewconstraintsasbelowtotheformulationwillensurethatatleastoneof(I)or(II)issatisfied,
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
M isanumberchosenlargeenoughtoensurethatf(x1,x2,...,xn)≤Mandg(x1,x2,...,xn)≤Maresatisfiedforallvaluesofx1,x2,...,xn thatsatisfytheotherconstraintsintheproblem.
Either-OrConstraints
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
Either-OrConstraints
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
a) Ify=0,then(I’)and(II’)becomes:f(x1,x2,...,xn)≤0,
andg(x1,x2,...,xn)≤M.
Hence,thismeansthat(I)mustbesatisfied,andpossibly(II)issatisfied.
Either-OrConstraints
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
Either-OrConstraints
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
b) Ify=1,then(I’)and(II’)becomes:f(x1,x2,...,xn)≤M,
andg(x1,x2,...,xn)≤0.
Hence,thismeansthat(II)mustbesatisfied,andpossibly(I)issatisfied.
Either-OrConstraints
( ) ( )( ) ( ) ( )
{ }
1 2
1 2
, ,.... I
, ,.... 1 II
where 0,1 .
n
n
f x x x My
g x x x M y
y
¢£
¢£ -
Î
. ( ) ( )( ) ( )
1 2
1 2
, ,.... 0 I
, ,.... 0 IIn
n
f x x x
g x x x
£
£
Thereforewhethery=0ory=1,(I’)and(II’)ensurethatatleastoneof(I)and(II)issatisfied.
Either-OrConstraints
ProjectSelection
Now,letusreturntoourproblem:
ix.Atleasttwooftheinvestments1,2,3arechosen,oratmostthreeoftheinvestments4,5,6,7,8arechosen:
( ) ( )II I 3or 2 87654321 £++++³++ xxxxxxxx
Thisisanexampleofeither-orconstraint.Hencebydefiningthef(.)andg(.)functions,(I)and(II)becomes:
( )1 2 3 2- 0 x x x+ + £
03 87654 £+++++- xxxxx f(.)
g(.)
ProjectSelection
Now,letusreturntoourproblem:
ix.Atleasttwooftheinvestments1,2,3arechosen,oratmostthreeoftheinvestments4,5,6,7,8arechosen:
( ) ( )II I 3or 2 87654321 £++++³++ xxxxxxxx
Hencebydefiningabinaryvariabley,theformulationbecomes:
{0,1}y)1(3-
y )(2
87654
321
Î-£+++++
£++-yMxxxxx
MxxxWehavetofindMlargeenoughtoensurethatf(.)≤Mandg(.)≤Mforallvaluesofx1,…,xn.M=2works!
ProjectSelection
Now,letusreturntoourproblem:
ix.Atleasttwooftheinvestments1,2,3arechosen,oratmostthreeoftheinvestments4,5,6,7,8arechosen:
( ) ( )II I 3or 2 87654321 £++++³++ xxxxxxxx
PuttingM=2andrearrangingtheterms,wehave:
{0,1}y25
y)1(2
87654
321
Î-£++++
-³++yxxxxx
xxx
ProjectSelection
x.Ifboth1and2arechosen,thenatleastoneof9and10shouldalsobechosen.
Bothprojects1and2arechosenifx1 +x2 =2.
Atleastoneofprojects9and10ischosenifx9 +x10 ≥1
12 have weHence, 10921 ³+Þ=+ xxxx
So,howtoexpressthisasalinearconstraint?
Thefollowingsituationcommonlyoccursinmathematicalprogrammingproblems.Wewanttoensurethat:
Ifaconstraintf(x1,…,xn)>0issatisfied,then g(x1,…,xn)≤0mustbesatisfied;
whileifaconstraintf(x1,…,xn)>0isnotsatisfied,then g(x1,…,xn)≤0mayormaynotbesatisfied.
If-ThenConstraints
Inotherwords,wewanttoensurethatf(x1,…,xn)>0implies g(x1,…,xn)≤0.
Logically,thisisequivalentto:
If-ThenConstraints
( )
( )
II 0),...,,(or
I 0),...,,(
21
21
£
£
n
n
xxxg
xxxf
WhereasbeforeMisalargeenoughnumbersuchthatf(.)≤Mandg(.)≤Mholdsforallvaluesx1,…,xn.
If-ThenConstraints( )
( )
II 0),...,,(or
I 0),...,,(
21
21
£
£
n
n
xxxg
xxxf
}1,0{ where
)1(),...,,( ),...,,(
21
21
Î-£
£
zzMxxxg
Mzxxxf
n
n
Now,theseareeither-ortypeconstraintsandwecanhandlethemasbeforebydefiningabinaryvariable,sayz:
ProjectSelection
Now,letusreturntoourproblem:
x.Ifboth1and2arechosen,thenatleastoneof9and10shouldalsobechosen.
12 10921 ³+Þ=+ xxxx
Weneedtodefinef(.)>0andg(.)≤0 constraints:
f(.) g(.)
1 1 10921 ³+Þ>+ xxxx
0)(1 01 10921 £+-Þ>-+ xxxxlyequivalent
ProjectSelection
x.Ifboth1and2arechosen,thenatleastoneof9and10shouldalsobechosen.
12 10921 ³+Þ=+ xxxx
0)(1 01 10921 £+-Þ>-+ xxxxf(.) g(.)
Nowconvertingtoeither-or,wehave:
(II) 0)(1r
(I) 01
109
21
£+-
£-+
xxo
xx
ProjectSelection
Tolinearizetheaboveconstraints,defineabinaryvariable,sayzandalargeenoughvalueM:
(II) 0)(1r
(I) 01
109
21
£+-
£-+
xxo
xx
M=1worksandafterrearrangingwehave: }1,0{
)1(M)(1 1
109
21
Î-£+-
£-+
zzxx
Mzxx
}1,0{
1
109
21
γ++£+
zzxxzxx
ProjectSelection
x.Ifboth1and2arechosen,thenatleastoneof9and10shouldalsobechosen.
}1,0{
1
109
21
γ++£+
zzxxzxx
ProjectSelectionFinallyourintegerprogrammingmodelwithlinear
constraintsbecomes:
å=
10
1jp max jj x
qc 10
1j£å
=jj x
(i) 143 £+ xx(ii) 310987654321 =+++++++++ xxxxxxxxxx
(iii) 12 xx £
(iv) 1 31 xx -£
(vi) 021 =- xx
(v) 121 =+ xx
ProjectSelectionModelcont.
(vii) 4
2
1098721
1098721
þýü
£+++++³+++++
xxxxxxxxxxxx
(viii) 436
435
þýü
+£+£xxxxxx
(ix) 25
y)1(2
87654
321
þýü
-£++++-³++
yxxxxxxxx
(x)
1
109
21
þýü
³++£+zxxzxx
{0,1}zy, {0,1},...,, 1021
ÎÎxxx
ModelingFixedCosts• Asetofpotential warehouses:1,...,m• Asetofclients:1,...,n
• Ifwarehousei isused,thenthereisafixedcostoffi,i =1,…,m
• cij :unitcostoftransportationfromwarehousei toclientj,
i =1,...,m;j =1,...,n
• ai :capacityofwarehousei intermsof#ofunits,i =1,…,m
• dj :#ofunitsdemandedbyclientj,j=1,…,n
Note:Morethanonewarehousecansupplytheclient.
ModelingFixedCostsHowtoformulatethemathematicalmodelinordertominimizetotalfixedcostsandtransportationcostswhilemeetingthedemandandcapacityconstraints?DecisionVariables:
IPModel:
TheSetCoveringProblemYouwishtodecidewheretolocatehospitalsinacity.Supposethatthereare5differenttownsinthecity.
Town
PotentialLocation
1 2 3 4 5
1 10 15 20 10 16
2 15 10 8 14 12
3 8 6 12 15 10
4 12 17 7 9 10
TravelTime
Traveltimebetweeneachtownandthenearesthospitalshouldnotbemorethan10minutes.Whatistheminimumnumberofhospitals?
TheSetCoveringProblem
DecisionVariables:
IPModel:
LocationProblems(Cover,Center,Median)Ankaramunicipalityisprovidingserviceto6regions.Thetraveltimes(inminutes)betweentheseregions,saytij valuesare:
R1 R2 R3 R4 R5 R6
R1 0 10 20 30 30 20
R2 10 0 25 35 20 10
R3 20 25 0 15 30 20
R4 30 35 15 0 15 25
R5 30 20 30 15 0 14
R6 20 10 20 25 14 0
LocationProblems(Cover,Center,Median)a) Cover:Themunicipalitywantstobuildfirestationsinsomeoftheseregions.Findtheminimumnumberoffirestationsrequiredifthemunicipalitywantstoensurethatthereisafirestationwithin15minutedrivetimefromeachregion.(Similarto??)
DecisionVariables:
IPModel:
LocationProblems(Cover,Center,Median)b)Median:Themunicipalitynowwantstobuild2postoffices.Thereisgoingtobeabackandforthtripeachdayfromeachpostofficetoeachoneoftheregionsassignedtothispostoffice.Formulateamodelwhichwillminimizethetotaltriptime.DecisionVariables:
IPModel:
LocationProblems(Cover,Center,Median)c)Whatifadditionaltopart(b),youhavetherestrictionthatapostofficecannotprovideservicetomorethan4regionsincludingitself?Addthefollowingconstrainttoabovemodel:
LocationProblems(Cover,Center,Median)d)Center:Themunicipalitywantstobuild2firestationssothatthetimetoreachthefarthestregioniskeptatminimum.DecisionVariables:
IPModel:
LocationProblems(Cover,Center,Median)e)Considerthemedianprobleminpart(b).Assumethatinadditiontothebackandforthtripsbetweenthepostofficesandtheassignedregions,therewillbeatripbetweenthetwopostoffices.Themunicipalitywantstolocatetheofficesinsuchawaythatthetotaltriptimeisminimized.DecisionVariables:
IPModel:
TravelingSalesmanProblem(TSP):Asalespersonlivesincity1.Hehastovisiteachofthecities2,…,nexactlyonceandreturnhome.
Letcij bethetraveltimefromcityi tocityj ,i =1,...,n;j=1,...,n.
Whatistheorderinwhichsheshouldmakehertourtofinishasquicklyaspossible?Whatshouldbethedecisionvariableshere?
TravelingSalesmanProblem(TSP):Asalespersonlivesincity1.Hehastovisiteachofthecities2,…,nexactlyonceandreturnhome.
Letcij bethetraveltimefromcityi tocityj ,i =1,...,n;j=1,...,n.
Whatistheorderinwhichsheshouldmakehertourtofinishasquicklyaspossible?Whatshouldbethedecisionvariableshere?
1, if he goes directly from city to city 0, otherwise
1,2, , ; 1,2, ,
ij
i jx
i n j n
ì= íî= =K K
TravelingSalesmanProblem(TSP):
{ }
1 1
1
1
min
. .
1, 1,...,
1, 1,...,
0, 1,..., 0,1 , , 1,...,
n n
ij iji j
n
ijj
n
iji
ii
ij
c x
s t
x i n
x j n
x i nx i j n
= =
=
=
= =
= =
= =
Î " =
åå
å
å
Sinceeachcityhastobevisitedonlyonce,theformulationis:
TravelingSalesmanProblem(TSP):
12 23 31
45 54
1, 1.x x xx x= = =
= =
Withthisformulation,afeasiblesolutionis:
Butthisisa“subtour”!Howcanweeliminate“subtours”?
Weneedtoimposetheconstraints:
1 S N, Siji S j S
xÎ Ï
³ " Í ¹Æåå
TravelingSalesmanProblem(TSP):
14 15 24 25 34 35 1x x x x x x+ + + + + ³
Forexample,forn=5andS={1,2,3}thisconstraintimplies:
Thedifficultyisthatthereareatotalof2n −1suchconstraints.Andthatisalot!• Forn=100,2n −1≈1.27x1030.
Howaboutthetotalnumberofvalidtours?Thatis(n−1)!
• Forn=100,(n−1)!≈ 9.33x10155.TSPisoneofthehardestproblems.Butseveralefficientalgorithmsexistthatcanfind“good”solutions.
ClassExercises(Blendingproblemrevisitedwithbinaryvariables):
Acompanyproducesanimalfeedmixture.Themixcontains2activeingredientsandafillermaterial.1kgoffeedmixmustcontainaminimumquantityofeachofthefollowing4nutrients:
Theingredientshavethefollowingnutrientvaluesandcosts:
Nutrients A B C D
Requiredamount(ingrams)in1kgofmix
90 50 20 2
A B C D Cost/kg
Ingredient1(gram/kg) 100 80 40 10 $40
Ingredient2 (gram/kg) 200 150 20 N/A $60
ClassExercises(Blendingproblemrevisitedwithbinaryvariables):
a) Whatshouldbetheamountofactiveingredientsandfillermaterialin1kgoffeedmixinordertosatisfythenutrientrequirementsatminimumtotalcost?
DecisionVariables:
Model(LPorIP?)
ClassExercises(Blendingproblemrevisitedwithbinaryvariables):b)Supposenowthatwehavethefollowingadditionallimitations
i. Ifweuseanyofingredient2,weincurafixedcostof$15(inadditiontothe$60unitcost).
ii. Itisenoughtoonlysatisfy3ofthenutritionrequirementsratherthan4.
DecisionVariables(AdditionaltothoseforParta):
Model:(LPorIP?)
SomeCommentsonIntegerProgramming:
§ Thereareoftenmultiplewaysofmodelingthesameintegerprogram.
§ Solversforintegerprogramsareextremelysensitivetotheformulation(nottrueforLPs).
§ Notaseasytomodel.
§ Notaseasytosolve.