SlideShare a Scribd company logo
1 of 2
Download to read offline
348 Statistical Computing with R
11.8 Linear Programming – The Simplex Method
The simplex method is a widely applied optimization method for a special
class of constrained optimization problems with linear objective functions and
linear constraints. The constraints usually include inequalities, and therefore
the region over which the objective function is to be optimized (the feasible
region) can be described by a simplex. Linear programming methods include
the simplex method and interior point methods, but here we illustrate the
simplex method only. See Nocedal and Wright [206, Ch. 13] for a summary
of the simplex method.
Given m linear constraints in n variables, let A be the m × n matrix of
coefficients, so that the constraints are given by Ax ≥ b, where b ∈ Rm
. Here
we suppose that m < n. An element x ∈ Rn
of the feasible set satisfies the
constraint Ax ≥ b. The objective function is a linear function of n variables
with coefficients given by vector c. Hence, the objective is to minimize cT
x
subject to the constraint Ax ≥ b.
The problem as stated above is the primal problem. The dual problem is:
maximize bT
y subject to the constraint AT
y ≤ c, where y ∈ Rn
. The duality
theorem states that if either the primal or the dual problem has an optimal
solution with a finite objective value, then the primal and the dual problems
have the same optimal objective value.
The vertices of the simplex are called the basic feasible points of the fea-
sible set. When the optimal value of the objective function exists, it will be
achieved at one of the basic feasible points. The simplex algorithm evaluates
the objective function at the basic feasible points, but selects the points at
each iteration in such a way that an optimal solution is found in relatively
few iterations. It can be shown (see e.g. [206, Thm. 13.4]) that if the linear
program is bounded and not degenerate, the simplex algorithm will terminate
after finitely many iterations at one of the basic feasible points.
The simplex method is implemented by the simplex function in the boot
package [34]. The simplex function will maximize or minimize the linear
function ax subject to the constraints A1x ≤ b1, A2x ≥ b2, A3x = b3, and
x ≥ 0. Either the primal or dual problem is easily handled by the simplex
function.
Example 11.16 (Simplex algorithm)
Use the simplex algorithm to solve the following problem.
Maximize 2x + 2y + 3z subject to
−2x + y + z ≤ 1
4x − y + 3z ≤ 3
x ≥ 0, y ≥ 0, z ≥ 0.
Numerical Methods in R 349
For such a small problem, it would not be too difficult to solve it directly, be-
cause the theory implies that if there is an optimal solution, it will be achieved
at one of the vertices of the feasible set. Hence, we need only evaluate the
objective function at each of the finitely many vertices. The vertices are de-
termined by the intersection of the linear constraints. The simplex method
also evaluates the objective function as it moves from one vertex to another,
usually changing the coordinates in one vertex only at each step. The trick
is to decide which vertex to check next by moving in the direction of greatest
increase/decrease in the objective function. Eventually, for bounded, nonde-
generate problems, the value of the objective function cannot be improved and
the algorithm terminates with the solution. The simplex function implements
the algorithm.
library(boot) #for simplex function
A1 <- rbind(c(-2, 1, 1), c(4, -1, 3))
b1 <- c(1, 3)
a <- c(2, 2, 3)
simplex(a = a, A1 = A1, b1 = b1, maxi = TRUE)
Optimal solution has the following values
x1 x2 x3
2 5 0
The optimal value of the objective function is 14.

11.9 Application: Game Theory
In the linear program of Example 11.16, the constraints are inequalities.
Equality constraints are also possible. Equality constraints might arise if, for
example, the sum of the variables is fixed. If the variables represent a discrete
probability mass function, the sum of the probabilities must equal one. We
solve for a probability mass function in the next problem. It is a classical
problem in game theory.
Example 11.17 (Solving the Morra game)
One of the world’s oldest known games of strategy is the Morra game. In the
3-finger Morra game, each player shows 1, 2, or 3 fingers, and simultaneously
each calls his guess of the number of fingers his opponent will show. If both
players guess correctly, the game is a draw. If exactly one player guesses
correctly, he wins an amount equal to the sum of the fingers shown by both

More Related Content

What's hot

Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Assignment Chapter - Q & A Compilation by Niraj Thapa
Assignment Chapter  - Q & A Compilation by Niraj ThapaAssignment Chapter  - Q & A Compilation by Niraj Thapa
Assignment Chapter - Q & A Compilation by Niraj ThapaCA Niraj Thapa
 
