You are on page 1of 17

12/5/2016

Integerprogrammingformulationexamples

ORNotes
JEBeasley
ORNotesareaseriesofintroductorynotesontopicsthatfallunderthebroadheadingofthefieldofoperations
research(OR).TheywereoriginallyusedbymeinanintroductoryORcourseIgiveatImperialCollege.They
arenowavailableforusebyanystudentsandteachersinterestedinORsubjecttothefollowingconditions.
AfulllistofthetopicsavailableinORNotescanbefoundhere.

Integerprogrammingformulationexamples
Capitalbudgetingextension
Fortheintegerprogrammingproblemgivenbeforerelatedtocapitalbudgetingsupposenowthatwehavethe
additionalconditionthateitherproject1orproject2mustbechosen(i.e.projects1and2aremutually
exclusive).TocopewiththisconditionweenlargetheIPgivenaboveinthefollowingmanner.
Thisconditionisanexampleofaneither/orcondition"eitherproject1orproject2mustbechosen".Intermsof
thevariableswehavealreadydefinedthisconditionis"eitherx1=1orx2=1".Thestandardtrickfordealing
witheither/orconditionsrelatingtotwozeroonevariablesistoaddtotheIPtheconstraint
x1+x2=1
Toverifythatthismathematicaldescriptionisequivalenttotheverbaldescription"eitherx1=1orx2=1"we
usethefactthatx1andx2arebothzeroonevariables.
Chooseanyoneofthesetwovariables(x1,say)andtabulate,foreachpossiblevalueofthechosenvariable,the
meaningofthecorrespondingmathematicalandverbaldescriptionsasbelow.
VariablevalueMathematicaldescriptionVerbaldescription
x1+x2=1"eitherx1=1orx2=1"
x1=0x2=1x2=1
x1=11+x2=1x2=0
i.e.x2=0

Itisclearfromthistabulationthatthemathematicalandverbaldescriptionsareequivalentwiththeprovisothat
wehaveinterpretedthecondition"eitherx1=1orx2=1"asmeaningthatthecasex1=1andx2=1(both
projects1and2chosen)cannotoccur.Ifthisisnotso(i.e.bothprojects1and2canbechosen)thenwereplace
theconstraintx1+x2=1bytheconstraintx1+x2>=1(i.e.atleastoneofprojects1and2mustbechosen).
Noteherethat,ingeneral,wecanregardformulatingaproblemastranslatingaverbaldescriptionofthe
problemintoanequivalentmathematicaldescription.Whatwehavepresentedaboveisasimilarprocess
translatingaspecific"either...or..."verbaldescriptionintoanequivalentmathematicaldescription.
Whilstitisnotusualtogotothelengthsofacompletetabulation(asshownabove)toverifythatthe
verbalandmathematicaldescriptionsareequivalentacompletetabulationishelpfulinclarifyingthought
anddetectingincorrectmathematicaldescriptions.
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

1/17

12/5/2016

Integerprogrammingformulationexamples

Otherproblems
ThemainareasinwhichIPisusedinpracticeinclude:
impositionoflogicalconditionsinLPproblems(suchastheeither/orconditiondealtwithabove)
blendingwithalimitednumberofingredients
depotlocation
jobshopscheduling
assemblylinebalancing
airlinecrewscheduling
timetabling

Integerprogrammingexample
Recalltheblendingproblemdealtwithbeforeunderlinearprogramming.Toremindyouofitwereproduceit
below.
Blendingproblem
Considertheexampleofamanufacturerofanimalfeedwhoisproducingfeedmixfordairycattle.Inoursimple
examplethefeedmixcontainstwoactiveingredientsandafillertoprovidebulk.Onekgoffeedmixmust
containaminimumquantityofeachoffournutrientsasbelow:
NutrientABCD
gram9050202

Theingredientshavethefollowingnutrientvaluesandcost
ABCDCost/kg
Ingredient1(gram/kg)10080401040
Ingredient2(gram/kg)2001502060

Whatshouldbetheamountsofactiveingredientsandfillerinonekgoffeedmix?
Blendingproblemsolution
Variables
Inordertosolvethisproblemitisbesttothinkintermsofonekilogramoffeedmix.Thatkilogramismadeup
ofthreepartsingredient1,ingredient2andfillerso:let
x1=amount(kg)ofingredient1inonekgoffeedmix
x2=amount(kg)ofingredient2inonekgoffeedmix
x3=amount(kg)offillerinonekgoffeedmix
wherex1>=0,x2>=0andx3>=0.
Constraints
balancingconstraint(animplicitconstraintduetothedefinitionofthevariables)
x1+x2+x3=1
nutrientconstraints
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

