Vous êtes sur la page 1sur 15

An Introduct|on to Spreadsheet

Cpt|m|zat|on Us|ng Lxce| So|ver


1. lnLroducLlon ........................................................................................... 2
2. CreaLlng a spreadsheeL model ............................................................... 3
3. Speclfylng Lhe ob[ecLlve funcLlon........................................................... 7
4. Speclfylng Lhe declslon varlables ........................................................... 7
3. Speclfylng Lhe consLralnLs and Lhe model Lype...................................... 8
6. Solvlng Lhe model ................................................................................ 10
7. SpreadsheeL sLyle................................................................................. 10
8. Warnlng messages and poLenLlal problem areas................................. 12
9. Speclfylng lnLeger declslon varlables ................................................... 13
10. 8eporL flles and dual prlces.................................................................. 14
11. Savlng and loadlng opLlmlzaLlon models ............................................. 13
uownload Lhe laLesL verslon of Lhls documenL and example flles here:

hLLp://www.melss.com/en/publlcaLlons/
Wiitten by }oein Neissnei anu Thanh-Ba Nguyen. This tutoiial is inspiieu by a similai uocument by Naik
Bioauie at Columbia Business School. Thanks foi Seigei Savin foi help anu feeuback.
2 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet


1. Introduct|on
1he ma[or C-based spreadsheeLs used Loday, LoLus, Lxcel and CuaLro, all have bullL-ln opLlmlzers.
1hese opLlmlzers allow llnear, non-llnear, and lnLeger programs Lo be solved wlLhln Lhe spreadsheeL.
1hls gulde provldes a brlef lnLroducLlon Lo uslng Lhe opLlmlzer Solver, whlch ls avallable ln Lhe
Aoolysls group on Lhe uoto Lab ln Lxcel.

I|gure 1: Solver ln Lxcel
lf Lhe uoto Lab does noL have Lhe cholce 5olvet avallable, Lhen look aL Lhe Offlce 8ottoo | xcel
Optloos Lo see lf Lhe AJJ-los opLlon appear Lhere. lf lL does appear, please selecL xcel AJJ-los from
Lhe Moooqe drop down. 1hen cllck Co... and make sure LhaL Solver ls enabled. lf Lhe AJJ-los opLlon
does noL appear, run Lhe SeLup program agaln Lo lnsLall lL.
3 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet


I|gure 2: Lnabllng Solver
Cne advanLage of Lhe spreadsheeL approach Lo opLlmlzaLlon ls LhaL many opLlmlzaLlon models
can be represenLed ln an undersLandable fashlon ln a spreadsheeL. AnoLher beneflL ls LhaL many
people are already famlllar wlLh uslng spreadsheeLs. 1he spreadsheeL copy command allows large
models wlLh many slmllar consLralnLs Lo be creaLed and solved qulckly ln a spreadsheeL envlronmenL.
Solvlng a llnear program ln Lxcel requlres flve maln sLeps:
1. CreaLlng a spreadsheeL whlch models Lhe problem.
2. Speclfylng Lhe cell whlch conLalns Lhe ob[ecLlve funcLlon.
3. Speclfylng Lhe declslon varlables.
4. Speclfylng Lhe cells whlch deflne Lhe consLralnLs.
3. Solvlng Lhe model, l.e., opLlmlzlng.
Lach sLep ln Lhe process ls descrlbed ln Lhe followlng secLlons. All flgures perLaln Lo MlcrosofL Lxcel
verslon 12 for Wlndows 2007.
2. Creat|ng a spreadsheet mode|
We wlll use a producL mlx example Lo lllusLraLe how Lo lmplemenL a llnear program ln Lxcel. 1he
LancasLer 8rewery musL declde how many barrels of Lhe Lwo Lypes of beer (LancasLer 8londe and
LancasLer 8ed) Lo produce for lLs nexL shlpmenL. lL has a llmlLed supply of lngredlenLs LhaL are used ln
4 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

boLh producLs. Lach barrel of LancasLer 8londe requlres 20 lbs. of corn, 2 ozs. of hops, 10 lbs. of malL,
and ylelds 20 of proflL. Lach barrel of LancasLer 8ed requlres 1 oz. of hops, 30 lbs. of malL, and ylelds
30 of proflL. 1he company has 300 lbs. of corn, 60 ozs. of hops, and 900 lbs. of malL on hand.
ManagemenL wlshes Lo deLermlne Lhe amounL of 8londe and 8ed produce Lo maxlmlze proflLs.
1o answer Lhls quesLlon, we need Lo creaLe a spreadsheeL whlch wlll calculaLe Lhe proflL and Lhe
amounL of lngredlenLs used for any amounL of blonde beer and red beer produced. llgure 3 shows
Lhe beglnnlng of Lhe spreadsheeL loocostet8tewety.xlsx LhaL accompllshes Lhls. All of Lhe cell enLrles
shown ln Lhe spreadsheeL ln llgure 3 are numerlcal values, l.e., no formulas have been enLered yeL.
1he cells C4 and u4 conLaln Lhe amounLs of LancasLer 8ed and LancasLer 8londe Lo be produced ln
Lhe comlng plannlng perlod. 1he proflL conLrlbuLlons for each producL are conLalned ln Lhe cells C3
and u3. 1he amounL of each lngredlenL requlred per unlL of each producL ls glven ln cells C10:u12.
1he quanLlLy of lngredlenLs avallable ln Lhe comlng perlod ls sLored ln cells C10:C12.

I|gure 3: 1he prellmlnary spreadsheeL loocostet8tewety.xlsx
1he cells LhaL we wlll deslgnaLe as Jeclsloo votlobles, cells C4 and C3, are hlghllghLed wlLh a box.
1he cell LhaL we wlll deslgnaLe as Lhe objectlve fooctloo, cell l3, ls hlghllghLed wlLh a double box.
1hese boxes have no funcLlon ln Lhe spreadsheeL excepL for sLyle, Lhey make Lhe spreadsheeL easler
Lo read.
1he nexL sLep ls Lo creaLe a formula for Lhe proflL ln cell l3. roflL ls Lhe amounL of 8londe
produced mulLlplled by Lhe proflL per barrel of 8londe, plus Lhe amounL of 8ed produced mulLlplled
by Lhe proflL per barrel of 8ed. 1he formula for proflL ln cell l3 ls = SuM8CuuC1(C4:u4, C3:u3).
1


1
1he funcLlon = SuM8CuuC1(8lock1, 8lock2) mulLlplles each correspondlng cell from 8lock1 and 8lock2
and Lhen adds Lhe resulLs. lor example, Lhe formula =SuM8CuuC1(C4:u4, C3:u3) ls equlvalenL Lo
S | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

1he amounL of corn requlred for a glven producLlon plan ls compuLed ln cell L10. 1he amounL of
corn requlred ls Lhe amounL of 8londe produced (cell C4) Llmes Lhe corn requlremenL per barrel of
8londe (cell C10), plus Lhe amounL of 8ed produced (cell u4) Llmes Lhe corn requlremenL per barrel
of 8ed (cell u10). 1he formula ln L10 ls = SuM8CuuC1($C$4:$u$4, C10:u10). 1hls ls equlvalenL Lo
Lhe formula +$C$4*C10+$u$4*u10. 1he dollar slgns are added ln Lhe cell addresses for Lhe
producLlon of 8londe and 8ed so LhaL Lhe formula ln cell L10 can be correcLly copled Lo cells L11 and
L12
2
. 1he quanLlLy of lngredlenLs avallable ln Lhe comlng perlod ls sLored ln cells C10:C12.

I|gure 4: 1he spreadsheeL loocostet8tewety.xlsx wlLh formulas
1he spreadsheeL wlLh Lhese formulas ls shown ln llgure 4. We can Lry a few values for Lhe
producLlon quanLlLles Lo LesL Lhe spreadsheeL. lor example, enLer Lhe producLlon plan of 10 barrels

=C4*C3+u4*u3. ln general, boLh blocks musL be of Lhe exacL same slze, l.e., Lhe same number of rows and Lhe
same number of columns. lor example, =SuM8CuuC1(A1:A3, 811:813) ls a valld formula whlle
SuM8CuuC1(A1:A3, 81:83) ls noL valld. 1he SuM8CuuC1 funcLlon ls especlally useful lf Lhe blocks are large.
2
1he dollars slgns ln $C$4:$u$4 are used Lo flx Lhe range when Lhe formula ls copled. WlLhouL Lhe dollar
slgns, Lhe formula ln cell L11 (when copled from L10) would lncorrecLly read =SuM8CuuC1(C3:u3, C11:u11).
WlLh Lhe dollar slgns, Lhe formula ls copled correcLly Lo cell L11 as =SuM8CuuC1($C$4:$u$4, C11:u11).
Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

of 8londe (ln cell C4) and 10 barrels of 8ed (ln cell u4) Lo see whaL Lhe resulLs are. 1he LoLal proflL
should be 300. 1he amounL of corn used ls 200 lbs., compared Lo Lhe 300 lbs. LhaL are avallable.
30 ozs. of hops are used ouL of 60. 1he producLlon plan uses 400 lbs. of malL ouL of 900 lbs.
7 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet


3. Spec|fy|ng the ob[ect|ve funct|on
WlLh all of Lhe formulas enLered ln Lhe spreadsheeL, Lhe nexL sLep ls Lo lnvoke Lhe opLlmlzer l.e.
Solver whlch ls avallable ln Lhe Ana|ys|s group on Lhe Data Lab (cf. lnLroducLlon).

I|gure S: 1he 5olvet lotometets dlalog box
1hls brlngs up Lhe 5olvet lotometets dlalog box shown ln llgure 3. noLlce LhaL Lhe cursor ls
lnlLlally poslLloned ln Lhe box SeL 1argeL Cell," whlch ls Lxcel's Lerm for ob[ecLlve funcLlon". lor
LancasLer 8rewery, Lhe ob[ecLlve ls Lo maxlmlze LoLal proflL, whlch ls compuLed ln cell l3. 1ype l3 or
use Lhe mouse Lo hlghllghL cell l3. noLe LhaL Lhe LargeL cell ls speclfled as Max" by defaulL. lor a
mlnlmlzaLlon problem, Lhe clrcle Mln" should be checked.
uo noL hlL <LnLer> aL Lhls polnL, because LhaL ls equlvalenL Lo asklng Lhe opLlmlzer Lo solve Lhe
problem. 8efore dolng LhaL, Lhe declslon varlables and consLralnLs need Lo be speclfled.
4. Spec|fy|ng the dec|s|on var|ab|es
ln our example, Lhe amounLs of beer and ale Lo produce are Lhe Jeclsloo votlobles, locaLed ln cells
C4:u4. 1he declslon varlable are called cbooqloq cells ln Lxcel. use Lhe mouse or Lype <AlL>-<8> Lo
move Lhe cursor Lo Lhe box labeled 8y Changlng Cells" ln Lhe 5olvet lotometets dlalog box. 1hen
Lype C4:u4 for use Lhe mouse Lo hlghllghL Lhe block C4:u4.
AddlLlonal declslon varlables ln dlfferenL locaLlons of Lhe spreadsheeL can be enLered uslng
commas as separaLors. lor example, you could Lype C4:u4, C10:u12, A14:L16 ln Lhe 8y Changlng
8 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

Cells" box. ln our case Lhls ls noL necessary, slnce Lhere are only Lwo declslon varlables (cells C4 and
u4).
S. Spec|fy|ng the constra|nts and the mode| type
1he nexL sLep ls Lo speclfy Lhe consLralnLs. We flrsL speclfy Lhe nonnegaLlvlLy consLralnLs. 1haL ls, we
need Lo guaranLee LhaL Lhe opLlmal values ln cells C4:u4 are nonnegaLlve. use Lhe mouse Lo cllck on
Lhe Add" buLLon or Lype <AlL>-<A>. 1hls brlngs up Lhe AJJ coosttolot dlalog box shown ln llgure 4
wlLh Lhe cursor lnlLlally poslLloned ln Lhe Cell 8eference" box.
ln Lhe Cell 8eference" parL of Lhe AJJ coosttolot dlalog box, Lype C4:u4 or use Lhe mouse Lo
hlghllghL cells C4:u4. nexL selecL Lhe down arrow and choose >=". 1hen enLer a zero ln Lhe
ConsLralnL" box. 1hls can be done from Lhe keyboard by Lyplng <AlL>-<C> and Lhen 0, or by uslng Lhe
mouse Lo move Lo Lhe approprlaLe area and Lhen Lyplng 0. 1hls meLhod adds Lwo nonnegaLlvlLy
consLralnLs aL one Llme, C4 >= 0 and u4 >= 0, represenLed as $C$4:$u$4 >= 0. Slnce more consLralnLs
need Lo be added, Lype <AlL>-<A> or use Lhe mouse Lo cllck on Lhe Add" buLLon.
1he only oLher consLralnLs are LhaL Lhe LoLal usage of corn, hops, and malL musL be less Lhan or
equal Lo Lhe correspondlng quanLlLles avallable. ln Lhe Cell 8eference" parL of Lhe Add ConsLralnL
dlalog box, Lype L10:L12 or use Lhe mouse Lo hlghllghL cells L10:L12. 1he <=" consLralnL ls Lhe
defaulL. now ln Lhe ConsLralnL" box enLer C10:C12. 1hls can be done from Lhe keyboard by Lyplng
<AlL>-<C> and Lhen Lyplng C10:C12, or by uslng Lhe mouse Lo cllck ln Lhe ConsLralnL" box and Lhen
hlghllghLlng cells C10:C12 ln Lhe spreadsheeL. 1hls procedure has speclfled Lhree separaLe
consLralnLs aL once. Slnce no more consLralnLs need Lo be added, cllck Lhe Ck" buLLon. 1he Solver
arameLers dlalog box should reLurn as shown ln llgure 6.

9 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

I|gure 6: 1he 5olvet lotometets dlalog box wlLh consLralnLs added
ln Lhe Sub[ecL Lo Lhe ConsLralnLs" parL of Lhe 5olvet lotometets dlalog box Lhere should now be
Lwo llnes. 1he flrsL llne $C$4:$u$4 >=0 ls shorL for Lhe Lwo consLralnLs C4 >= 0 and u4 >= 0. Slmllarly,
Lhe second llne $L$10:$L$12 <= $C$10:$C$12 ls shorL for Lhe Lree consLralnLs L10 <= C10, L11 <=
C11, and L12 <= C12. ConsLralnLs can be deleLed by hlghllghLlng Lhe consLralnL and Lhen hlLLlng Lhe
ueleLe" buLLon, or edlLed uslng Lhe Change" buLLon ln Lhe 5olvet lotometets dlalog box.
1hls llnear program has Lwo declslon varlables and flve consLralnLs. Lxcel verslon 12 allows aL
mosL 200 declslon varlables. lL allows one upper llmlL and one lower llmlL consLralnL on any declslon
varlable plus up Lo 100 addlLlonal consLralnLs
3
.
5peclfyloq o lloeot moJel
Slnce Lhls model ls a llnear program (as opposed Lo a nonllnear program), lL ls good pracLlce Lo leL Lhe
opLlmlzer know Lhls. Choose Lhe CpLlons" buLLon ln Lhe 5olvet lotometets dlalog box. 1hls brlngs up
Lhe 5olvet Optloos dlalog box shown ln llgure 7.
Check Lhe Assume Llnear Model" box and Lhen cllck on Lhe Ck" buLLon. 1hls Lells Lhe opLlmlzer
LhaL Lhe model ls a llnear program, as opposed Lo a more compllcaLed nonllnear program. 1he
advanLages of speclfylng a llnear model are fasLer soluLlon Llmes, more accuraLe and rellable resulLs,
and Lhe avallablllLy of more deLalled senslLlvlLy analysls reporLs. AfLer cllcklng on Lhe Ck" buLLon Lhe
5olvet lotometets dlalog box should reLurn.


3
hLLp://www.solver.com/suppsLdslzellm.hLm
10 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

I|gure 7: 1he 5olvet Optloos dlalog box
6. So|v|ng the mode|
1he producLlon model for Lhe LancasLer 8rewery ls now ready Lo be solved. 1o acLlvaLe Lhe opLlmlzer,
Lype <AlL>-<S> or use Lhe mouse Lo cllck Lhe Solve" buLLon. AfLer a few seconds, Lhe 5olvet kesolts
dlalog box should appear. Slnce Lhe defaulL ls keep Solver SoluLlon" cllcklng on Ck" wlll close Lhe
dlalog box and reveal Lhe opLlmal soluLlon as lllusLraLed ln llgure 8. We wlll reLurn Lo Lhe 8eporLs"
parL of Lhe 5olvet kesolts dlalog box a blL laLer.

I|gure 8: 1he spreadsheeL afLer opLlmlzlng
7. Spreadsheet sty|e
Cne of Lhe drawbacks of spreadsheeLs ls a lock of Jocomeototloo. lor example, Lhe numerlcal values
for Lhe opLlmal soluLlon are clearly shown ln llgure 8. Powever, none of Lhe formulas used ln Lhe
model are dlsplayed. none of Lhe consLralnLs are vlslble ln llgure 8. 1o ald ln communlcaLlng Lhe
underlylng ldeas ln a spreadsheeL lL ls lmporLanL Lo adopL good spreadsheeL style. Whlle sLyle ls
somewhaL a maLLer of personal LasLe, Lhere's good LasLe and bad LasLe.
1hroughouL Lhls course, we wlll adopL some sLyllsLlc convenLlons. llrsL, all declslon varlables wlll
be enclosed ln a sloqle box and (for Lhose forLunaLe enough Lo have color dlsplays) colored bloe. 1he
ob[ecLlve funcLlon wlll be enclosed ln a Jooble box and colored teJ. ConsLralnLs wlll be lndlcaLed
uslng =ll funcLlons as descrlbed below.
1o puL a box around a block of declslon varlables, flrsL hlghllghL (selecL) Lhe block. 1hen cllck on
Lhe rlghL mouse buLLon Lo brlng up a menu. Move Lhe cursor Lo Lhe lormaL Cells." menu lLem and
Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

cllck on Lhe lefL mouse buLLon. 1he lotmot cells dlalog box should appear. Choose Lhe 8order" Lab
and ln Lhe SLyle" secLlon choose Lhe slngle llne (whlch ls Lhe defaulL). 1hen choose Lhe border
CuLllne". llnally, cllck on Lhe Ck" buLLon for Lhe llne drawlng Lo Lake effecL.
1o change Lhe LexL color of Lhe declslon varlables, brlng up Lhe lotmot cells dlalog box as before.
Choose Lhe lonL" Lab, selecL Color", selecL Lhe color blue, and Lhen cllck on Lhe Ck" buLLon.
1he same procedure can be used Lo puL a double box around Lhe ob[ecLlve funcLlon cell (1he
dlfference ls LhaL a double llne should be selecLed wlLhln llne SLyle"). 1hen change Lhe LexL color of
Lhe ob[ecLlve cell Lo red.
coosttolot style
1o vlew Lhe consLralnLs Lhe user can always brlng up Lhe 5olvet lotometets dlalog box. 1he user Lhen
has Lo declpher Lhe llne $L$10:$L$12 <= $C$10:$C$12, whlch really means LhaL Lhe amounL of each
lngredlenL used musL be less Lhan or equal Lo Lhe correspondlng quanLlLy avallable. As an alLernaLlve,
conslder puLLlng Lhe formula
=ll(C10<=C10,"<=","noL <=")
ln cell l10. 1hls formula says LhaL lf Lhe amounL of corn used ls less Lhan or equal Lo Lhe amounL
avallable, dlsplay <=", oLherwlse, dlsplay noL<=". 1hls formula serves Lwo purposes. llrsL, lL glves a
qulck vlsual lndlcaLlon on Lhe spreadsheeL LhaL a consLralnL exlsLs. Second, lL lndlcaLes wheLher or noL
Lhe consLralnL ls vlolaLed.
unforLunaLely, because compuLers work wlLh flnlLe preclslon numbers, Lhe prevlous formula
does noL always work. lor example, afLer opLlmlzlng cell L10 could conLaln Lhe value 300.000000001,
whlch ls greaLer Lhan 300 sLored ln cell C10. 1o Lhe compuLer, Lhls value ls close enough" Lo
saLlsfylng Lhe consLralnL L10 <= C10. 1o accommodaLe Lhls evenL, Lhe formula placed ln cell l10 ls
=ll(L10<=C10+1.0L-03,"<=","noL <=")
(8ecall 1.0L-03 means 0,00001). now, even lf Lhe value ln cell l10 ls a Llny blL greaLer Lhan Lhe value
ln cell C10, cell l10 wlll show <=". 1he formula ln cell l10 ls called a coosttolot loJlcotot. lL can be
copled Lo cells l11:l12 Lo lndlcaLe Lhe Lwo oLher scarce resource consLralnLs.
llgure 9 shows whaL Lhe spreadsheeL looks llke for Lhe producLlon plan conslsLlng of 30 barrels
of 8ed only. 1he malL consLralnL ls vlolaLed because Lhe producLlon plan requlres 1,300 lbs. of corn,
buL only 900 lbs. are avallable. Cell l12 dlsplays noL <=" and Lhe producLlon plan ls lofeoslble. 1he
corn and hops consLralnLs are noL vlolaLed, so cells l10 and l11 boLh dlsplay <=". lor readablllLy ln
Lhe spreadsheeL, lL ls a good ldea, where posslble, Lo keep a lefL-Lo-rlghL consLralnL order:
consLralned cell, consLralnL lndlcaLor, consLralnL llmlL.
Suppose Lhe model had a greaLer Lhan or equal Lo consLralnL, e.g., L10 >= C10. 1hen consLralnL
lndlcaLor ln cell l10 would be
=ll(L10<=C10+1.0L-03,"<=","noL <=")
lor an equallLy consLralnL, e.g., L10 = C10, Lhe consLralnL lndlcaLor ln cell l10 would be
12 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

=ll(A8S(L10-C10)<1.0L-03,"=","noL =").

I|gure 9: 1he spreadsheeL wlLh consLralnLs lndlcaLed
8. Warn|ng messages and potent|a| prob|em areas
1here are several plLfalls Lo avold when uslng Lhe Lxcel for Wlndow opLlmlzer. lor example,
spreadsheeL models ofLen need Lo be scaled so LhaL Lhere are noL exLremely large and exLremely
small numbers ln Lhe same model. 1hls lssue and oLher poLenLlal problems are LreaLed ln Lhls secLlon.
5electeJ Joto Joesot poollfy os o lloeot moJel
Cne error message LhaL Lhe Lxcel opLlmlzer can glve ls 1he condlLlons for Assume Llnear Model are
noL saLlsfled". 1hls can happen lf Lhe model ls nonllnear, buL Lhe user checked Lhe Assume Llnear
Model" opLlon. Powever, lL can also happen because Lhe problem ls poorly scaled. A poorly scaled
model ls one wlLh numbers LhaL are very dlfferenL ln slze, e.g. 0.0003 and 400,000,000. CfLen Lhe
unlLs of Lhe declslon varlables and/or consLralnLs can be changed Lo achleve a beLLer re-scaled"
model. AlLernaLlvely, Lhe reclslon of Lhe opLlmlzer can be changed ln Lhe 5olvet Optloos dlalog box.
lor example, Lhe preclslon could be changed from 1.0L-06 Lo 0.001.
MoJel too lotqe
13 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

unforLunaLely Lxcel has bullL-ln llmlLs on Lhe slze of models lL can solve. 1he currenL verslon llmlLs
opLlmlzaLlon models Lo aL mosL 200 declslon varlables. lL allows one upper llmlL and one lower llmlL
consLralnL on any declslon varlable plus up Lo 100 addlLlonal consLralnLs
4
.
ulfflculL nonllnear programs
AfLer hlLLlng Lhe Solve" buLLon ln Lhe 5olvet lotometets dlalog box, Lhe opLlmlzer usually reLurns
wlLh Lhe 5olvet kesolts dlalog box and Lhe message Solver found a soluLlon. All consLralnLs and
opLlmallLy condlLlons are saLlsfled". lor some hlghly nonllnear problems, Lhe opLlmlzer mlghL noL
glve Lhe opLlmal soluLlon, even Lhough lL says oLherwlse. lf you suspecL Lhls ls Lhe case, Lry changlng
Lhe lnlLlal values of Lhe declslon varlables o a beLLer guess and Lhen re-solve Lhe model. CLher
posslble remedles lnclude changlng some of Lhe oLher opLlons ln Lhe 5olvet Optloos dlalog box. lf Lhe
model ls poorly scaled, Lry changlng Lhe unlLs of Lhe declslon varlables and/or consLralnLs Lo achleve
a beLLer re-scaled" model.
9. Spec|fy|ng |nteger dec|s|on var|ab|es
1he Lxcel opLlmlzer can solve opLlmlzaLlon models wlLh lnLeger varlables. ln Lxcel, an lnLeger varlable
refers Lo a general lnLeger varlable, l.e. a varlable resLrlcLed Lo Lhe values ., -2, -1, 0, 1, 2, . lnLeger
varlables can be speclfled ln Lhe AJJ coosttolot dlalog box by selecLlng Lhe down arrow and chooslng
lnL".
1o speclfy a blnary (0, 1) varlable, flrsL consLraln Lhe varlable Lo be lnLeger as descrlbed above.
1hen add Lwo consLralnLs speclfylng LhaL Lhe varlable musL be nonnegaLlve and less Lhan or equal
Lo 1.
8e sparlng ln Lhe use of lnLeger varlables, because Lhey can slgnlflcanLly slow Lhe opLlmlzer. lL
almosL never necessary Lo resLrlcL varlables represenLlng Lhe number of lLems Lo produce Lo be
lnLeger. lor example, suppose LhaL a declslon varlable represenLs Lhe number of cars Lo produce ln a
year. uoes lL really maLLer LhaL Lhe soluLlon ls Lo produce 314,234.8 cars? 1he lnpuL daLa ls probably
noL accuraLe Lo more Lhan Lwo slgnlflcanL dlglLs, so lL does noL make sense Lo worry abouL Lhe
fracLlonal 0.8 car.
1he opLlmlzer does noL always solve lnLeger programs Lo opLlmallLy. 1he toletooce parameLer ln
Lhe 5olvet Optloos dlalog box ls seL Lo 3 by defaulL. 1hls means LhaL Lhe opLlmlzer wlll sLop when
Lhe soluLlon wlLhln 3 of Lhe Lrue opLlmal soluLlon. Lven wlLh Lhe Lolerance parameLer seL Lo 3 Lhe
opLlmlzer wlll ofLen glve Lhe Lrue opLlmal soluLlon. 1he defaulL seLLlng ls 0.03 because lnLeger
programs can Lake a very long Llme Lo solve. 1o ensure LhaL Lhe exacL opLlmal soluLlon ls obLalned,
Lhe Lolerance parameLer shouL be seL Lo 0.0.

4
hLLp://www.solver.com/suppsLdslzellm.hLm
14 | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet

10. keport f||es and dua| pr|ces
Lxcel can generaLe more deLalled soluLlon reporLs, raLher Lhan [usL showlng Lhe opLlmal soluLlon ln
Lhe spreadsheeL. !usL afLer solvlng a model, Lhe 5olvet kesolts dlalog box should appear. 1he
8eporLs" parL of Lhe Solver 8esulLs dlalog box conLalns Lhree opLlons: Answer", SenslLlvlLy" and
LlmlLs". lor our purposes, Lhe mosL useful of Lhese are Lhe Answer" and SenslLlvlLy" reporLs.
SelecL Lhese reporLs and Lhen cllck on Ck". Lxcel wlll Lhen creaLe new sheeLs ln Lhe workbook called
Answer 8eporL 1 and SenslLlvlLy 8eporL 1. 1he answer reporL ls shown ln llgure 10 and Lhe senslLlvlLy
reporL ls shown ln llgure 11.
Answer 8eporL1

I|gure 10: Answer reporL for Lhe spreadsheeL loocostet8tewety.xlsx

SenslLlvlLy reporL1
1S | Ao l ottoJoctl oo to 5pteoJsbeet Optl ml zotl oo usl oq xcel 5ol vet


I|gure 11: SenslLlvlLy reporL for Lhe spreadsheeL loocostet8tewety.xlsx
1he slze of Lhe reporLs depends on Lhe number of declslon varlables and consLralnLs ln Lhe
model. ln Lhe answer reporL, lnformaLlon ls glven lndlcaLlng wheLher or noL consLralnLs are blndlng aL
Lhe opLlmal soluLlon. ln addlLlon, Lhe answer reporL glves slack values. 1he senslLlvlLy reporL glves
shadow prlces (l.e. dual values), rlghL-hand slde ranges and oLher lnformaLlon. lor example, Lhe dual
value for Lhe hops consLralnL (6, ln Lhls case) represenLs Lhe change ln Lhe opLlmal ob[ecLlve funcLlon
value per unlL change ln Lhe quanLlLy of hops avallable. lf 61 ozs. of hops were avallable Lhe opLlmal
ob[ecLlve proflL would lncrease Lo 1,086.
11. Sav|ng and |oad|ng opt|m|zat|on mode|s
Lxcel saves Lhe mosL recenL opLlmlzaLlon model ln Lhe spreadsheeL. So savlng a model ls oot really
necessary unless you need Lo keep mulLlple opLlmlzaLlon models ln a slngle workbook (l.e.
spreadsheeL). lor example, lL ls someLlmes useful Lo keep models wlLh dlfferenL seLs of consLralnLs or
dlfferenL ob[ecLlve funcLlons. Savlng and loadlng models can also be handy ln con[uncLlon wlLh
spreadsheeL macros.
Savlng and loadlng opLlmlzaLlon models ls done ln Lhe Solver CpLlons dlalog box. Choose
uoto{5olvet{Optloos Lo brlng up Lhe 5olvet Optloos dlalog box. 1hen choose Save Model" Lo save an
opLlmlzaLlon model or Load Model" Lo load an opLlmlzaLlon model. AddlLlonal lnformaLlon ls
avallable from Lhe Pelp" buLLon. lL ls a good pracLlce Lo save Lhe model Lo anoLher sheeL of Lhe
workbook.

Vous aimerez peut-être aussi