AMA_Assignment Theory notes
AMA_Assignment Theory notesAMA_Assignment Theory notes
AMA_Assignment Theory notesCA Niraj Thapa
 
Assignment problem
Assignment problemAssignment problem
Assignment problemAbu Bashar
 
An efficient linear elastic FEM solver using automatic local grid refinement ...
An efficient linear elastic FEM solver using automatic local grid refinement ...An efficient linear elastic FEM solver using automatic local grid refinement ...
An efficient linear elastic FEM solver using automatic local grid refinement ...Harshal Patil
 
Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesSuman Bhattacharyya
 
Linear programming: A Geometric Approach
Linear programming: A Geometric ApproachLinear programming: A Geometric Approach
Linear programming: A Geometric ApproachEFREN ARCHIDE
 
Numerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemeNumerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemexingangahu
 

What's hot (20)

Penalty functions
Penalty functionsPenalty functions
Penalty functions
 
Penalty function
Penalty function Penalty function
Penalty function
 
Chapter two
Chapter twoChapter two
Chapter two
 
04. backtracking
04. backtracking04. backtracking
04. backtracking
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Assignment Chapter - Q & A Compilation by Niraj Thapa
Assignment Chapter  - Q & A Compilation by Niraj ThapaAssignment Chapter  - Q & A Compilation by Niraj Thapa
Assignment Chapter - Q & A Compilation by Niraj Thapa
 
Digital Signal Processing Homework Help
Digital Signal Processing Homework HelpDigital Signal Processing Homework Help
Digital Signal Processing Homework Help
 
AMA_Assignment Theory notes
AMA_Assignment Theory notesAMA_Assignment Theory notes
AMA_Assignment Theory notes
 
Assignment problem
Assignment problemAssignment problem
Assignment problem
 
An efficient linear elastic FEM solver using automatic local grid refinement ...
An efficient linear elastic FEM solver using automatic local grid refinement ...An efficient linear elastic FEM solver using automatic local grid refinement ...
An efficient linear elastic FEM solver using automatic local grid refinement ...
 
Environmental Engineering Assignment Help
Environmental Engineering Assignment HelpEnvironmental Engineering Assignment Help
Environmental Engineering Assignment Help
 
Stability Analysis of Discrete System
Stability Analysis of Discrete SystemStability Analysis of Discrete System
Stability Analysis of Discrete System
 
Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization Techniques
 
7 regularization
7 regularization7 regularization
7 regularization
 
Brute force method
Brute force methodBrute force method
Brute force method
 
Linear programming: A Geometric Approach
Linear programming: A Geometric ApproachLinear programming: A Geometric Approach
Linear programming: A Geometric Approach
 
Merge Sort
Merge SortMerge Sort
Merge Sort
 
Numerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemeNumerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi scheme
 
Extrapolation
ExtrapolationExtrapolation
Extrapolation
 
Calc 4.6
Calc 4.6Calc 4.6
Calc 4.6
 

Similar to Statistical computing with r estatistica - maria l. rizzo

LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)Dionísio Carmo-Neto
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdfBechanYadav4
 
A Regularized Simplex Method
A Regularized Simplex MethodA Regularized Simplex Method
A Regularized Simplex MethodGina Brown
 
Numerical analysis dual, primal, revised simplex
Numerical analysis  dual, primal, revised simplexNumerical analysis  dual, primal, revised simplex
Numerical analysis dual, primal, revised simplexSHAMJITH KM
 
Lecture5-7_12946_Linear Programming The Graphical Method.pptx
Lecture5-7_12946_Linear Programming The Graphical Method.pptxLecture5-7_12946_Linear Programming The Graphical Method.pptx
Lecture5-7_12946_Linear Programming The Graphical Method.pptxhlKh4
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1debolina13
 
LPP, Duality and Game Theory
LPP, Duality and Game TheoryLPP, Duality and Game Theory
LPP, Duality and Game TheoryPurnima Pandit
 
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...SSA KPI
 
Simplex method - Maximisation Case
Simplex method - Maximisation CaseSimplex method - Maximisation Case
Simplex method - Maximisation CaseJoseph Konnully
 
Quantum algorithm for solving linear systems of equations
 Quantum algorithm for solving linear systems of equations Quantum algorithm for solving linear systems of equations
Quantum algorithm for solving linear systems of equationsXequeMateShannon
 
Simplex method material for operation .pptx
Simplex method material for operation .pptxSimplex method material for operation .pptx
Simplex method material for operation .pptxbizuayehuadmasu1
 