2/17

12/5/2016

Integerprogrammingformulationexamples

100x1+200x2>=90(nutrientA)
80x1+150x2>=50(nutrientB)
40x1+20x2>=20(nutrientC)
10x1>=2(nutrientD)
Notetheuseofaninequalityratherthananequalityintheseconstraints,followingtheruleweputforwardinthe
TwoMinesexample,whereweassumethatthenutrientlevelswewantarelowerlimitsontheamountof
nutrientinonekgoffeedmix.
Objective
Presumablytominimisecost,i.e.
minimise40x1+60x2
whichgivesusourcompleteLPmodelfortheblendingproblem.
Supposenowwehavetheadditionalconditions:
ifweuseanyofingredient2weincurafixedcostof15
weneednotsatisfyallfournutrientconstraintsbutneedonlysatisfythreeofthem(i.e.whereasbeforethe
optimalsolutionrequiredallfournutrientconstraintstobesatisfiednowtheoptimalsolutioncould(ifitis
worthwhiletodoso)onlyhavethree(anythree)ofthesenutrientconstraintssatisfiedandthefourth
violated.
GivethecompleteMIPformulationoftheproblemwiththesetwonewconditionsadded.
Solution
Tocopewiththeconditionthatifx2>=0wehaveafixedcostof15incurredwehavethestandardtrickof
introducingazeroonevariableydefinedby
y=1ifx2>=0
=0otherwise

and
addaterm+15ytotheobjectivefunction
andaddtheadditionalconstraint
x2<=[largestvaluex2cantake]y
Inthiscaseitiseasytoseethatx2canneverbegreaterthanoneandhenceouradditionalconstraintisx2<=y.
Tocopewithconditionthatneedonlysatisfythreeofthefournutrientconstraintsweintroducefourzeroone
variableszi(i=1,2,3,4)where
zi=1ifnutrientconstrainti(i=1,2,3,4)issatisfied
=0otherwise
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

3/17

12/5/2016

Integerprogrammingformulationexamples

andaddtheconstraint
z1+z2+z3+z4>=3(atleast3constraintssatisfied)
andalterthenutrientconstraintstobe
100x1+200x2>=90z1
80x1+150x2>=50z2
40x1+20x2>=20z3
10x1>=2z4
Thelogicbehindthischangeisthatifazi=1thentheconstraintbecomestheoriginalnutrientconstraintwhich
needstobesatisfied.Howeverifazi=0thentheoriginalnutrientconstraintbecomes
samelefthandside>=zero
which(forthefourlefthandsidesdealtwithabove)isalwaystrueandsocanbeneglectedmeaningthe
originalnutrientconstraintneednotbesatisfied.Hencethecomplete(MIP)formulationoftheproblemisgiven
by
minimise40x1+60x2+15y
subjectto
x1+x2+x3=1
100x1+200x2>=90z1
80x1+150x2>=50z2
40x1+20x2>=20z3
10x1>=2z4
z1+z2+z3+z4>=3
x2<=y
zi=0or1i=1,2,3,4
y=0or1
xi>=0i=1,2,3

Integerprogrammingexample
Intheplanningofthemonthlyproductionforthenextsixmonthsacompanymust,ineachmonth,operateeither
anormalshiftoranextendedshift(ifitproducesatall).Anormalshiftcosts100,000permonthandcan
produceupto5,000unitspermonth.Anextendedshiftcosts180,000permonthandcanproduceupto7,500
unitspermonth.Noteherethat,foreithertypeofshift,thecostincurredisfixedbyaunionguaranteeagreement
andsoisindependentoftheamountproduced.
Itisestimatedthatchangingfromanormalshiftinonemonthtoanextendedshiftinthenextmonthcostsan
extra15,000.Noextracostisincurredinchangingfromanextendedshiftinonemonthtoanormalshiftinthe
nextmonth.
Thecostofholdingstockisestimatedtobe2perunitpermonth(basedonthestockheldattheendofeach
month)andtheinitialstockis3,000units(producedbyanormalshift).Theamountinstockattheendofmonth
6shouldbeatleast2,000units.Thedemandforthecompany'sproductineachofthenextsixmonthsis
estimatedtobeasshownbelow:
Month123456
Demand6,0006,5007,5007,0006,0006,000
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

4/17

12/5/2016

Integerprogrammingformulationexamples

Productionconstraintsaresuchthatifthecompanyproducesanythinginaparticularmonthitmustproduceat
least2,000units.Ifthecompanywantsaproductionplanforthenextsixmonthsthatavoidsstockouts,
formulatetheirproblemasanintegerprogram.
Hint:firstformulatetheproblemallowingnonlinearconstraintsandthenattempttomakealltheconstraints
linear.
Solution
Variables
Thedecisionsthathavetobemaderelateto:
whethertooperateanormalshiftoranextendedshiftineachmonthand
howmuchtoproduceeachmonth.
Hencelet:
xt=1ifweoperateanormalshiftinmontht(t=1,2,...,6)
=0otherwise
yt=1ifweoperateanextendedshiftinmontht(t=1,2,...,6)
=0otherwise
Pt(>=0)betheamountproducedinmontht(t=1,2,...,6)

Infact,forthisproblem,wecaneasetheformulationbydefiningthreeadditionalvariablesnamelylet:
zt=1ifweswitchfromanormalshiftinmontht1toanextended
shiftinmontht(t=1,2,...,6)
=0otherwise
Itbetheclosinginventory(amountofstockleft)attheend
ofmontht(t=1,2,...,6)
wt=1ifweproduceinmontht,andhencefromtheproduction
constraintsPt>=2000(t=1,2,...,6)
=0otherwise(i.e.Pt=0)

Themotivationbehindintroducingthefirsttwoofthesevariables(zt,It)isthatintheobjectivefunctionwewill
needtermsrelatingtoshiftchangecostandinventoryholdingcost.Themotivationbehindintroducingthethird
ofthesevariables(wt)istheproductionconstraint"eitherPt=0orPt>=2000",whichneedsazeroonevariable
sothatitcanbedealtwithusingthestandardtrickfor"either/or"constraints.
InanyeventformulatinganIPtendstobeaniterativeprocessandifwehavemadeamistakeindefining
variableswewillencounterdifficultiesinformulatingtheconstraints/objective.Atthatpointwecanredefine
ourvariablesandreformulate.
Constraints
Wefirstexpresseachconstraintinwordsandthenintermsofthevariablesdefinedabove.
onlyoperate(atmost)oneshifteachmonth
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

5/17

12/5/2016

Integerprogrammingformulationexamples

xt+yt<=1t=1,2,...,6

Noteherethatwecouldnothavemadedowithjustonevariable(xtsay)anddefinedthatvariabletobeonefor
anormalshiftandzeroforanextendedshift(sinceinthatcasewhatifwedecidenottoproduceinaparticular
month?).
Althoughwecouldhaveintroducedavariableindicatingnoshift(normalorextended)operatedinaparticular
monththisisnotnecessaryassuchavariableisequivalentto1xtyt.
productionlimitsnotexceeded
Pt<=5000xt+7500ytt=1,2,...,6

Noteheretheuseofadditionintherighthandsideoftheaboveequationwherewearemakinguseofthefact
thatatmostoneofxtandytcanbeoneandtheothermustbezero.
nostockouts
It>=0t=1,2,...,6

wehaveaninventorycontinuityequationoftheform
closingstock=openingstock+productiondemand
whereI0=3000.HencelettingDt=demandinmontht(t=1,2,...,6)(aknownconstant)andassuming
thatopeningstockinperiodt=closingstockinperiodt1and
thatproductioninperiodtisavailabletomeetdemandinperiodt
wehavethat
It=It1+PtDtt=1,2,...,6

Asnotedabovethisequationassumesthatwecanmeetdemandinthecurrentmonthfromgoodsproducedthat
month.Anytimelagbetweengoodsbeingproducedandbecomingavailabletomeetdemandiseasily
incorporatedintotheaboveequation.Forexamplefora2monthtimelagwereplacePtintheaboveequationby
Pt2andinterpretItasthenumberofgoodsinstockattheendofmonthtwhichareavailabletomeetdemand
i.e.goodsarenotregardedasbeinginstockuntiltheyareavailabletomeetdemand.Inventorycontinuity
equationsofthetypeshownarecommoninproductionplanningproblems.
theamountinstockattheendofmonth6shouldbeatleast2000units
I6>=2000

productionconstraintsoftheform"eitherPt=0orPt>=2,000".
Herewemakeuseofthestandardtrickwepresentedfor"either/or"constraints.Wehavealreadydefined
appropriatezeroonevariableswt(t=1,2,...,6)andsowemerelyneedtheconstraints
Pt<=Mwtt=1,2,...,6
Pt>=2000wtt=1,2,...,6

HereMisapositiveconstantandrepresentsthemostwecanproduceinanyperiodt(t=1,2,...,6).Aconvenient
valueforMforthisexampleisM=7500(themostwecanproduceirrespectiveoftheshiftoperated).
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

6/17

12/5/2016

Integerprogrammingformulationexamples

wealsoneedtorelatetheshiftchangevariablezttotheshiftsbeingoperated
Theobviousconstraintis
zt=xt1ytt=1,2,...,6

sinceasbothxt1andytarezeroonevariablesztcanonlytakethevalueoneifbothxt1andytareone(i.e.we
operateanormalshiftinperiodt1andanextendedshiftinperiodt).Lookingbacktotheverbaldescriptionof
ztitisclearthatthemathematicaldescriptiongivenaboveisequivalenttothatverbaldescription.(Notehere
thatwedefinex0=1(y0=0)).
Thisconstraintisnonlinear.Howeverwearetoldthatwecanfirstformulatetheproblemwithnonlinear
constraintsandsoweproceed.Weshallseelaterhowtolinearise(generateequivalentlinearconstraintsfor)this
equation.
Objective
Wewishtominimisetotalcostandthisisgivenby
SUM{t=1,...,6}(100000xt+180000yt+15000zt+2It)
Henceourformulationiscomplete.
Notethat,inpractise,wewouldprobablyregardItandPtastakingfractionalvaluesandroundtogetinteger
values(sincetheyarebothlargethisshouldbeacceptable).Notetooherethatthisisanonlinearinteger
program.
Comments
Inpracticeamodelofthiskindwouldbeusedona"rollinghorizon"basiswherebyeverymonthorsoitwould
beupdatedandresolvedtogiveanewproductionplan.
Theinventorycontinuityequationpresentedisquiteflexible,beingabletoaccommodatebothtimelags(as
discussedpreviously)andwastage.Forexampleif2%ofthestockiswastedeachmonthdueto
deterioration/pilferingetcthentheinventorycontinuityequationbecomesIt=0.98It1+PtDt.Notethat,if
necessary,theobjectivefunctioncanincludeatermrelatedto0.02It1toaccountforthelossinfinancialterms.
Inordertolinearise(generateequivalentlinearconstraints)forournonlinearconstraintweagainuseastandard
trick.Notethatthatequationisoftheform
A=BC
whereA,BandCarezeroonevariables.Thestandardtrickisthatanonlinearconstraintofthistypecanbe
replacedbythetwolinearconstraints
A<=(B+C)/2and
A>=B+C1
ToseethisweusethefactthatasBandCtakeonlyzeroonevaluesthereareonlyfourpossiblecasesto
consider:
BCA=BCA<=(B+C)/2A>=B+C1
becomesbecomesbecomes
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

7/17

12/5/2016

Integerprogrammingformulationexamples

00A=0A<=0A>=1
01A=0A<=0.5A>=0
10A=0A<=0.5A>=0
11A=1A<=1A>=1

Then,recallingthatAcanalsoonlytakezeroonevalues,itisclearthatineachofthefourpossiblecasesthe
twolinearconstraints(A<=(B+C)/2andA>=B+C1)areequivalenttothesinglenonlinearconstraint
(A=BC).
Returningnowtoouroriginalnonlinearconstraint
zt=xt1yt
thisinvolvesthethreezeroonevariableszt,xt1andytandsowecanuseourgeneralruleandreplacethisnon
linearconstraintbythetwolinearconstraints
zt<=(xt1+yt)/2t=1,2,...,6
andzt>=xt1+yt1t=1,2,...,6

Makingthischangetransformsthenonlinearintegerprogramgivenbeforeintoanequivalentlinearinteger
program.
Integerprogrammingexample1996MBAexam
Atoymanufacturerisplanningtoproducenewtoys.Thesetupcostoftheproductionfacilitiesandtheunit
profitforeachtoyaregivenbelow.:
ToySetupcost()Profit()
14500012
27600016

Thecompanyhastwofactoriesthatarecapableofproducingthesetoys.Inordertoavoiddoublingthesetup
costonlyonefactorycouldbeused.
Theproductionratesofeachtoyaregivenbelow(inunits/hour):
Toy1Toy2
Factory15238
Factory24223

Factories1and2,respectively,have480and720hoursofproductiontimeavailablefortheproductionofthese
toys.Themanufacturerwantstoknowwhichofthenewtoystoproduce,whereandhowmanyofeach(ifany)
shouldbeproducedsoastomaximisethetotalprofit.
Introducing01decisionvariablesformulatetheaboveproblemasanintegerprogram.(Donottryto
solveit).
Explainbrieflyhowtheabovemathematicalmodelcanbeusedinproductionplanning.
Solution
Variables
Weneedtodecidewhethertosetupafactorytoproduceatoyornotsoletfij=1iffactoryi(i=1,2)issetupto
producetoysoftypej(j=1,2),0otherwise
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

8/17

12/5/2016

Integerprogrammingformulationexamples

Weneedtodecidehowmanyofeachtoyshouldbeproducedineachfactorysoletxijbethenumberoftoysof
typej(j=1,2)producedinfactoryi(i=1,2)wherexij>=0andinteger.
Constraints
ateachfactorycannotexceedtheproductiontimeavailable
x11/52+x12/38<=480
x21/42+x22/23<=720
cannotproduceatoyunlesswearesetuptodoso
x11<=52(480)f11
x12<=38(480)f12
x21<=42(720)f21
x22<=23(720)f22
Objective
Theobjectiveistomaximisetotalprofit,i.e.
maximise12(x11+x21)+16(x12+x22)45000(f11+f21)76000(f12+f22)
Noteherethatthequestionsaysthatinordertoavoiddoublingthesetupcostsonlyonefactorycouldbeused.
Thisisnotaconstraint.Wecanarguethatifitisonlycostconsiderationsthatpreventususingmorethanone
factorythesecostconsiderationshavealreadybeenincorporatedintothemodelgivenaboveandthemodelcan
decideforushowmanyfactoriestouse,ratherthanweartificiallyimposingalimitviaanexplicitconstrainton
thenumberoffactoriesthatcanbeused.
Theabovemathematicalmodelcouldbeusedinproductionplanninginthefollowingway:
enablesustomaximiseprofit,ratherthanrelyingonanadhocjudgementalapproach
canbeusedforsensitivityanalysisforexampletoseehowsensitiveourproductionplanningdecisionis
tochangesintheproductionrates
enablesustoseetheeffectuponproductionof(say)increasingtheprofitperunitontoy1
enablesustoeasilyreplanproductionintheeventofachangeinthesystem(e.g.areductioninthe
availableproductionhoursatfactoryoneduetoincreasedworkfromotherproductsmadeatthatfactory)
canuseonarollinghorizonbasistoplanproductionastimepasses(inwhichcaseweperhapsneedto
introduceatimesubscriptintotheabovemodel)
Integerprogrammingexample1995MBAexam
Aprojectmanagerinacompanyisconsideringaportfolioof10largeprojectinvestments.Theseinvestments
differintheestimatedlongrunprofit(netpresentvalue)theywillgenerateaswellasintheamountofcapital
required.
LetPjandCjdenotetheestimatedprofitandcapitalrequired(bothgiveninunitsofmillionsof)for
investmentopportunityj(j=1,...,10)respectively.Thetotalamountofcapitalavailablefortheseinvestmentsis
Q(inunitsofmillionsof)

http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

9/17

12/5/2016

Integerprogrammingformulationexamples

Investmentopportunities3and4aremutuallyexclusiveandsoare5and6.Furthermore,neither5nor6canbe
undertakenunlesseither3or4isundertaken.Atleasttwoandatmostfourinvestmentopportunitieshavetobe
undertakenfromtheset{1,2,7,8,9,10}.
Theprojectmanagerwishestoselectthecombinationofcapitalinvestmentsthatwillmaximisethetotal
estimatedlongrunprofitsubjecttotherestrictionsdescribedabove.
Formulatethisproblemusinganintegerprogrammingmodelandcommentonthedifficultiesofsolvingthis
model.(Donotactuallysolveit).
Whataretheadvantagesanddisadvantagesofusingthismodelforportfolioselection?
Solution
Variables
Weneedtodecidewhethertouseaninvestmentopportunityornotsoletxj=1ifweuseinvestment
opportunityj(j=1,...,10),0otherwise
Constraints
totalamountofcapitalavailablefortheseinvestmentsisQ
SUM{j=1,...,10}Cjxj<=Q
investmentopportunities3and4aremutuallyexclusiveandsoare5and6
x3+x4<=1
x5+x6<=1
neither5nor6canbeundertakenunlesseither3or4isundertaken
x5<=x3+x4
x6<=x3+x4
atleasttwoandatmostfourinvestmentopportunitieshavetobeundertakenfromtheset{1,2,7,8,9,10}
x1+x2+x7+x8+x9+x10>=2
x1+x2+x7+x8+x9+x10<=4
Objective
Theobjectiveistomaximisethetotalestimatedlongrunprofiti.e.
maximiseSUM{j=1,...,10}Pjxj
Themodelgivenaboveisaverysmallzerooneintegerprogrammingproblemwithjust10variablesand7
constraintsandshouldbeveryeasytosolve.Forexampleevenbycomplete(total)enumerationtherearejust
210=1024possiblesolutionstobeexamined.
Theadvantagesanddisadvantagesofusingthismodelforportfolioselectionare:
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

10/17

12/5/2016

Integerprogrammingformulationexamples

enablesustomaximiseprofit,ratherthanrelyingonanadhocjudgementalapproach
canbeeasilyextendedtodealwithalargernumberofpotentialinvestmentopportunities
canbeusedforsensitivityanalysis,forexampletoseehowsensitiveourportfolioselectiondecisionisto
changesinthedata
themodelfailstotakeintoaccountanystatisticaluncertainly(risk)inthedata,itisacompletely
deterministicmodel,forexampleprojectjmighthavea(knownorestimated)statisticaldistributionforits
profitPjandsowemightneedamodelthattakesthisdistributionintoaccount
Integerprogrammingexample1994MBAexam
Afoodismanufacturedbyrefiningrawoilsandblendingthemtogether.Therawoilscomeintwocategories:
Vegetableoil:
VEG1
VEG2
Nonvegetableoil:
OIL1
OIL2
OIL3
Thepricesforbuyingeachoilaregivenbelow(in/tonne)
VEG1VEG2OIL1OIL2OIL3
115128132109114

Thefinalproductsellsat180pertonne.Vegetableoilsandnonvegetableoilsrequiredifferentproduction
linesforrefining.Itisnotpossibletorefinemorethan210tonnesofvegetableoilsandmorethan260tonnesof
nonvegetableoils.Thereisnolossofweightintherefiningprocessandthecostofrefiningmaybeignored.
Thereisatechnicalrestrictionrelatingtothehardnessofthefinalproduct.Intheunitsinwhichhardnessis
measuredthismustliebetween3.5and6.2.Itisassumedthathardnessblendslinearlyandthatthehardnessof
therawoilsis:
VEG1VEG2OIL1OIL2OIL3
8.86.21.94.35.1

Itisrequiredtodeterminewhattobuyandhowtoblendtherawoilssothatthecompanymaximisesitsprofit.
Formulatetheaboveproblemasalinearprogram.(Donotactuallysolveit).
Whatassumptionsdoyoumakeinsolvingthisproblembylinearprogramming?
Thefollowingextraconditionsareimposedonthefoodmanufactureproblemstatedaboveasaresultofthe
productionprocessinvolved:
thefoodmayneverbemadeupofmorethan3rawoils
ifanoil(vegetableornonvegetable)isused,atleast30tonnesofthatoilmustbeused
ifeitherofVEG1orVEG2areusedthenOIL2mustalsobeused
Introducing01integervariablesextendthelinearprogrammingmodelyouhavedevelopedtoencompassthese
newextraconditions.
Solution
Variables
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

11/17

12/5/2016

Integerprogrammingformulationexamples

Weneedtodecidehowmuchofeachoiltousesoletxibethenumberoftonnesofoiloftypeiused(i=1,...,5)
wherei=1correspondstoVEG1,i=2correspondstoVEG2,i=3correspondstoOIL1,i=4correspondstoOIL2
andi=5correspondstoOIL3andwherexi>=0i=1,...,5
Constraints
cannotrefinemorethanacertainamountofoil
x1+x2<=210
x3+x4+x5<=260
hardnessofthefinalproductmustliebetween3.5and6.2
(8.8x1+6.2x2+1.9x3+4.3x4+5.1x5)/(x1+x2+x3+x4+x5)>=3.5
(8.8x1+6.2x2+1.9x3+4.3x4+5.1x5)/(x1+x2+x3+x4+x5)<=6.2
Objective
Theobjectiveistomaximisetotalprofit,i.e.
maximise180(x1+x2+x3+x4+x5)115x1128x2132x3109x4114x5
Theassumptionswemakeinsolvingthisproblembylinearprogrammingare:
alldata/numbersareaccurate
hardnessdoesindeedblendlinearly
nolossofweightinrefining
cansellallweproduce
Integerprogram
Variables
Inordertodealwiththeextraconditionsweneedtodecidewhethertouseanoilornotsoletyi=1ifweuse
anyofoili(i=1,...,5),0otherwise
Constraints
mustrelatetheamountused(xvariables)totheintegervariables(y)thatspecifywhetheranyisusedor
not
x1<=210y1
x2<=210y2
x3<=260y3
x4<=260y4
x5<=260y5
thefoodmayneverbemadeupofmorethan3rawoils
y1+y2+y3+y4+y5<=3
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

12/17

12/5/2016

Integerprogrammingformulationexamples

ifanoil(vegetableornonvegetable)isused,atleast30tonnesofthatoilmustbeused
xi>=30yii=1,...,5
ifeitherofVEG1orVEG2areusedthenOIL2mustalsobeused
y4>=y1
y4>=y2
Objective
Theobjectiveisunchangedbytheadditionoftheseextraconstraintsandvariables.
Integerprogrammingexample1985UGexam
Afactoryworksa24hourday,7dayweekinproducingfourproducts.Sinceonlyoneproductcanbeproduced
atatimethefactoryoperatesasystemwhere,throughoutoneday,thesameproductisproduced(andthenthe
nextdayeitherthesameproductisproducedorthefactoryproducesadifferentproduct).Therateofproduction
is:
Product1234
No.ofunitsproducedperhourworked100250190150

Theonlycomplicationisthatinchangingfromproducingproduct1onedaytoproducingproduct2thenextday
fiveworkinghoursarelost(fromthe24hoursavailabletoproduceproduct2thatday)duetothenecessityof
cleaningcertainoiltanks.
Toassistinplanningtheproductionforthenextweekthefollowingdataisavailable:
CurrentDemand(units)foreachdayoftheweek
Productstock1234567
(units)
1500015001700190010002000500500
2700040005001000300050010002000
39000200020003000200020002000500
4800030002000200010001000500500

Product3wasproducedonday0.Thefactoryisnotallowedtobeidle(i.e.oneofthefourproductsmustbe
producedeachday).Stockoutsarenotallowed.Attheendofday7theremustbe(foreachproduct)atleast
1750unitsinstock.
Ifthecostofholdingstockis1.50perunitforproducts1and2but2.50perunitforproducts3and4(based
onthestockheldattheendofeachday)formulatetheproblemofplanningtheproductionforthenextweekas
anintegerprograminwhichalltheconstraintsarelinear.
Solution
Variables
Thedecisionsthathavetobemaderelatetothetypeofproducttoproduceeachday.Hencelet:

http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

13/17

12/5/2016

Integerprogrammingformulationexamples

xit=1ifproduceproducti(i=1,2,3,4)ondayt(t=1,2,3,4,5,6,7)=0otherwise
Infact,forthisproblem,wecaneasetheformulationbydefiningtwoadditionalvariablesnamelylet:
Iitbetheclosinginventory(amountofstockleft)ofproducti(i=1,2,3,4)ondayt(t=1,2,...,7)
Pitbethenumberofunitsofproducti(i=1,2,3,4)producedondayt(t=1,2,...,7)
Constraints
onlyproduceoneproductperday
x1t+x2t+x3t+x4t=1t=1,2,...,7

nostockouts
Iit>=0i=1,...,4t=1,...,7

wehaveaninventorycontinuityequationoftheform
closingstock=openingstock+productiondemand
LettingDitrepresentthedemandforproducti(i=1,2,3,4)ondayt(t=1,2,...,7)wehave
I10=5000
I20=7000
I30=9000
I40=8000

representingtheinitialstocksituationand
Iit=Iit1+PitDiti=1,...,4t=1,...,7

fortheinventorycontinuityequation.
Noteherethatweassumethatwecanmeetdemandinmonthtfromgoodsproducedinmonthtandalsothatthe
openingstockinmontht=theclosingstockinmontht1.
productionconstraint
LetRirepresenttheworkrate(units/hour)forproducti(i=1,2,3,4)thentheproductionconstraintis
Pit=xit[24Ri]i=1,3,4t=1,...,7

whichcoverstheproductionforallexceptproduct2and
P2t=[24R2]x2t[5R2]x2tx1t1t=1,...,7

i.e.forproduct2welose5hoursproductionifweareproducingproduct2inperiodtandweproducedproduct
1thepreviousperiod.Noteherethatweinitialiseby
x10=0

sinceweknowwewerenotproducingproduct1onday0.PlainlytheconstraintinvolvingP2tisnonlinearasit
involvesatermwhichistheproductoftwovariables.Howeverwecanlineariseitbyusingthetrickthatgiven
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

14/17

12/5/2016

Integerprogrammingformulationexamples

threezeroonevariables(A,B,Csay)thenonlinearconstraint
A=BC
canbereplacedbythetwolinearconstraints
A<=(B+C)/2and
A>=B+C1
HenceintroduceanewvariableZtdefinedbytheverbaldescription
Zt=1ifproduceproduct2ondaytandproduct1ondayt1
=0otherwise

Then
Zt=x2tx1t1t=1,...,7

andournonlinearequationbecomes
P2t=[24R2]x2t[5R2]Ztt=1,...,7

andapplyingourtrickthenonlinearequationforZtcanbereplacedbythetwolinearequations
Zt<=(x2t+x1t1)/2t=1,...,7
Zt>=x2t+x1t11t=1,...,7

closingstock
Ii7>=1750i=1,...,4

allvariables>=0andinteger,(xit)and(Zt)zeroonevariables
Notethat,inpractise,wewouldprobablyregard(Iit)and(Pit)astakingfractionalvaluesandroundtoget
integervalues(sincetheyarebothquitelargethisshouldbeacceptable).
Objective
Wewishtominimisetotalcostandthisisgivenby
SUM{t=1,...,7}(1.50I1t+1.50I2t+2.50I3t+2.50I4t)

Noteherethatthisprogrammaynothaveafeasiblesolution,i.e.itmaysimplynotbepossibletosatisfyallthe
constraints.Thisisirrelevanttotheprocessofconstructingthemodelhowever.Indeedoneadvantageofthe
modelmaybethatitwilltellus(onceacomputationalsolutiontechniqueisapplied)thattheproblemis
infeasible.
Integerprogrammingexample1987UGexam
Acompanyisattemptingtodecidethemixofproductswhichitshouldproducenextweek.Ithasseven
products,eachwithaprofit()perunitandaproductiontime(manhours)perunitasshownbelow:

http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

15/17

12/5/2016

Integerprogrammingformulationexamples

ProductProfit(perunit)Productiontime(manhoursperunit)
1101.0
2222.0
3353.7
4192.4
5554.5
6100.7
71159.5

Thecompanyhas720manhoursavailablenextweek.
Formulatetheproblemofhowmanyunits(ifany)ofeachproducttoproducenextweekasaninteger
programinwhichalltheconstraintsarelinear.
Incorporatethefollowingadditionalrestrictionsintoyourintegerprogram(retaininglinearconstraintsanda
linearobjective):
Ifanyofproduct7areproducedanadditionalfixedcostof2000isincurred.
Eachunitofproduct2thatisproducedover100unitsrequiresaproductiontimeof3.0manhoursinstead
of2.0manhours(e.g.producing101unitsofproduct2requires100(2.0)+1(3.0)manhours).
Ifbothproduct3andproduct4areproduced75manhoursareneededforproductionlinesetupand
hencethe(effective)numberofmanhoursavailablefallsto72075=645.
Solution
Letxi(integer>=0)bethenumberofunitsofproductiproducedthentheintegerprogramis
maximise
10x1+22x2+35x3+19x4+55x5+10x6+115x7

subjectto
1.0x1+2.0x2+3.7x3+2.4x4+4.5x5+0.7x6+9.5x7<=720
xi>=0integeri=1,2,...,7

Let
z7=1ifproduceproduct7(x7>=1)
=0otherwise

then
subtract2000z7fromtheobjectivefunctionand
addtheconstraintx7<=[mostwecanmakeofproduct7]z7
Hence
x7<=(720/9.5)z7
i.e.x7<=75.8z7
sox7<=75z7(sincex7isinteger)

Lety2=numberofunitsofproduct2producedinexcessof100unitsthenaddtheconstraints

http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

16/17

12/5/2016

Integerprogrammingformulationexamples

x2<=100
y2>=0integer
andamendtheworktimeconstrainttobe1.0x1+[2.0x2+3.0y2]+3.7x3+2.4x4+4.5x5+0.7x6+9.5x7
<=720
andadd+22y2totheobjectivefunction.
Thiswillworkbecausex2andy2havethesameobjectivefunctioncoefficientbuty2requireslongertoproduce
sowillalwaysgetmoreflexibilitybyproducingx2first(uptothe100limit)beforeproducingy2.
Introduce
Z=1ifproducebothproduct3andproduct4(x3>=1andx4>=1)
=0otherwise
z3=1ifproduceproduct3(x3>=1)
=0otherwise
z4=1ifproduceproduct4(x4>=1)
=0otherwise

and
subtractfromtherhsoftheworktimeconstraint75Z
andaddthetwoconstraints
x3<=[mostwecanmakeofproduct3]z3
x4<=[mostwecanmakeofproduct4]z4
i.e.
x3<=194z3andx4<=300z4

andrelateZtoz3andz4withthenonlinearconstraint
Z=z3z4
whichwelinearisebyreplacingthenonlinearconstraintbythetwolinearconstraints
Z>=z3+z41
Z<=(z3+z4)/2

http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

17/17

You might also like