Using Excel Solver in Optimization Problems: Leslie Chandrakantha

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

USING LkCLL SCLVLk IN C1IMI2A1ICN kC8LLMS

Les||e Chandrakantha
!ohn !ay College of Crlmlnal !usLlce of Cun?
MaLhemaLlcs and CompuLer Sclence ueparLmenL
443 WesL 39
Lh
SLreeL, new ?ork, n? 10019
lchandra[[[ay.cuny.edu


Abstract
We lllusLraLe Lhe use of spreadsheeL modellng and Lxcel Solver ln solvlng llnear and
nonllnear programmlng problems ln an lnLroducLory CperaLlons 8esearch course. 1hls ls
especlally useful for lnLerdlsclpllnary courses lnvolvlng opLlmlzaLlon problems. We work
Lhrough examples from dlfferenL areas such as manufacLurlng, LransporLaLlon, flnanclal
plannlng, and schedullng Lo demonsLraLe Lhe use of Solver.

Introduct|on
CpLlmlzaLlon problems are real world problems we encounLer ln many areas such as
maLhemaLlcs, englneerlng, sclence, buslness and economlcs. ln Lhese problems, we flnd
Lhe opLlmal, or mosL efflclenL, way of uslng llmlLed resources Lo achleve Lhe ob[ecLlve of
Lhe slLuaLlon. 1hls may be maxlmlzlng Lhe proflL, mlnlmlzlng Lhe cosL, mlnlmlzlng Lhe
LoLal dlsLance Lravelled or mlnlmlzlng Lhe LoLal Llme Lo compleLe a pro[ecL. lor Lhe glven
problem, we formulaLe a maLhemaLlcal descrlpLlon called a maLhemaLlcal model Lo
represenL Lhe slLuaLlon. 1he model conslsLs of followlng componenLs:

! ueclslon varlables: 1he declslons of Lhe problem are represenLed uslng symbols
such as x
1
, x
2
, x
3
,...x
n
. 1hese varlables represenL unknown quanLlLles (number
of lLems Lo produce, amounLs of money Lo lnvesL ln and so on).
! Cb[ecLlve funcLlon: 1he ob[ecLlve of Lhe problem ls expressed as a maLhemaLlcal
expresslon ln declslon varlables. 1he ob[ecLlve may be maxlmlzlng Lhe proflL,
mlnlmlzlng Lhe cosL, dlsLance, Llme, eLc.,
! ConsLralnLs: 1he llmlLaLlons or requlremenLs of Lhe problem are expressed as
lnequallLles or equaLlons ln declslon varlables.

lf Lhe model conslsLs of a llnear ob[ecLlve funcLlon and llnear consLralnLs ln declslon
varlables, lL ls called a llnear programmlng model. A nonllnear programmlng model
conslsLs of a nonllnear ob[ecLlve funcLlon and nonllnear consLralnLs. Llnear programmlng
ls a Lechnlque used Lo solve models wlLh llnear ob[ecLlve funcLlon and llnear consLralnLs.
1he Slmplex AlgorlLhm developed by uanLzlg (1963) ls used Lo solve llnear programmlng
problems. 1hls Lechnlque can be used Lo solve problems ln Lwo or hlgher dlmenslons.

42
ln Lhls paper we show how Lo use spreadsheeL modellng and Lxcel Solver for solvlng
llnear and nonllnear programmlng problems.

Spreadsheet Mode||ng and Lxce| So|ver
A maLhemaLlcal model lmplemenLed ln a spreadsheeL ls called a spreadsheeL model.
Ma[or spreadsheeL packages come wlLh a bullL-ln opLlmlzaLlon Lool called Solver. now
we demonsLraLe how Lo use Lxcel spreadsheeL modellng and Solver Lo flnd Lhe opLlmal
soluLlon of opLlmlzaLlon problems.

lf Lhe model has Lwo varlables, Lhe graphlcal meLhod can be used Lo solve Lhe model.
very few real world problems lnvolve only Lwo varlables. lor problems wlLh more Lhan
Lwo varlables, we need Lo use complex Lechnlques and Ledlous calculaLlons Lo flnd Lhe
opLlmal soluLlon. 1he spreadsheeL and solver approach makes solvlng opLlmlzaLlon
problems a falrly slmple Lask and lL ls more useful for sLudenLs who do noL have sLrong
maLhemaLlcs background.

1he flrsL sLep ls Lo organlze Lhe spreadsheeL Lo represenL Lhe model. We use separaLe
cells Lo represenL declslon varlables, creaLe a formula ln a cell Lo represenL Lhe ob[ecLlve
funcLlon and creaLe a formula ln a cell for each consLralnL lefL hand slde. Cnce Lhe
model ls lmplemenLed ln a spreadsheeL, nexL sLep ls Lo use Lhe Solver Lo flnd Lhe
soluLlon. ln Lhe Solver, we need Lo ldenLlfy Lhe locaLlons (cells) of ob[ecLlve funcLlon,
declslon varlables, naLure of Lhe ob[ecLlve funcLlon (maxlmlze/mlnlmlze) and
consLralnLs.

Lxamp|e Cne (L|near mode|): Investment rob|em
Cur flrsL example lllusLraLes how Lo allocaLe money Lo dlfferenL bonds Lo maxlmlze Lhe
LoLal reLurn (8agsdale 2011, p. 121).
A LrusL offlce aL Lhe 8lacksburg naLlonal 8ank needs Lo deLermlne how Lo lnvesL
$100,000 ln followlng collecLlon of bonds Lo maxlmlze Lhe annual reLurn.
8ond Annua|
keturn
Matur|ty k|sk 1ax-Iree
A 9.3 Long Plgh ?es
8 8.0 ShorL Low ?es
C 9.0 Long Low no
u 9.0 Long Plgh ?es
L 9.0 ShorL Plgh no
1he offlcer wanLs Lo lnvesL aL leasL 30 of Lhe money ln shorL Lerm lssues and no more
Lhan 30 ln hlgh-rlsk lssues. AL leasL 30 of Lhe funds should go ln Lax-free lnvesLmenLs,
and aL leasL 40 of Lhe LoLal reLurn should be Lax free.

CreaLlng Lhe Llnear rogrammlng model Lo represenL Lhe problem:
ueclslon varlables are Lhe amounLs of money should be lnvesLed ln each bond.
x
1
= AmounL of money Lo lnvesL ln 8ond A
43
x
2
= AmounL of money Lo lnvesL ln 8ond 8
x
3
= AmounL of money Lo lnvesL ln 8ond C
x
4
= AmounL of money Lo lnvesL ln 8ond u
x
3
= AmounL of money Lo lnvesL ln 8ond L

Cb[ecLlve luncLlon:
Cb[ecLlve ls Lo maxlmlze Lhe LoLal annual reLurn.
Maxlmlze f(x
1
, x
2
, x
3
, x
4
, x
3
) = 9.3x
1
+ 8x
2
+ 9x
3
+ 9x
4
+ 9x
3


ConsLralnLs:
1oLal lnvesLmenL:
x
1
+ x
2
+ x
3
+ x
4
+ x
3
= 100,000.
AL leasL 30 of Lhe money goes Lo shorL Lerm lssues:
x
2
+ x
3
>= 30,000.
no more Lhan 30 of Lhe money should go Lo hlgh rlsk lssues:
x
1
+ x
4
+ x
3
<= 30,000.
AL leasL 30 of Lhe money should go Lo Lax free lnvesLmenLs:
x
1
+ x
2
+ x
4
>= 30,000.
AL leasL 40 of Lhe LoLal annual reLurn should be Lax free:
9.3x
1
+ 8x
2
+ 9x
4
>= 40(9.3x
1
+ 8x
2
+ 9x
3
+ 9x
4
+ 9x
3
)
nonnegaLlvlLy consLralnLs (all Lhe varlables should be nonnegaLlve):
x
1
, x
2
, x
3
, x
4
, x
3
>= 0.

CompleLe llnear programmlng model:
Max: .093x
1
+ .08x
2
+ .09x
3
+.09x
4
+ .09x
3


Sub[ecL Lo:
x
1
+ x
2
+ x
3
+ x
4
+ x
3
= 100,000.
x
2
+ x
3
>= 30,000.
x
1
+ x
4
+ x
3
<= 30,000.
x
1
+ x
2
+ x
4
>= 30,000.
9.3x
1
+ 8x
2
+ 9x
4
>= 40(9.3x
1
+ 8x
2
+ 9x
3
+ 9x
4
+ 9x
3
)
x
1
, x
2
, x
3
, x
4
, x
3
>= 0.

SpreadsheeL model and Solver lmplemenLaLlon:
lmplemenLlng Lhe problem ln an Lxcel spreadsheeL and Solver formulaLlon produces Lhe
followlng spreadsheeL and Solver parameLers. 1he cells 86 Lhrough 810 represenL Lhe
flve declslon varlables. 1he cell C13 represenLs Lhe ob[ecLlve funcLlon. 1he cells 811,
L11, C11, l11, 814, and 813 represenL Lhe consLralnL lefL hand sldes. 1he nonnegaLlvlLy
consLralnL ls noL lmplemenLed ln Lhe spreadsheeL and lL can be lmplemenLed ln Lhe
Solver. 1he compleLe seL of consLralnLs, LargeL cell (ob[ecLlve funcLlon cell), varlable cells
(changlng cells) and wheLher Lo maxlmlze or mlnlmlze Lhe ob[ecLlve funcLlon are
ldenLlfled ln Lhe Solver parameLers box.
44
"#$%&' () *+&',-./''0 #1+2'1'30,0#43 45 '6,1+2' 43'













"#$%&' 7) *428'& #1+2'1'30,0#43 45 '6,1+2' 43'














"#$%&' 9) *+&',-./''0 :#0/ 4+0#1,2 .42%0#43 45 '6,1+2' 43'

45
CpLlmal money allocaLlon:
AmounL lnvesLed ln 8ond A = x
1
= $20, 339.
AmounL lnvesLed ln 8ond 8 = x
2
= $20, 339.
AmounL lnvesLed ln 8ond C = x
3
= $29, 661.
AmounL lnvesLed ln 8ond u = x
4
= $0.
AmounL lnvesLed ln 8ond L = x
3
= $29, 661.

1he Maxlmum annual reLurn ls $8,898.00

Lxamp|e 1wo (Non||near mode|): Network I|ow rob|em
1hls example lllusLraLes how Lo flnd Lhe opLlmal paLh Lo LransporL hazardous maLerlal (
8agsdale, 2011, p.367)
SafeLy 1rans ls a Lrucklng company LhaL speclallzes LransporLlng exLremely valuable and
exLremely hazardous maLerlals. uue Lo Lhe naLure of Lhe buslness, Lhe company places
greaL lmporLance on malnLalnlng a clean drlvlng safeLy record. 1hls noL only helps keep
Lhelr repuLaLlon up buL also helps keep Lhelr lnsurance premlum down. 1he company ls
also consclous of Lhe facL LhaL when carrylng hazardous maLerlals, Lhe envlronmenLal
consequences of even a mlnor accldenL could be dlsasLrous.
SafeLy 1rans llkes Lo ensure LhaL lL selecLs rouLes LhaL are leasL llkely Lo resulL ln an
accldenL. 1he company ls currenLly Lrylng Lo ldenLlfy Lhe safesL rouLes for carrylng a load
of hazardous maLerlals from Los Angeles Lo Amarlllo, 1exas. 1he followlng neLwork
summarlzes Lhe rouLes under conslderaLlon. 1he numbers on each arc represenL Lhe
probablllLy of havlng an accldenL on each poLenLlal leg of Lhe [ourney.
I|gure ;) <'0:4&= -#,$&,1 45 '6,1+2' 0:4

1
2
3
4
6
3
8
7
10
9
Los Ange|es
Amar|||o 0.003
0.002
0.004 0.002
0.010
0.010 0.006
0.006
0.009
0.002
0.003
0.010
0.001
0.004
0.001
0.00S
0.003
0.006
San D|ego
Las Vegas
1ucson
I|agstaff
hoen|x
Las Cruces
Lubbock
A|buquerque
46
1he ob[ecLlve ls Lo flnd Lhe rouLe LhaL mlnlmlzes Lhe probablllLy of havlng an accldenL, or
equlvalenLly, Lhe rouLe LhaL maxlmlzes Lhe probablllLy of noL havlng an accldenL.

CreaLlng Lhe maLhemaLlcal model Lo represenL Lhe problem:
Lach declslon varlable lndlcaLes wheLher or noL a parLlcular rouLe ls Laken (Lhey are
known as blnary varlables). We wlll deflne Lhese varlables ln followlng way:
x
l[
= 1 , lf Lhe rouLe from node l Lo node [ ls selecLed, and x
l[
= 0 oLherwlse.
LeL
l[
be Lhe probablllLy of havlng an accldenL whlle Lravelllng from node l Lo node [
(1-
l[
ls Lhe probablllLy

of noL havlng an accldenL).

Cb[ecLlve funcLlon:
Mlnlmlze Lhe probablllLy of havlng an accldenL or equlvalenLly, maxlmlze Lhe probablllLy
of noL havlng an accldenL. noLe LhaL Lhls ob[ecLlve funcLlon ls nonllnear.

Maxlmlze f(x
12
, x
13
,..) = (1-
12
*x
12
) (1-
13
*x
13
) (1 -
14
*x
14
) (1 -
24
*x
24
) .... (1 -

9.10
*x
9,10
)

ConsLralnLs:
We use Lhe followlng sLraLegy Lo consLrucL consLralnLs: 1haL ls, supply one unlL aL Lhe
sLarLlng node and demand one unlL aL Lhe endlng node, and for every oLher node,
demand or supply ls zero. We flnd Lhe rouLe ln whlch Lhe one unlL Lravels.
1oLal supply = 1, and LoLal demand = 1, so for each node,
neL flow (lnflow - CuLflow) = demand or supply for LhaL node (8alance of flow rule).
1hen we have followlng seL of consLralnLs:
node 1: - x
12
- x
13
- x
14
= -1
node 2: + x
12
- x
24
- x
26
= 0
node 3: + x
13
- x
34
- x
33
= 0
node 4: + x
14
+ x
24
+ x
34
- x
43
- x
46
- x
48
= 0
node 3: + x
33
+ x
43
- x
37
= 0
node 6: + x
26
+ x
46
- x
67
- x
68
= 0
node 7: + x
37
+ x
67
- x
78
- x
7,10
= 0
node 8: + x
48
+ x
68
+ x
78
- x
8,10
= 0
node 9: + x
79
- x
9,10
= 0
node 10: + x
7,10
+ x
8,10
+ x
9,10
= 1

CompleLe nonllnear rogrammlng model:
Maxlmlze: (1-
12
*x
12
) (1-
13
*x
13
) (1 -
14
*x
14
) (1 -
24
*x
24
) .... (1-
9.10
*x
9,10
)

Sub[ecL Lo:
- x
12
- x
13
- x
14
= -1
+ x
12
- x
24
- x
26
= 0
+ x
13
- x
34
- x
33
= 0
47
+ x
14
+ x
24
+ x
34
- x
43
- x
46
- x
48
= 0
+ x
33
+ x
43
- x
37
= 0
+ x
26
+ x
46
- x
67
- x
68
= 0
+ x
37
+ x
67
- x
78
- x
7,10
= 0
+ x
48
+ x
68
+ x
78
- x
8,10
= 0
+ x
79
- x
9,10
= 0
+ x
7,10
+ x
8,10
+ x
9,10
= 1

All x
l[
are blnary.

SpreadsheeL model and Solver lmplemenLaLlon:
















"#$%&' >) *+&',-./''0 #1+2'1'30,0#43 45 '6,1+2' ?:4













"#$%&' @) *428'& #1+2'1'30,0#43 45 '6,1+2' 0:4
48

















"#$%&' A) *+&',-./''0 :#0/ 4+0#1,2 .42%0#43 45 '6,1+2' 0:4

1he opLlmal paLh:
1he rouLe LhaL mlnlmlzes Lhe probablllLy of havlng an accldenL ls glven below:

Los Angeles Lo hoenlx
hoenlx Lo llagsLaff
llagsLaff Lo Albuquerque
Albuquerque Lo Amarlllo.

Conc|us|on:
CpLlmlzaLlon problems ln many flelds can be modeled and solved uslng Lxcel Solver. lL
does noL requlre knowledge of complex maLhemaLlcal concepLs behlnd Lhe soluLlon
algorlLhms. 1hls way ls parLlcularly helpful for sLudenLs who are non maLh ma[ors and
sLlll wanL Lo Lake Lheses courses.


keferences:
1) Cllff 1. 8agsdale, 2011, SpreadsheeL Modellng and ueclslon Analysls, 6
Lh
LdlLlon.
SCu1P-WLS1L8n, Cengage Learnlng.
2) uanLzlg, C. 8. 1963, Llnear rogrammlng and LxLenslons, rlnceLon unlverslLy
ress, rlnceLon, n!.
3) !ohn Walkenbach, 2007, Lxcel 2007 lormulas, !ohn Wlley and Sons.
49

You might also like