A brief study on linear programming solving methods
A brief study on linear programming solving methodsA brief study on linear programming solving methods
A brief study on linear programming solving methodsMayurjyotiNeog
 
Numerical Solution of Linear algebraic Equation
Numerical Solution of Linear algebraic EquationNumerical Solution of Linear algebraic Equation
Numerical Solution of Linear algebraic Equationpayalpriyadarshinisa1
 

Similar to Statistical computing with r estatistica - maria l. rizzo (20)

LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf
 
Optmization techniques
Optmization techniquesOptmization techniques
Optmization techniques
 
optmizationtechniques.pdf
optmizationtechniques.pdfoptmizationtechniques.pdf
optmizationtechniques.pdf
 
A Regularized Simplex Method
A Regularized Simplex MethodA Regularized Simplex Method
A Regularized Simplex Method
 
Ijetr021210
Ijetr021210Ijetr021210
Ijetr021210
 
Ijetr021210
Ijetr021210Ijetr021210
Ijetr021210
 
Numerical analysis dual, primal, revised simplex
Numerical analysis  dual, primal, revised simplexNumerical analysis  dual, primal, revised simplex
Numerical analysis dual, primal, revised simplex
 
Lecture5-7_12946_Linear Programming The Graphical Method.pptx
Lecture5-7_12946_Linear Programming The Graphical Method.pptxLecture5-7_12946_Linear Programming The Graphical Method.pptx
Lecture5-7_12946_Linear Programming The Graphical Method.pptx
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1
 
LPP, Duality and Game Theory
LPP, Duality and Game TheoryLPP, Duality and Game Theory
LPP, Duality and Game Theory
 
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...
Efficient Solution of Two-Stage Stochastic Linear Programs Using Interior Poi...
 
Simplex method - Maximisation Case
Simplex method - Maximisation CaseSimplex method - Maximisation Case
Simplex method - Maximisation Case
 
Quantum algorithm for solving linear systems of equations
 Quantum algorithm for solving linear systems of equations Quantum algorithm for solving linear systems of equations
Quantum algorithm for solving linear systems of equations
 
Simplex method material for operation .pptx
Simplex method material for operation .pptxSimplex method material for operation .pptx
Simplex method material for operation .pptx
 
Solution 3.
Solution 3.Solution 3.
Solution 3.
 
A brief study on linear programming solving methods
A brief study on linear programming solving methodsA brief study on linear programming solving methods
A brief study on linear programming solving methods
 
Numerical Solution of Linear algebraic Equation
Numerical Solution of Linear algebraic EquationNumerical Solution of Linear algebraic Equation
Numerical Solution of Linear algebraic Equation
 
EPE821_Lecture3.pptx
EPE821_Lecture3.pptxEPE821_Lecture3.pptx
EPE821_Lecture3.pptx
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 

More from André Oliveira Souza (14)

Cartilha de seguranca_sobre_pedofilia_orientacoes_aos_pais
Cartilha de seguranca_sobre_pedofilia_orientacoes_aos_paisCartilha de seguranca_sobre_pedofilia_orientacoes_aos_pais
Cartilha de seguranca_sobre_pedofilia_orientacoes_aos_pais
 
Sitema linear
Sitema linearSitema linear
Sitema linear
 
336 1170-1-pb tocher anderson
336 1170-1-pb  tocher anderson336 1170-1-pb  tocher anderson
336 1170-1-pb tocher anderson
 
336 1170-1-pb tocher anderson
336 1170-1-pb  tocher anderson336 1170-1-pb  tocher anderson
336 1170-1-pb tocher anderson
 
336 1170-1-pb tocher anderson
336 1170-1-pb  tocher anderson336 1170-1-pb  tocher anderson
336 1170-1-pb tocher anderson
 
Olhar digital visualização de impressão novas regras da anatel sobre direi...
Olhar digital   visualização de impressão  novas regras da anatel sobre direi...Olhar digital   visualização de impressão  novas regras da anatel sobre direi...
Olhar digital visualização de impressão novas regras da anatel sobre direi...
 
Resolução nº 632, de 7 de março de 2014 portal de legislação da anatel (res...
Resolução nº 632, de 7 de março de 2014   portal de legislação da anatel (res...Resolução nº 632, de 7 de março de 2014   portal de legislação da anatel (res...
Resolução nº 632, de 7 de março de 2014 portal de legislação da anatel (res...
 
Mca025
Mca025Mca025
Mca025
 
V.a.d
V.a.dV.a.d
V.a.d
 
Apostila latex 2010
Apostila latex 2010Apostila latex 2010
Apostila latex 2010
 
Grfico por atributos
Grfico por atributosGrfico por atributos
Grfico por atributos
 
Ceq1
Ceq1Ceq1
Ceq1
 
Dados exemplo
Dados exemploDados exemplo
Dados exemplo
 
Negativos
NegativosNegativos
Negativos
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

Statistical computing with r estatistica - maria l. rizzo

  • 1. 348 Statistical Computing with R 11.8 Linear Programming – The Simplex Method The simplex method is a widely applied optimization method for a special class of constrained optimization problems with linear objective functions and linear constraints. The constraints usually include inequalities, and therefore the region over which the objective function is to be optimized (the feasible region) can be described by a simplex. Linear programming methods include the simplex method and interior point methods, but here we illustrate the simplex method only. See Nocedal and Wright [206, Ch. 13] for a summary of the simplex method. Given m linear constraints in n variables, let A be the m × n matrix of coefficients, so that the constraints are given by Ax ≥ b, where b ∈ Rm . Here we suppose that m < n. An element x ∈ Rn of the feasible set satisfies the constraint Ax ≥ b. The objective function is a linear function of n variables with coefficients given by vector c. Hence, the objective is to minimize cT x subject to the constraint Ax ≥ b. The problem as stated above is the primal problem. The dual problem is: maximize bT y subject to the constraint AT y ≤ c, where y ∈ Rn . The duality theorem states that if either the primal or the dual problem has an optimal solution with a finite objective value, then the primal and the dual problems have the same optimal objective value. The vertices of the simplex are called the basic feasible points of the fea- sible set. When the optimal value of the objective function exists, it will be achieved at one of the basic feasible points. The simplex algorithm evaluates the objective function at the basic feasible points, but selects the points at each iteration in such a way that an optimal solution is found in relatively few iterations. It can be shown (see e.g. [206, Thm. 13.4]) that if the linear program is bounded and not degenerate, the simplex algorithm will terminate after finitely many iterations at one of the basic feasible points. The simplex method is implemented by the simplex function in the boot package [34]. The simplex function will maximize or minimize the linear function ax subject to the constraints A1x ≤ b1, A2x ≥ b2, A3x = b3, and x ≥ 0. Either the primal or dual problem is easily handled by the simplex function. Example 11.16 (Simplex algorithm) Use the simplex algorithm to solve the following problem. Maximize 2x + 2y + 3z subject to −2x + y + z ≤ 1 4x − y + 3z ≤ 3 x ≥ 0, y ≥ 0, z ≥ 0.
  • 2. Numerical Methods in R 349 For such a small problem, it would not be too difficult to solve it directly, be- cause the theory implies that if there is an optimal solution, it will be achieved at one of the vertices of the feasible set. Hence, we need only evaluate the objective function at each of the finitely many vertices. The vertices are de- termined by the intersection of the linear constraints. The simplex method also evaluates the objective function as it moves from one vertex to another, usually changing the coordinates in one vertex only at each step. The trick is to decide which vertex to check next by moving in the direction of greatest increase/decrease in the objective function. Eventually, for bounded, nonde- generate problems, the value of the objective function cannot be improved and the algorithm terminates with the solution. The simplex function implements the algorithm. library(boot) #for simplex function A1 <- rbind(c(-2, 1, 1), c(4, -1, 3)) b1 <- c(1, 3) a <- c(2, 2, 3) simplex(a = a, A1 = A1, b1 = b1, maxi = TRUE) Optimal solution has the following values x1 x2 x3 2 5 0 The optimal value of the objective function is 14. 11.9 Application: Game Theory In the linear program of Example 11.16, the constraints are inequalities. Equality constraints are also possible. Equality constraints might arise if, for example, the sum of the variables is fixed. If the variables represent a discrete probability mass function, the sum of the probabilities must equal one. We solve for a probability mass function in the next problem. It is a classical problem in game theory. Example 11.17 (Solving the Morra game) One of the world’s oldest known games of strategy is the Morra game. In the 3-finger Morra game, each player shows 1, 2, or 3 fingers, and simultaneously each calls his guess of the number of fingers his opponent will show. If both players guess correctly, the game is a draw. If exactly one player guesses correctly, he wins an amount equal to the sum of the fingers shown by both